[gimp-macos-build/wip/Jehan/GDK-expose-too-much] patches, modulesets: add a patch to expose smaller redraw rectangles.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-macos-build/wip/Jehan/GDK-expose-too-much] patches, modulesets: add a patch to expose smaller redraw rectangles.
- Date: Sun, 13 Feb 2022 15:47:55 +0000 (UTC)
commit 22944ea93c9b59cb4258e89fdaf6136e9eb438a6
Author: Jehan <jehan girinstud io>
Date: Sun Feb 13 16:47:12 2022 +0100
patches, modulesets: add a patch to expose smaller redraw rectangles.
modulesets/gtk-osx.modules | 1 +
...tz-send-expose-events-for-individual-dama.patch | 87 ++++++++++++++++++++++
2 files changed, 88 insertions(+)
---
diff --git a/modulesets/gtk-osx.modules b/modulesets/gtk-osx.modules
index 39abb31..fe0f42a 100644
--- a/modulesets/gtk-osx.modules
+++ b/modulesets/gtk-osx.modules
@@ -291,6 +291,7 @@
<patch file="gtk-3.24.31-use-cairo-surface-for-drawing.patch" strip="1"/>
<!-- patch in new API function to stop GtkLabel from always resizing when text set -->
<patch file="gtk+-3.24.31-gtklabel-set-text-no-resize.patch" strip="1"/>
+ <patch file="gtk3-gdk-in-Quartz-send-expose-events-for-individual-dama.patch" strip="1"/>
</branch>
<dependencies>
<dep package="glib"/>
diff --git a/patches/gtk3-gdk-in-Quartz-send-expose-events-for-individual-dama.patch
b/patches/gtk3-gdk-in-Quartz-send-expose-events-for-individual-dama.patch
new file mode 100644
index 0000000..8070a0a
--- /dev/null
+++ b/patches/gtk3-gdk-in-Quartz-send-expose-events-for-individual-dama.patch
@@ -0,0 +1,87 @@
+From 4e2c4129a71de6f03ce36ff67b7ffab95ac800d2 Mon Sep 17 00:00:00 2001
+From: Jehan <jehan girinstud io>
+Date: Sun, 13 Feb 2022 16:29:11 +0100
+Subject: [PATCH] gdk: in Quartz, send expose events for individual damaged
+ regions.
+
+Current code was unioning the various regions returned by
+getRectsBeingDrawn. Unfortunately cairo/pixman unions are not real
+boolean geometry union operations. It creates a bounding box of the
+input regions. So if we have a pixel to the bottom left of a big area
+and a pixel to the top right, we might end up invalidating the whole
+area needlessly. And if this often happens, we are just constantly
+redrawing everything.
+
+This is a problem which happens in GIMP because our canvas has a
+position label and rulers constantly changing when cursor moves, so when
+you move the pointer, the GUI ends up redrawing nearly the whole canvas
+constantly (instead of a few small rectangles).
+
+Note that on recent macOS, it also requires the code brought from commit
+10b5f8a0d6a to work correctly:
+
+> view.layer.contentsFormat = kCAContentsFormatRGBA8Uint
+
+Without this, getRectsBeingDrawn would itself only return a single
+rectangle of the whole view.
+---
+ gdk/quartz/GdkQuartzView.c | 26 +++++++++++++-------------
+ 1 file changed, 13 insertions(+), 13 deletions(-)
+
+diff --git a/gdk/quartz/GdkQuartzView.c b/gdk/quartz/GdkQuartzView.c
+index c20c5de83a..f3d630ffc2 100644
+--- a/gdk/quartz/GdkQuartzView.c
++++ b/gdk/quartz/GdkQuartzView.c
+@@ -309,12 +309,10 @@
+
+ -(void)drawRect: (NSRect)rect
+ {
+- GdkRectangle gdk_rect;
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (gdk_window->impl);
+ const NSRect *drawn_rects;
+ NSInteger count;
+ int i;
+- cairo_region_t *region;
+
+ if (GDK_WINDOW_DESTROYED (gdk_window))
+ return;
+@@ -352,23 +350,25 @@
+ }
+
+ [self getRectsBeingDrawn: &drawn_rects count: &count];
+- region = cairo_region_create ();
+
+ for (i = 0; i < count; i++)
+ {
+- gdk_rect.x = drawn_rects[i].origin.x;
+- gdk_rect.y = drawn_rects[i].origin.y;
+- gdk_rect.width = drawn_rects[i].size.width;
+- gdk_rect.height = drawn_rects[i].size.height;
++ cairo_region_t *region;
++ cairo_rectangle_int_t cairo_rect;
+
+- cairo_region_union_rectangle (region, &gdk_rect);
+- }
++ cairo_rect.x = drawn_rects[i].origin.x;
++ cairo_rect.y = drawn_rects[i].origin.y;
++ cairo_rect.width = drawn_rects[i].size.width;
++ cairo_rect.height = drawn_rects[i].size.height;
++
++ region = cairo_region_create_rectangles (&cairo_rect, 1);
+
+- impl->in_paint_rect_count++;
+- _gdk_window_process_updates_recurse (gdk_window, region);
+- impl->in_paint_rect_count--;
++ impl->in_paint_rect_count++;
++ _gdk_window_process_updates_recurse (gdk_window, region);
++ impl->in_paint_rect_count--;
+
+- cairo_region_destroy (region);
++ cairo_region_destroy (region);
++ }
+
+ if (needsInvalidateShadow)
+ {
+--
+2.30.2
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]