[gtk: 1/7] texture: Unvirtualize download_surface




commit 88b709d5ec6012c1e877a497551e52543297c2f0
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Sep 24 15:40:17 2020 +0200

    texture: Unvirtualize download_surface
    
    We only have one implementation, so why do all this vfunc work?

 gdk/gdktexture.c        | 41 +++++++++++++++++------------------------
 gdk/gdktextureprivate.h |  1 -
 2 files changed, 17 insertions(+), 25 deletions(-)
---
diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c
index a6db7d5e17..c28bd9575f 100644
--- a/gdk/gdktexture.c
+++ b/gdk/gdktexture.c
@@ -130,28 +130,6 @@ gdk_texture_real_download (GdkTexture         *self,
   GDK_TEXTURE_WARN_NOT_IMPLEMENTED_METHOD (self, download);
 }
 
-static cairo_surface_t *
-gdk_texture_real_download_surface (GdkTexture *texture)
-{
-  cairo_surface_t *surface;
-  cairo_status_t surface_status;
-
-  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
-                                        texture->width, texture->height);
-
-  surface_status = cairo_surface_status (surface);
-  if (surface_status != CAIRO_STATUS_SUCCESS)
-    g_warning ("%s: surface error: %s", __FUNCTION__,
-               cairo_status_to_string (surface_status));
-
-  gdk_texture_download (texture,
-                        cairo_image_surface_get_data (surface),
-                        cairo_image_surface_get_stride (surface));
-  cairo_surface_mark_dirty (surface);
-
-  return surface;
-}
-
 static void
 gdk_texture_set_property (GObject      *gobject,
                           guint         prop_id,
@@ -216,7 +194,6 @@ gdk_texture_class_init (GdkTextureClass *klass)
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
   klass->download = gdk_texture_real_download;
-  klass->download_surface = gdk_texture_real_download_surface;
 
   gobject_class->set_property = gdk_texture_set_property;
   gobject_class->get_property = gdk_texture_get_property;
@@ -438,7 +415,23 @@ gdk_texture_get_height (GdkTexture *texture)
 cairo_surface_t *
 gdk_texture_download_surface (GdkTexture *texture)
 {
-  return GDK_TEXTURE_GET_CLASS (texture)->download_surface (texture);
+  cairo_surface_t *surface;
+  cairo_status_t surface_status;
+
+  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+                                        texture->width, texture->height);
+
+  surface_status = cairo_surface_status (surface);
+  if (surface_status != CAIRO_STATUS_SUCCESS)
+    g_warning ("%s: surface error: %s", __FUNCTION__,
+               cairo_status_to_string (surface_status));
+
+  gdk_texture_download (texture,
+                        cairo_image_surface_get_data (surface),
+                        cairo_image_surface_get_stride (surface));
+  cairo_surface_mark_dirty (surface);
+
+  return surface;
 }
 
 void
diff --git a/gdk/gdktextureprivate.h b/gdk/gdktextureprivate.h
index 07cb5436a3..3e2e9f3a49 100644
--- a/gdk/gdktextureprivate.h
+++ b/gdk/gdktextureprivate.h
@@ -28,7 +28,6 @@ struct _GdkTextureClass {
                                                          const GdkRectangle     *area,
                                                          guchar                 *data,
                                                          gsize                   stride);
-  cairo_surface_t *     (* download_surface)            (GdkTexture             *texture);
 };
 
 gpointer                gdk_texture_new                 (const GdkTextureClass  *klass,


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