viewport: share style context with pixelcache

This allows the pixel cache to opportunistically use CAIRO_CONTENT_COLOR
instead of CAIRO_CONTENT_COLOR_ALPHA during surface creation.

https://bugzilla.gnome.org/show_bug.cgi?id=754658
This commit is contained in:
Christian Hergert 2015-09-08 15:09:04 -07:00
parent d7eb90779f
commit 7c1ce9f3ad

View File

@ -260,6 +260,7 @@ static void
gtk_viewport_init (GtkViewport *viewport)
{
GtkViewportPrivate *priv;
GtkStyleContext *style_context;
viewport->priv = gtk_viewport_get_instance_private (viewport);
priv = viewport->priv;
@ -276,6 +277,9 @@ gtk_viewport_init (GtkViewport *viewport)
priv->pixel_cache = _gtk_pixel_cache_new ();
style_context = gtk_widget_get_style_context (GTK_WIDGET (viewport));
_gtk_pixel_cache_set_style_context (priv->pixel_cache, style_context);
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (viewport)), GTK_STYLE_CLASS_FRAME);
viewport_set_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL, NULL);
viewport_set_adjustment (viewport, GTK_ORIENTATION_VERTICAL, NULL);