[gtk/matthiasc/color-profile-rebased: 23/46] Fixes for gdk_memory_txture_new_subtexture
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/color-profile-rebased: 23/46] Fixes for gdk_memory_txture_new_subtexture
- Date: Tue, 10 May 2022 13:15:49 +0000 (UTC)
commit f8157abd4bde56bbe75271f32eb3d0d28fb4fc1d
Author: Matthias Clasen <mclasen redhat com>
Date: Sun May 8 13:53:04 2022 -0400
Fixes for gdk_memory_txture_new_subtexture
There were several mistakes here.
gdk/gdkmemorytexture.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gdk/gdkmemorytexture.c b/gdk/gdkmemorytexture.c
index 9dc0321f1b..e439ca2d99 100644
--- a/gdk/gdkmemorytexture.c
+++ b/gdk/gdkmemorytexture.c
@@ -225,15 +225,15 @@ gdk_memory_texture_new_subtexture (GdkMemoryTexture *source,
GBytes *bytes;
g_return_val_if_fail (GDK_IS_MEMORY_TEXTURE (source), NULL);
- g_return_val_if_fail (x < 0 || x >= GDK_TEXTURE (source)->width, NULL);
- g_return_val_if_fail (y < 0 || y >= GDK_TEXTURE (source)->height, NULL);
- g_return_val_if_fail (width <= 0 || x + width > GDK_TEXTURE (source)->width, NULL);
- g_return_val_if_fail (height <= 0 || y + height > GDK_TEXTURE (source)->height, NULL);
+ g_return_val_if_fail (x >= 0 || x < GDK_TEXTURE (source)->width, NULL);
+ g_return_val_if_fail (y >= 0 || y < GDK_TEXTURE (source)->height, NULL);
+ g_return_val_if_fail (width > 0 || x + width <= GDK_TEXTURE (source)->width, NULL);
+ g_return_val_if_fail (height > 0 || y + height <= GDK_TEXTURE (source)->height, NULL);
texture = GDK_TEXTURE (source);
bpp = gdk_memory_format_bytes_per_pixel (texture->format);
offset = y * source->stride + x * bpp;
- size = source->stride * (height - 1) + x * bpp;
+ size = source->stride * (height - 1) + width * bpp;
bytes = g_bytes_new_from_bytes (source->bytes, offset, size);
result = gdk_memory_texture_new (texture->width,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]