Remove redundant size checks, and document that width, height must be > 0.

2006-12-21  Matthias Clasen  <mclasen@redhat.com>

        * gdk-pixbuf-data.c (gdk_pixbuf_new_from_data):
        * gdk-pixbuf.c (gdk_pixbuf_new): Remove redundant size
        checks, and document that width, height must be > 0.
        (#343330, Felix Riemann)
This commit is contained in:
Matthias Clasen 2006-12-21 20:40:24 +00:00 committed by Matthias Clasen
parent c35978a370
commit 0f1bed1d74
3 changed files with 19 additions and 17 deletions

View File

@ -1,5 +1,10 @@
2006-12-21 Matthias Clasen <mclasen@redhat.com>
* gdk-pixbuf-data.c (gdk_pixbuf_new_from_data):
* gdk-pixbuf.c (gdk_pixbuf_new): Remove redundant size
checks, and document that width, height must be > 0.
(#343330, Felix Riemann)
* Makefile.am: Link against GLib. (#341158, Alexey Rusakov)
2006-12-19 Matthias Clasen <mclasen@redhat.com>

View File

@ -31,16 +31,16 @@
/**
* gdk_pixbuf_new_from_data:
* @data: Image data in 8-bit/sample packed format.
* @colorspace: Colorspace for the image data.
* @has_alpha: Whether the data has an opacity channel.
* @bits_per_sample: Number of bits per sample.
* @width: Width of the image in pixels.
* @height: Height of the image in pixels.
* @rowstride: Distance in bytes between row starts.
* @data: Image data in 8-bit/sample packed format
* @colorspace: Colorspace for the image data
* @has_alpha: Whether the data has an opacity channel
* @bits_per_sample: Number of bits per sample
* @width: Width of the image in pixels, must be > 0
* @height: Height of the image in pixels, must be > 0
* @rowstride: Distance in bytes between row starts
* @destroy_fn: Function used to free the data when the pixbuf's reference count
* drops to zero, or %NULL if the data should not be freed.
* @destroy_fn_data: Closure data to pass to the destroy notification function.
* drops to zero, or %NULL if the data should not be freed
* @destroy_fn_data: Closure data to pass to the destroy notification function
*
* Creates a new #GdkPixbuf out of in-memory image data. Currently only RGB
* images with 8 bits per sample are supported.

View File

@ -224,11 +224,11 @@ free_buffer (guchar *pixels, gpointer data)
/**
* gdk_pixbuf_new:
* @colorspace: Color space for image.
* @has_alpha: Whether the image should have transparency information.
* @bits_per_sample: Number of bits per color sample.
* @width: Width of image in pixels.
* @height: Height of image in pixels.
* @colorspace: Color space for image
* @has_alpha: Whether the image should have transparency information
* @bits_per_sample: Number of bits per color sample
* @width: Width of image in pixels, must be > 0
* @height: Height of image in pixels, must be > 0
*
* Creates a new #GdkPixbuf structure and allocates a buffer for it. The
* buffer has an optimal rowstride. Note that the buffer is not cleared;
@ -254,9 +254,6 @@ gdk_pixbuf_new (GdkColorspace colorspace,
g_return_val_if_fail (width > 0, NULL);
g_return_val_if_fail (height > 0, NULL);
if (width <= 0 || height <= 0)
return NULL;
channels = has_alpha ? 4 : 3;
rowstride = width * channels;
if (rowstride / channels != width || rowstride + 3 < 0) /* overflow */