[gtk/matthiasc/for-master: 30/30] gdk: Short-circuit some surface setters
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 30/30] gdk: Short-circuit some surface setters
- Date: Wed, 20 May 2020 15:01:00 +0000 (UTC)
commit 6d8153d8fdce0d6d6745b4cf6585fc9655cc89d7
Author: Matthias Clasen <mclasen redhat com>
Date: Wed May 20 10:55:27 2020 -0400
gdk: Short-circuit some surface setters
Don't call into the backends when the input region
or shadow width don't actually change. This avoid
distracting calls in debug logs, and just generally
is the right thing to do.
gdk/gdksurface.c | 9 +++++++++
1 file changed, 9 insertions(+)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 104bc719d2..a154319cde 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -2118,6 +2118,9 @@ gdk_surface_set_input_region (GdkSurface *surface,
if (GDK_SURFACE_DESTROYED (surface))
return;
+ if (cairo_region_equal (surface->input_region, region))
+ return;
+
if (surface->input_region)
cairo_region_destroy (surface->input_region);
@@ -2702,6 +2705,12 @@ gdk_surface_set_shadow_width (GdkSurface *surface,
g_return_if_fail (!GDK_SURFACE_DESTROYED (surface));
g_return_if_fail (left >= 0 && right >= 0 && top >= 0 && bottom >= 0);
+ if (surface->shadow_left == left &&
+ surface->shadow_right == right &&
+ surface->shadow_top == top &&
+ surface->shadow_bottom == bottom)
+ return;
+
surface->shadow_top = top;
surface->shadow_left = left;
surface->shadow_right = right;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]