applied patch from Pedro Gimeno that makes sure we always invalidate

2004-01-12  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpimage-projection.c (gimp_image_invalidate): applied
	patch from Pedro Gimeno that makes sure we always invalidate
	complete tiles, not parts of it. Fixes bug #116765.

	* app/display/gimpdisplay.c (gimp_display_paint_area): calculate
	the image area to invalidate using sub-pixel precision and
	ceil()/floor() the resulting area to make sure we always
	invalidate a superset of the dirty area, not a subset. A rounding
	error here has never been reported but would cause effects similar
	to #116765.
This commit is contained in:
Michael Natterer
2004-01-12 11:11:27 +00:00
committed by Michael Natterer
parent cbdb6947af
commit dbbf5130cd
5 changed files with 63 additions and 24 deletions

View File

@ -1,3 +1,16 @@
2004-01-12 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage-projection.c (gimp_image_invalidate): applied
patch from Pedro Gimeno that makes sure we always invalidate
complete tiles, not parts of it. Fixes bug #116765.
* app/display/gimpdisplay.c (gimp_display_paint_area): calculate
the image area to invalidate using sub-pixel precision and
ceil()/floor() the resulting area to make sure we always
invalidate a superset of the dirty area, not a subset. A rounding
error here has never been reported but would cause effects similar
to #116765.
2004-01-12 Sven Neumann <sven@gimp.org> 2004-01-12 Sven Neumann <sven@gimp.org>
* libgimp/gimpmenu.c (gimp_image_menu_new): call the callback with * libgimp/gimpmenu.c (gimp_image_menu_new): call the callback with

View File

@ -262,19 +262,23 @@ gimp_image_invalidate (GimpImage *gimage,
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE); tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
/* check if the tile is outside the bounds */ /* check if the tile is outside the bounds */
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0) if ((MIN ((j + tile_ewidth (tile)), x2) - MAX (j, x1)) <= 0)
{ {
tile_invalidate_tile (&tile, tm, j, i); tile_invalidate_tile (&tile, tm, j, i);
if (j < x1) if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile))); startx = MAX (startx,
(j - (j % TILE_WIDTH) + tile_ewidth (tile)));
else else
endx = MIN (endx, j); endx = MIN (endx, j);
} }
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0) else if (MIN ((i + tile_eheight (tile)), y2) - MAX (i, y1) <= 0)
{ {
tile_invalidate_tile (&tile, tm, j, i); tile_invalidate_tile (&tile, tm, j, i);
if (i < y1) if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile))); starty = MAX (starty,
(i - (i % TILE_HEIGHT) + tile_eheight (tile)));
else else
endy = MIN (endy, i); endy = MIN (endy, i);
} }

View File

@ -262,19 +262,23 @@ gimp_image_invalidate (GimpImage *gimage,
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE); tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
/* check if the tile is outside the bounds */ /* check if the tile is outside the bounds */
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0) if ((MIN ((j + tile_ewidth (tile)), x2) - MAX (j, x1)) <= 0)
{ {
tile_invalidate_tile (&tile, tm, j, i); tile_invalidate_tile (&tile, tm, j, i);
if (j < x1) if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile))); startx = MAX (startx,
(j - (j % TILE_WIDTH) + tile_ewidth (tile)));
else else
endx = MIN (endx, j); endx = MIN (endx, j);
} }
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0) else if (MIN ((i + tile_eheight (tile)), y2) - MAX (i, y1) <= 0)
{ {
tile_invalidate_tile (&tile, tm, j, i); tile_invalidate_tile (&tile, tm, j, i);
if (i < y1) if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile))); starty = MAX (starty,
(i - (i % TILE_HEIGHT) + tile_eheight (tile)));
else else
endy = MIN (endy, i); endy = MIN (endy, i);
} }

View File

@ -682,14 +682,23 @@ gimp_display_paint_area (GimpDisplay *gdisp,
h = (y2 - y1); h = (y2 - y1);
/* calculate the extents of the update as limited by what's visible */ /* calculate the extents of the update as limited by what's visible */
gimp_display_shell_untransform_xy (shell, gimp_display_shell_untransform_xy_f (shell,
0, 0, 0, 0,
&x1, &y1, &x1_f, &y1_f,
FALSE, FALSE); FALSE);
gimp_display_shell_untransform_xy (shell, gimp_display_shell_untransform_xy_f (shell,
shell->disp_width, shell->disp_height, shell->disp_width, shell->disp_height,
&x2, &y2, &x2_f, &y2_f,
FALSE, FALSE); FALSE);
/* make sure to limit the invalidated area to a superset of the
* untransformed sub-pixel display area, not a subset.
* bug #116765. --mitch
*/
x1 = floor (x1_f);
y1 = floor (y1_f);
x2 = ceil (x2_f);
y2 = ceil (y2_f);
gimp_image_invalidate (gdisp->gimage, x, y, w, h, x1, y1, x2, y2); gimp_image_invalidate (gdisp->gimage, x, y, w, h, x1, y1, x2, y2);

View File

@ -682,14 +682,23 @@ gimp_display_paint_area (GimpDisplay *gdisp,
h = (y2 - y1); h = (y2 - y1);
/* calculate the extents of the update as limited by what's visible */ /* calculate the extents of the update as limited by what's visible */
gimp_display_shell_untransform_xy (shell, gimp_display_shell_untransform_xy_f (shell,
0, 0, 0, 0,
&x1, &y1, &x1_f, &y1_f,
FALSE, FALSE); FALSE);
gimp_display_shell_untransform_xy (shell, gimp_display_shell_untransform_xy_f (shell,
shell->disp_width, shell->disp_height, shell->disp_width, shell->disp_height,
&x2, &y2, &x2_f, &y2_f,
FALSE, FALSE); FALSE);
/* make sure to limit the invalidated area to a superset of the
* untransformed sub-pixel display area, not a subset.
* bug #116765. --mitch
*/
x1 = floor (x1_f);
y1 = floor (y1_f);
x2 = ceil (x2_f);
y2 = ceil (y2_f);
gimp_image_invalidate (gdisp->gimage, x, y, w, h, x1, y1, x2, y2); gimp_image_invalidate (gdisp->gimage, x, y, w, h, x1, y1, x2, y2);