diff options
| author | Eli Zaretskii | 2015-07-29 20:02:56 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-07-29 20:02:56 +0300 |
| commit | cafa012c8f745ef4dada889813f8b7f982c1ea9f (patch) | |
| tree | 04374980f8cb2f104709657770dedea3523e473e /src | |
| parent | afb497408f273bb11f88738cc3ed76ecd3d7ac3b (diff) | |
| download | emacs-cafa012c8f745ef4dada889813f8b7f982c1ea9f.tar.gz emacs-cafa012c8f745ef4dada889813f8b7f982c1ea9f.zip | |
Fix redisplay of large images on expose events
* src/xdisp.c (expose_window, expose_area): Avoid comparisons
between signed negative values and unsigned values. This
prevented redisplay on expose events when the window showed a very
large image.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 2be057fd211..5a89f4c988b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -30061,8 +30061,11 @@ expose_area (struct window *w, struct glyph_row *row, XRectangle *r, | |||
| 30061 | /* Find the last one. */ | 30061 | /* Find the last one. */ |
| 30062 | last = first; | 30062 | last = first; |
| 30063 | first_x = x; | 30063 | first_x = x; |
| 30064 | while (last < end | 30064 | /* Use a signed int intermediate value to avoid catastrophic |
| 30065 | && x < r->x + r->width) | 30065 | failures due to comparison between signed and unsigned, when |
| 30066 | x is negative (can happen for wide images that are hscrolled). */ | ||
| 30067 | int r_end = r->x + r->width; | ||
| 30068 | while (last < end && x < r_end) | ||
| 30066 | { | 30069 | { |
| 30067 | x += last->pixel_width; | 30070 | x += last->pixel_width; |
| 30068 | ++last; | 30071 | ++last; |
| @@ -30336,6 +30339,11 @@ expose_window (struct window *w, XRectangle *fr) | |||
| 30336 | check later if it is changed. */ | 30339 | check later if it is changed. */ |
| 30337 | bool phys_cursor_on_p = w->phys_cursor_on_p; | 30340 | bool phys_cursor_on_p = w->phys_cursor_on_p; |
| 30338 | 30341 | ||
| 30342 | /* Use a signed int intermediate value to avoid catastrophic | ||
| 30343 | failures due to comparison between signed and unsigned, when | ||
| 30344 | y0 or y1 is negative (can happen for tall images). */ | ||
| 30345 | int r_bottom = r.y + r.height; | ||
| 30346 | |||
| 30339 | /* Update lines intersecting rectangle R. */ | 30347 | /* Update lines intersecting rectangle R. */ |
| 30340 | first_overlapping_row = last_overlapping_row = NULL; | 30348 | first_overlapping_row = last_overlapping_row = NULL; |
| 30341 | for (row = w->current_matrix->rows; | 30349 | for (row = w->current_matrix->rows; |
| @@ -30345,10 +30353,10 @@ expose_window (struct window *w, XRectangle *fr) | |||
| 30345 | int y0 = row->y; | 30353 | int y0 = row->y; |
| 30346 | int y1 = MATRIX_ROW_BOTTOM_Y (row); | 30354 | int y1 = MATRIX_ROW_BOTTOM_Y (row); |
| 30347 | 30355 | ||
| 30348 | if ((y0 >= r.y && y0 < r.y + r.height) | 30356 | if ((y0 >= r.y && y0 < r_bottom) |
| 30349 | || (y1 > r.y && y1 < r.y + r.height) | 30357 | || (y1 > r.y && y1 < r_bottom) |
| 30350 | || (r.y >= y0 && r.y < y1) | 30358 | || (r.y >= y0 && r.y < y1) |
| 30351 | || (r.y + r.height > y0 && r.y + r.height < y1)) | 30359 | || (r_bottom > y0 && r_bottom < y1)) |
| 30352 | { | 30360 | { |
| 30353 | /* A header line may be overlapping, but there is no need | 30361 | /* A header line may be overlapping, but there is no need |
| 30354 | to fix overlapping areas for them. KFS 2005-02-12 */ | 30362 | to fix overlapping areas for them. KFS 2005-02-12 */ |
| @@ -30385,7 +30393,7 @@ expose_window (struct window *w, XRectangle *fr) | |||
| 30385 | if (WINDOW_WANTS_MODELINE_P (w) | 30393 | if (WINDOW_WANTS_MODELINE_P (w) |
| 30386 | && (row = MATRIX_MODE_LINE_ROW (w->current_matrix), | 30394 | && (row = MATRIX_MODE_LINE_ROW (w->current_matrix), |
| 30387 | row->enabled_p) | 30395 | row->enabled_p) |
| 30388 | && row->y < r.y + r.height) | 30396 | && row->y < r_bottom) |
| 30389 | { | 30397 | { |
| 30390 | if (expose_line (w, row, &r)) | 30398 | if (expose_line (w, row, &r)) |
| 30391 | mouse_face_overwritten_p = true; | 30399 | mouse_face_overwritten_p = true; |