texture: Remove unused argument from vfunc

This commit is contained in:
Benjamin Otte 2021-09-08 20:46:25 +02:00
parent 46f88c69a1
commit 0ee3b1c861
4 changed files with 16 additions and 39 deletions

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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,