[gtk+/wip/baedert/children: 26/30] iconhelper: Ensure the surface used for textures is ARGB32
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/children: 26/30] iconhelper: Ensure the surface used for textures is ARGB32
- Date: Fri, 2 Dec 2016 16:39:27 +0000 (UTC)
commit 3a444286f0c7a1f772d8de66040a1c831813d9fc
Author: Timm Bäder <mail baedert org>
Date: Fri Dec 2 17:32:12 2016 +0100
iconhelper: Ensure the surface used for textures is ARGB32
gtk/gtkiconhelper.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index fd04cbe..8ed26c5 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -565,6 +565,23 @@ gtk_icon_helper_ensure_texture (GtkIconHelper *self,
scale = gtk_widget_get_scale_factor (gtk_css_gadget_get_owner (GTK_CSS_GADGET (self))),
_gtk_icon_helper_get_size (self, &width, &height);
+
+ if (cairo_image_surface_get_format (self->priv->rendered_surface) != CAIRO_FORMAT_ARGB32)
+ {
+ cairo_surface_t *argb_surface = cairo_surface_create_similar_image (self->priv->rendered_surface,
+ CAIRO_FORMAT_ARGB32,
+ width, height);
+ cairo_t *ct;
+ cairo_surface_set_device_scale (argb_surface, scale, scale);
+
+ ct = cairo_create (argb_surface);
+ cairo_set_source_surface (ct, self->priv->rendered_surface, 0, 0);
+ cairo_paint (ct);
+ cairo_destroy (ct);
+ cairo_surface_destroy (self->priv->rendered_surface);
+ self->priv->rendered_surface = argb_surface;
+ }
+
map = cairo_surface_map_to_image (self->priv->rendered_surface,
&(GdkRectangle) { 0, 0, width * scale, height * scale});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]