[gtk+/wip/paint-stack-cleanup: 2/4] gdkwindow: Only skip alpha blending if we cleared to the background
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/paint-stack-cleanup: 2/4] gdkwindow: Only skip alpha blending if we cleared to the background
- Date: Sat, 21 Jun 2014 15:27:18 +0000 (UTC)
commit fd898e01aafe6792d8d644a516780402c044c88f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sat Jun 21 10:20:15 2014 -0400
gdkwindow: Only skip alpha blending if we cleared to the background
Currently, this always happens, but some consumers of begin_paint_region
want to be able to start a paint that doesn't end up clearing to the
background pattern. We'll expose a new API for this and remove the
automatic clear from begin_paint_region.
gdk/gdkinternals.h | 1 +
gdk/gdkwindow.c | 10 ++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 32754a3..331e6d9 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -209,6 +209,7 @@ struct _GdkWindow
cairo_region_t *region;
cairo_surface_t *surface;
gboolean surface_needs_composite;
+ gboolean cleared_to_background;
} current_paint;
cairo_region_t *update_area;
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index ad93c9b..b43feeb 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -1826,6 +1826,7 @@ gdk_window_free_current_paint (GdkWindow *window)
window->current_paint.region = NULL;
window->current_paint.surface_needs_composite = FALSE;
+ window->current_paint.cleared_to_background = FALSE;
}
/**
@@ -2832,9 +2833,10 @@ gdk_window_end_paint (GdkWindow *window)
cairo_clip (cr);
/* We can skip alpha blending for a fast composite case
- * if we have an impl window or we're a fully opaque window. */
+ * if we have an impl window or we're a fully opaque window that
+ * has been cleared to the background pattern. */
skip_alpha_blending = (gdk_window_has_impl (window) ||
- window->alpha == 255);
+ (window->alpha == 255 && window->current_paint.cleared_to_background));
if (skip_alpha_blending)
{
@@ -2976,6 +2978,10 @@ gdk_window_clear_backing_region (GdkWindow *window)
cairo_fill (cr);
cairo_destroy (cr);
+
+ /* Since we've cleared to an opaque pattern, we can skip alpha
+ * blending later on in the composite stage. */
+ window->current_paint.cleared_to_background = TRUE;
}
/* This returns either the current working surface on the paint stack
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]