diff options
author | Benjamin Otte <otte@redhat.com> | 2016-02-25 16:14:37 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-02-25 16:52:58 +0100 |
commit | 4e8fb33f5677e086e1ba9f5a5650a12be99da99c (patch) | |
tree | 74b9a99679a95ca2296c68ad376672d2008ec5ae /gtk/gtkpixelcache.c | |
parent | 71a9fd9d83f118abc2ed087792459f3e47a555dd (diff) | |
download | gtk+-4e8fb33f5677e086e1ba9f5a5650a12be99da99c.tar.gz |
pixelcache: Don't have a style context argument
That would imply the pixelcache monitors the style context for changes
and it doesn't do that.
Its only use case was opacity checks, so add
gtk_pixel_cache_se_is_opaque() instead.
Diffstat (limited to 'gtk/gtkpixelcache.c')
-rw-r--r-- | gtk/gtkpixelcache.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/gtk/gtkpixelcache.c b/gtk/gtkpixelcache.c index 34a710b6ce..9448401b9e 100644 --- a/gtk/gtkpixelcache.c +++ b/gtk/gtkpixelcache.c @@ -47,15 +47,13 @@ struct _GtkPixelCache { /* may be null if not dirty */ cairo_region_t *surface_dirty; - /* background tracking for rgb/rgba */ - GtkStyleContext *style_context; - guint timeout_tag; guint extra_width; guint extra_height; guint always_cache : 1; + guint is_opaque : 1; }; GtkPixelCache * @@ -93,8 +91,6 @@ _gtk_pixel_cache_free (GtkPixelCache *cache) if (cache->surface_dirty != NULL) cairo_region_destroy (cache->surface_dirty); - g_clear_object (&cache->style_context); - g_free (cache); } @@ -197,10 +193,10 @@ _gtk_pixel_cache_create_surface_if_needed (GtkPixelCache *cache, content = cache->content; if (!content) { - content = CAIRO_CONTENT_COLOR_ALPHA; - if (cache->style_context && - gtk_css_style_render_background_is_opaque (gtk_style_context_lookup_style (cache->style_context))) + if (cache->is_opaque) content = CAIRO_CONTENT_COLOR; + else + content = CAIRO_CONTENT_COLOR_ALPHA; } surface_w = view_rect->width; @@ -504,9 +500,12 @@ _gtk_pixel_cache_set_always_cache (GtkPixelCache *cache, } void -_gtk_pixel_cache_set_style_context (GtkPixelCache *cache, - GtkStyleContext *style_context) +gtk_pixel_cache_set_is_opaque (GtkPixelCache *cache, + gboolean is_opaque) { - if (g_set_object (&cache->style_context, style_context)) - _gtk_pixel_cache_invalidate (cache, NULL); + if (cache->is_opaque == is_opaque) + return; + + cache->is_opaque = is_opaque; + _gtk_pixel_cache_invalidate (cache, NULL); } |