[gtk/wip/chergert/glproto: 220/493] fix pack position in icon cache




commit db635dfc64353a395b0bbe4fc09fd236224ed0ae
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 20 19:36:23 2021 -0800

    fix pack position in icon cache

 gsk/next/gskgliconlibrary.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/gsk/next/gskgliconlibrary.c b/gsk/next/gskgliconlibrary.c
index 36436835d4..e177aaf7b1 100644
--- a/gsk/next/gskgliconlibrary.c
+++ b/gsk/next/gskgliconlibrary.c
@@ -72,6 +72,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary     *self,
                          GdkTexture           *key,
                          const GskGLIconData **out_value)
 {
+  GskGLTextureAtlas *atlas;
   cairo_surface_t *surface;
   GskGLIconData *icon_data;
   guint8 *pixel_data;
@@ -99,6 +100,19 @@ gsk_gl_icon_library_add (GskGLIconLibrary     *self,
                                            height + 2);
   icon_data->source_texture = g_object_ref (key);
 
+  atlas = icon_data->entry.is_atlased ? icon_data->entry.atlas : NULL;
+
+  if G_LIKELY (atlas != NULL)
+    {
+      packed_x = atlas->width * icon_data->entry.area.origin.x;
+      packed_y = atlas->width * icon_data->entry.area.origin.y;
+    }
+  else
+    {
+      packed_x = 0;
+      packed_y = 0;
+    }
+
   /* actually upload the texture */
   surface = gdk_texture_download_surface (key);
   surface_data = cairo_image_surface_get_data (surface);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]