[gtk/wip/otte/float-textures: 1/3] texture: Remove unused argument from vfunc




commit 1344eaecbc25832eed27de547bf5b0c40c051ca6
Author: Benjamin Otte <otte redhat com>
Date:   Wed Sep 8 20:46:25 2021 +0200

    texture: Remove unused argument from vfunc

 gdk/gdkgltexture.c      | 16 +++++++++-------
 gdk/gdkmemorytexture.c  | 14 ++++++--------
 gdk/gdktexture.c        | 20 +-------------------
 gdk/gdktextureprivate.h |  5 -----
 4 files changed, 16 insertions(+), 39 deletions(-)
---
diff --git a/gdk/gdkgltexture.c b/gdk/gdkgltexture.c
index caf3e7ab6b..214ed9eb03 100644
--- a/gdk/gdkgltexture.c
+++ b/gdk/gdkgltexture.c
@@ -74,18 +74,20 @@ gdk_gl_texture_dispose (GObject *object)
 }
 
 static void
-gdk_gl_texture_download (GdkTexture         *texture,
-                         const GdkRectangle *area,
-                         guchar             *data,
-                         gsize               stride)
+gdk_gl_texture_download (GdkTexture *texture,
+                         guchar     *data,
+                         gsize       stride)
 {
   GdkGLTexture *self = GDK_GL_TEXTURE (texture);
   cairo_surface_t *surface;
   cairo_t *cr;
+  int width, height;
 
+  width = gdk_texture_get_width (texture);
+  height = gdk_texture_get_width (texture);
   surface = cairo_image_surface_create_for_data (data,
                                                  CAIRO_FORMAT_ARGB32,
-                                                 area->width, area->height,
+                                                 width, height,
                                                  stride);
 
   cr = cairo_create (surface);
@@ -101,8 +103,8 @@ gdk_gl_texture_download (GdkTexture         *texture,
 
       gl_surface = gdk_gl_context_get_surface (self->context);
       gdk_cairo_draw_from_gl (cr, gl_surface, self->id, GL_TEXTURE, 1, 
-                              area->x, area->y,
-                              area->width, area->height);
+                              0, 0,
+                              width, height);
     }
 
   cairo_destroy (cr);
diff --git a/gdk/gdkmemorytexture.c b/gdk/gdkmemorytexture.c
index 06fa3d6619..a8d8bbd834 100644
--- a/gdk/gdkmemorytexture.c
+++ b/gdk/gdkmemorytexture.c
@@ -80,21 +80,19 @@ gdk_memory_texture_dispose (GObject *object)
 }
 
 static void
-gdk_memory_texture_download (GdkTexture         *texture,
-                             const GdkRectangle *area,
-                             guchar             *data,
-                             gsize               stride)
+gdk_memory_texture_download (GdkTexture *texture,
+                             guchar     *data,
+                             gsize       stride)
 {
   GdkMemoryTexture *self = GDK_MEMORY_TEXTURE (texture);
 
   gdk_memory_convert (data, stride,
                       GDK_MEMORY_CAIRO_FORMAT_ARGB32,
-                      (guchar *) g_bytes_get_data (self->bytes, NULL)
-                        + area->x * gdk_memory_format_bytes_per_pixel (self->format)
-                        + area->y * self->stride,
+                      (guchar *) g_bytes_get_data (self->bytes, NULL),
                       self->stride,
                       self->format,
-                      area->width, area->height);
+                      gdk_texture_get_width (texture),
+                      gdk_texture_get_height (texture));
 }
 
 static void
diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c
index 7ac4f1bb53..1f262909e0 100644
--- a/gdk/gdktexture.c
+++ b/gdk/gdktexture.c
@@ -117,7 +117,6 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GdkTexture, gdk_texture, G_TYPE_OBJECT,
 
 static void
 gdk_texture_real_download (GdkTexture         *self,
-                           const GdkRectangle *area,
                            guchar             *data,
                            gsize               stride)
 {
@@ -435,20 +434,6 @@ gdk_texture_download_surface (GdkTexture *texture)
   return surface;
 }
 
-void
-gdk_texture_download_area (GdkTexture         *texture,
-                           const GdkRectangle *area,
-                           guchar             *data,
-                           gsize               stride)
-{
-  g_assert (area->x >= 0);
-  g_assert (area->y >= 0);
-  g_assert (area->x + area->width <= texture->width);
-  g_assert (area->y + area->height <= texture->height);
-
-  GDK_TEXTURE_GET_CLASS (texture)->download (texture, area, data, stride);
-}
-
 /**
  * gdk_texture_download:
  * @texture: a `GdkTexture`
@@ -485,10 +470,7 @@ gdk_texture_download (GdkTexture *texture,
   g_return_if_fail (data != NULL);
   g_return_if_fail (stride >= gdk_texture_get_width (texture) * 4);
 
-  gdk_texture_download_area (texture,
-                             &(GdkRectangle) { 0, 0, texture->width, texture->height },
-                             data,
-                             stride);
+  GDK_TEXTURE_GET_CLASS (texture)->download (texture, data, stride);
 }
 
 gboolean
diff --git a/gdk/gdktextureprivate.h b/gdk/gdktextureprivate.h
index 3e2e9f3a49..e2e7dc2bae 100644
--- a/gdk/gdktextureprivate.h
+++ b/gdk/gdktextureprivate.h
@@ -25,7 +25,6 @@ struct _GdkTextureClass {
   GObjectClass parent_class;
 
   void                  (* download)                    (GdkTexture             *texture,
-                                                         const GdkRectangle     *area,
                                                          guchar                 *data,
                                                          gsize                   stride);
 };
@@ -35,10 +34,6 @@ gpointer                gdk_texture_new                 (const GdkTextureClass
                                                          int                     height);
 GdkTexture *            gdk_texture_new_for_surface     (cairo_surface_t        *surface);
 cairo_surface_t *       gdk_texture_download_surface    (GdkTexture             *texture);
-void                    gdk_texture_download_area       (GdkTexture             *texture,
-                                                         const GdkRectangle     *area,
-                                                         guchar                 *data,
-                                                         gsize                   stride);
 
 gboolean                gdk_texture_set_render_data     (GdkTexture             *self,
                                                          gpointer                key,


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