From c8e242f14bbba315b4389df8bfffdb7a91b8c2b5 Mon Sep 17 00:00:00 2001 From: Shivram U Date: Fri, 26 Jul 2002 11:14:13 +0000 Subject: [PATCH] Check if depth of the source is not equal to the depth of the colormap Fri Jul 26 16:34:34 2002 Shivram U * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable), (gdk_pixbuf_get_from_image), (rgbconvert), (convert_real_slow): Check if depth of the source is not equal to the depth of the colormap passed. (#75597) --- ChangeLog | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-2 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ gdk/gdkpixbuf-drawable.c | 33 +++++++++++++++++++++++++++++++++ 7 files changed, 75 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8bf745ff02..22b96e24ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri Jul 26 16:34:34 2002 Shivram U + + * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable), + (gdk_pixbuf_get_from_image), (rgbconvert), (convert_real_slow): + Check if depth of the source is not equal to the depth of the colormap + passed. (#75597) + 2002-07-25 Matthias Clasen * gdk/gdkrgb.c (gdk_rgb_select_conv): Use gdk_rgb_convert_4, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 8bf745ff02..22b96e24ce 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Fri Jul 26 16:34:34 2002 Shivram U + + * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable), + (gdk_pixbuf_get_from_image), (rgbconvert), (convert_real_slow): + Check if depth of the source is not equal to the depth of the colormap + passed. (#75597) + 2002-07-25 Matthias Clasen * gdk/gdkrgb.c (gdk_rgb_select_conv): Use gdk_rgb_convert_4, diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 8bf745ff02..22b96e24ce 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Fri Jul 26 16:34:34 2002 Shivram U + + * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable), + (gdk_pixbuf_get_from_image), (rgbconvert), (convert_real_slow): + Check if depth of the source is not equal to the depth of the colormap + passed. (#75597) + 2002-07-25 Matthias Clasen * gdk/gdkrgb.c (gdk_rgb_select_conv): Use gdk_rgb_convert_4, diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 8bf745ff02..22b96e24ce 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Fri Jul 26 16:34:34 2002 Shivram U + + * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable), + (gdk_pixbuf_get_from_image), (rgbconvert), (convert_real_slow): + Check if depth of the source is not equal to the depth of the colormap + passed. (#75597) + 2002-07-25 Matthias Clasen * gdk/gdkrgb.c (gdk_rgb_select_conv): Use gdk_rgb_convert_4, diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 8bf745ff02..22b96e24ce 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Fri Jul 26 16:34:34 2002 Shivram U + + * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable), + (gdk_pixbuf_get_from_image), (rgbconvert), (convert_real_slow): + Check if depth of the source is not equal to the depth of the colormap + passed. (#75597) + 2002-07-25 Matthias Clasen * gdk/gdkrgb.c (gdk_rgb_select_conv): Use gdk_rgb_convert_4, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 8bf745ff02..22b96e24ce 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Fri Jul 26 16:34:34 2002 Shivram U + + * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable), + (gdk_pixbuf_get_from_image), (rgbconvert), (convert_real_slow): + Check if depth of the source is not equal to the depth of the colormap + passed. (#75597) + 2002-07-25 Matthias Clasen * gdk/gdkrgb.c (gdk_rgb_select_conv): Use gdk_rgb_convert_4, diff --git a/gdk/gdkpixbuf-drawable.c b/gdk/gdkpixbuf-drawable.c index ca25768aeb..ec7d650a7a 100644 --- a/gdk/gdkpixbuf-drawable.c +++ b/gdk/gdkpixbuf-drawable.c @@ -1218,6 +1218,14 @@ convert_real_slow (GdkImage *image, bpl = image->bpl; v = gdk_colormap_get_visual(cmap); + if (image->depth != v->depth) + { + g_warning ("%s: The depth of the source image (%d) doesn't " + "match the depth of the colormap passed in (%d).", + G_STRLOC, image->depth, v->depth); + return; + } + d(printf("rgb mask/shift/prec = %x:%x:%x %d:%d:%d %d:%d:%d\n", v->red_mask, v->green_mask, v->blue_mask, v->red_shift, v->green_shift, v->blue_shift, @@ -1329,6 +1337,15 @@ rgbconvert (GdkImage *image, } v = gdk_colormap_get_visual (cmap); + + if (image->depth != v->depth) + { + g_warning ("%s: The depth of the source image (%d) doesn't " + "match the depth of the colormap passed in (%d).", + G_STRLOC, image->depth, v->depth); + return; + } + bank = 5; /* default fallback converter */ index = (image->byte_order == GDK_MSB_FIRST) | (alpha != 0) << 1; @@ -1515,6 +1532,14 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest, return NULL; } + if (cmap != NULL && depth != cmap->visual->depth) + { + g_warning ("%s: Depth of the source drawable is %d where as " + "the visual depth of the colormap passed is %d", + G_STRLOC, depth, cmap->visual->depth); + return NULL; + } + /* Coordinate sanity checks */ if (GDK_IS_PIXMAP (src)) @@ -1623,6 +1648,14 @@ gdk_pixbuf_get_from_image (GdkPixbuf *dest, return NULL; } + if (cmap != NULL && src->depth != cmap->visual->depth) + { + g_warning ("%s: Depth of the Source image is %d where as " + "the visual depth of the colormap passed is %d", + G_STRLOC, src->depth, cmap->visual->depth); + return NULL; + } + /* Coordinate sanity checks */ g_return_val_if_fail (src_x >= 0 && src_y >= 0, NULL);