aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2011-11-28 10:07:01 +0900
committerYAMAMOTO Mitsuharu2011-11-28 10:07:01 +0900
commit1305621bc212d922c5ef8ee89d73ce7aae496b71 (patch)
treec9934aa7e6d362e335934dac0bafab729b6b0ded /src
parent8c9afb46949ddd9853f38eb8c1a865cb13522d92 (diff)
downloademacs-1305621bc212d922c5ef8ee89d73ce7aae496b71.tar.gz
emacs-1305621bc212d922c5ef8ee89d73ce7aae496b71.zip
Truncate scroll runs that copy to where we copied to.
* dispnew.c (scrolling_window): Truncate overlaps in copy destination of scroll runs so as to avoid assigning disabled bogus rows and unnecessary graphics copy operations.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/dispnew.c74
2 files changed, 72 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a2d84d901b5..83b625d279e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12011-11-28 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2
3 * dispnew.c (scrolling_window): Truncate overlaps in copy destination
4 of scroll runs so as to avoid assigning disabled bogus rows and
5 unnecessary graphics copy operations.
6
12011-11-27 Eli Zaretskii <eliz@gnu.org> 72011-11-27 Eli Zaretskii <eliz@gnu.org>
2 8
3 * s/ms-w32.h (utimbuf) [_MSC_VER]: Don't define. 9 * s/ms-w32.h (utimbuf) [_MSC_VER]: Don't define.
diff --git a/src/dispnew.c b/src/dispnew.c
index 385ad98e21f..c9e4ec5c20e 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -4554,18 +4554,69 @@ scrolling_window (struct window *w, int header_line_p)
4554 { 4554 {
4555 rif->clear_window_mouse_face (w); 4555 rif->clear_window_mouse_face (w);
4556 rif->scroll_run_hook (w, r); 4556 rif->scroll_run_hook (w, r);
4557 }
4558
4559 /* Truncate runs that copy to where we copied to, and
4560 invalidate runs that copy from where we copied to. */
4561 for (j = nruns - 1; j > i; --j)
4562 {
4563 struct run *p = runs[j];
4564 int truncated_p = 0;
4557 4565
4558 /* Invalidate runs that copy from where we copied to. */ 4566 if (p->nrows > 0
4559 for (j = i + 1; j < nruns; ++j) 4567 && p->desired_y < r->desired_y + r->height
4568 && p->desired_y + p->height > r->desired_y)
4560 { 4569 {
4561 struct run *p = runs[j]; 4570 if (p->desired_y < r->desired_y)
4571 {
4572 p->nrows = r->desired_vpos - p->desired_vpos;
4573 p->height = r->desired_y - p->desired_y;
4574 truncated_p = 1;
4575 }
4576 else
4577 {
4578 int nrows_copied = (r->desired_vpos + r->nrows
4579 - p->desired_vpos);
4580
4581 if (p->nrows <= nrows_copied)
4582 p->nrows = 0;
4583 else
4584 {
4585 int height_copied = (r->desired_y + r->height
4586 - p->desired_y);
4587
4588 p->current_vpos += nrows_copied;
4589 p->desired_vpos += nrows_copied;
4590 p->nrows -= nrows_copied;
4591 p->current_y += height_copied;
4592 p->desired_y += height_copied;
4593 p->height -= height_copied;
4594 truncated_p = 1;
4595 }
4596 }
4597 }
4562 4598
4563 if ((p->current_y >= r->desired_y 4599 if (r->current_y != r->desired_y
4600 /* The condition below is equivalent to
4601 ((p->current_y >= r->desired_y
4564 && p->current_y < r->desired_y + r->height) 4602 && p->current_y < r->desired_y + r->height)
4565 || (p->current_y + p->height >= r->desired_y 4603 || (p->current_y + p->height > r->desired_y
4566 && (p->current_y + p->height 4604 && (p->current_y + p->height
4567 < r->desired_y + r->height))) 4605 <= r->desired_y + r->height)))
4568 p->nrows = 0; 4606 because we have 0 < p->height <= r->height. */
4607 && p->current_y < r->desired_y + r->height
4608 && p->current_y + p->height > r->desired_y)
4609 p->nrows = 0;
4610
4611 /* Reorder runs by copied pixel lines if truncated. */
4612 if (truncated_p && p->nrows > 0)
4613 {
4614 int k = nruns - 1;
4615
4616 while (runs[k]->nrows == 0 || runs[k]->height < p->height)
4617 k--;
4618 memmove (runs + j, runs + j + 1, (k - j) * sizeof (*runs));
4619 runs[k] = p;
4569 } 4620 }
4570 } 4621 }
4571 4622
@@ -4580,7 +4631,14 @@ scrolling_window (struct window *w, int header_line_p)
4580 to_overlapped_p = to->overlapped_p; 4631 to_overlapped_p = to->overlapped_p;
4581 from->redraw_fringe_bitmaps_p = from->fringe_bitmap_periodic_p; 4632 from->redraw_fringe_bitmaps_p = from->fringe_bitmap_periodic_p;
4582 assign_row (to, from); 4633 assign_row (to, from);
4583 to->enabled_p = 1, from->enabled_p = 0; 4634 /* The above `assign_row' actually does swap, so if we had
4635 an overlap in the copy destination of two runs, then
4636 the second run would assign a previously disabled bogus
4637 row. But thanks to the truncation code in the
4638 preceding for-loop, we no longer have such an overlap,
4639 and thus the assigned row should always be enabled. */
4640 xassert (to->enabled_p);
4641 from->enabled_p = 0;
4584 to->overlapped_p = to_overlapped_p; 4642 to->overlapped_p = to_overlapped_p;
4585 } 4643 }
4586 } 4644 }