app: align display paint area to a coarse grid

Align rectangles added to the display paint area, in
gimp_display_paint_area(), to a coarse grid, to reduce the
complexity of ther overall area.  This is similar to commit
49285463e6, however the alignment
happens in display space, instead of image space.
This commit is contained in:
Ell
2018-04-08 09:16:53 -04:00
parent 440be88035
commit db50c72c24

View File

@ -52,6 +52,9 @@
#define FLUSH_NOW_INTERVAL 20000 /* 20 ms in microseconds */
#define PAINT_AREA_CHUNK_WIDTH 32
#define PAINT_AREA_CHUNK_HEIGHT 32
enum
{
@ -902,5 +905,13 @@ gimp_display_paint_area (GimpDisplay *display,
x2 = ceil (x2_f + 0.5);
y2 = ceil (y2_f + 0.5);
/* align transformed area to a coarse grid, to simplify the
* invalidated area
*/
x1 = floor ((gdouble) x1 / PAINT_AREA_CHUNK_WIDTH) * PAINT_AREA_CHUNK_WIDTH;
y1 = floor ((gdouble) y1 / PAINT_AREA_CHUNK_HEIGHT) * PAINT_AREA_CHUNK_HEIGHT;
x2 = ceil ((gdouble) x2 / PAINT_AREA_CHUNK_WIDTH) * PAINT_AREA_CHUNK_WIDTH;
y2 = ceil ((gdouble) y2 / PAINT_AREA_CHUNK_HEIGHT) * PAINT_AREA_CHUNK_HEIGHT;
gimp_display_shell_expose_area (shell, x1, y1, x2 - x1, y2 - y1);
}