[gimp] app: align display paint area to a coarse grid
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: align display paint area to a coarse grid
- Date: Sun, 8 Apr 2018 13:43:04 +0000 (UTC)
commit db50c72c24fffd07d3bdcadc6a633b864d065fac
Author: Ell <ell_se yahoo com>
Date: Sun Apr 8 09:16:53 2018 -0400
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
49285463e6c0cc03c361902df4e3006fa135dde3, however the alignment
happens in display space, instead of image space.
app/display/gimpdisplay.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c
index 0ed57de..5966b66 100644
--- a/app/display/gimpdisplay.c
+++ b/app/display/gimpdisplay.c
@@ -50,7 +50,10 @@
#include "gimp-intl.h"
-#define FLUSH_NOW_INTERVAL 20000 /* 20 ms in microseconds */
+#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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]