mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Added sanity check for width and height being >= 0. Also, do nothing if
2000-02-03 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf-render.c (gdk_pixbuf_render_threshold_alpha): Added sanity check for width and height being >= 0. Also, do nothing if either of them is zero. Thanks to Ettore for pointing this out. (gdk_pixbuf_render_to_drawable): Likewise. (gdk_pixbuf_render_to_drawable_alpha): Likewise.
This commit is contained in:
parent
51a0dc303d
commit
e9f75f6bd8
@ -1,3 +1,12 @@
|
||||
2000-02-03 Federico Mena Quintero <federico@helixcode.com>
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-render.c
|
||||
(gdk_pixbuf_render_threshold_alpha): Added sanity check for width
|
||||
and height being >= 0. Also, do nothing if either of them is
|
||||
zero. Thanks to Ettore for pointing this out.
|
||||
(gdk_pixbuf_render_to_drawable): Likewise.
|
||||
(gdk_pixbuf_render_to_drawable_alpha): Likewise.
|
||||
|
||||
2000-02-02 Federico Mena Quintero <federico@helixcode.com>
|
||||
|
||||
* gdk-pixbuf/io-gif.c (gif_get_lzw): Removed debugging g_print.
|
||||
|
@ -68,11 +68,15 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
|
||||
g_return_if_fail (apb->bits_per_sample == 8);
|
||||
|
||||
g_return_if_fail (bitmap != NULL);
|
||||
g_return_if_fail (width >= 0 && height >= 0);
|
||||
g_return_if_fail (src_x >= 0 && src_x + width <= apb->width);
|
||||
g_return_if_fail (src_y >= 0 && src_y + height <= apb->height);
|
||||
|
||||
g_return_if_fail (alpha_threshold >= 0 && alpha_threshold <= 255);
|
||||
|
||||
if (width == 0 || height == 0)
|
||||
return;
|
||||
|
||||
gc = gdk_gc_new (bitmap);
|
||||
|
||||
if (!apb->has_alpha) {
|
||||
@ -134,6 +138,7 @@ remove_alpha (ArtPixBuf *apb, int x, int y, int width, int height, int *rowstrid
|
||||
|
||||
g_assert (apb->n_channels == 4);
|
||||
g_assert (apb->has_alpha);
|
||||
g_assert (width > 0 && height > 0);
|
||||
g_assert (x >= 0 && x + width <= apb->width);
|
||||
g_assert (y >= 0 && y + height <= apb->height);
|
||||
|
||||
@ -207,9 +212,13 @@ gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
g_return_if_fail (width >= 0 && height >= 0);
|
||||
g_return_if_fail (src_x >= 0 && src_x + width <= apb->width);
|
||||
g_return_if_fail (src_y >= 0 && src_y + height <= apb->height);
|
||||
|
||||
if (width == 0 || height == 0)
|
||||
return;
|
||||
|
||||
/* This will have to be modified once libart supports other image types.
|
||||
* Also, GdkRGB does not have gdk_draw_rgb_32_image_dithalign(), so we
|
||||
* have to pack the buffer first.
|
||||
@ -287,9 +296,13 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable,
|
||||
g_return_if_fail (apb->bits_per_sample == 8);
|
||||
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (width >= 0 && height >= 0);
|
||||
g_return_if_fail (src_x >= 0 && src_x + width <= apb->width);
|
||||
g_return_if_fail (src_y >= 0 && src_y + height <= apb->height);
|
||||
|
||||
if (width == 0 || height == 0)
|
||||
return;
|
||||
|
||||
gc = gdk_gc_new (drawable);
|
||||
|
||||
if (apb->has_alpha) {
|
||||
|
Loading…
Reference in New Issue
Block a user