Commit 0f1bed1d authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

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)
parent c35978a3
2006-12-21 Matthias Clasen <mclasen@redhat.com> 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) * Makefile.am: Link against GLib. (#341158, Alexey Rusakov)
2006-12-19 Matthias Clasen <mclasen@redhat.com> 2006-12-19 Matthias Clasen <mclasen@redhat.com>
......
...@@ -31,16 +31,16 @@ ...@@ -31,16 +31,16 @@
/** /**
* gdk_pixbuf_new_from_data: * gdk_pixbuf_new_from_data:
* @data: Image data in 8-bit/sample packed format. * @data: Image data in 8-bit/sample packed format
* @colorspace: Colorspace for the image data. * @colorspace: Colorspace for the image data
* @has_alpha: Whether the data has an opacity channel. * @has_alpha: Whether the data has an opacity channel
* @bits_per_sample: Number of bits per sample. * @bits_per_sample: Number of bits per sample
* @width: Width of the image in pixels. * @width: Width of the image in pixels, must be > 0
* @height: Height of the image in pixels. * @height: Height of the image in pixels, must be > 0
* @rowstride: Distance in bytes between row starts. * @rowstride: Distance in bytes between row starts
* @destroy_fn: Function used to free the data when the pixbuf's reference count * @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. * drops to zero, or %NULL if the data should not be freed
* @destroy_fn_data: Closure data to pass to the destroy notification function. * @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 * Creates a new #GdkPixbuf out of in-memory image data. Currently only RGB
* images with 8 bits per sample are supported. * images with 8 bits per sample are supported.
......
...@@ -224,11 +224,11 @@ free_buffer (guchar *pixels, gpointer data) ...@@ -224,11 +224,11 @@ free_buffer (guchar *pixels, gpointer data)
/** /**
* gdk_pixbuf_new: * gdk_pixbuf_new:
* @colorspace: Color space for image. * @colorspace: Color space for image
* @has_alpha: Whether the image should have transparency information. * @has_alpha: Whether the image should have transparency information
* @bits_per_sample: Number of bits per color sample. * @bits_per_sample: Number of bits per color sample
* @width: Width of image in pixels. * @width: Width of image in pixels, must be > 0
* @height: Height of image in pixels. * @height: Height of image in pixels, must be > 0
* *
* Creates a new #GdkPixbuf structure and allocates a buffer for it. The * Creates a new #GdkPixbuf structure and allocates a buffer for it. The
* buffer has an optimal rowstride. Note that the buffer is not cleared; * buffer has an optimal rowstride. Note that the buffer is not cleared;
...@@ -254,9 +254,6 @@ gdk_pixbuf_new (GdkColorspace colorspace, ...@@ -254,9 +254,6 @@ gdk_pixbuf_new (GdkColorspace colorspace,
g_return_val_if_fail (width > 0, NULL); g_return_val_if_fail (width > 0, NULL);
g_return_val_if_fail (height > 0, NULL); g_return_val_if_fail (height > 0, NULL);
if (width <= 0 || height <= 0)
return NULL;
channels = has_alpha ? 4 : 3; channels = has_alpha ? 4 : 3;
rowstride = width * channels; rowstride = width * channels;
if (rowstride / channels != width || rowstride + 3 < 0) /* overflow */ if (rowstride / channels != width || rowstride + 3 < 0) /* overflow */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment