tools/pdbgen/pdb/drawable.pdb don't request viewable previews with a width

2003-04-14  Sven Neumann  <sven@gimp.org>

	* tools/pdbgen/pdb/drawable.pdb
	* tools/pdbgen/pdb/image.pdb: don't request viewable previews with
	a width or height of 0 and don't crash if no preview is returned.

	* app/pdb/drawable_cmds.c
	* app/pdb/image_cmds.c
	* libgimp/gimpdrawable_pdb.c: regenerated.
This commit is contained in:
Sven Neumann 2003-04-14 15:41:46 +00:00 committed by Sven Neumann
parent 21cd66d275
commit cdea262d75
6 changed files with 66 additions and 44 deletions

View File

@ -1,3 +1,13 @@
2003-04-14 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/image.pdb: don't request viewable previews with
a width or height of 0 and don't crash if no preview is returned.
* app/pdb/drawable_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpdrawable_pdb.c: regenerated.
2003-04-14 Michael Natterer <mitch@gimp.org>
* app/tools/gimpvectortool.[ch]: made

View File

@ -1444,19 +1444,22 @@ drawable_thumbnail_invoker (Gimp *gimp,
dheight = gimp_drawable_height (GIMP_DRAWABLE (drawable));
if (dwidth > dheight)
req_height = (req_width * dheight) / dwidth;
req_height = MAX (1, (req_width * dheight) / dwidth);
else
req_width = (req_height * dwidth) / dheight;
req_width = MAX (1, (req_height * dwidth) / dheight);
buf = gimp_viewable_get_preview (GIMP_VIEWABLE (drawable),
req_width, req_height);
num_pixels = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_pixels);
g_memmove (thumbnail_data, temp_buf_data (buf), num_pixels);
width = buf->width;
height = buf->height;
bpp = buf->bytes;
if (buf)
{
num_pixels = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_pixels);
g_memmove (thumbnail_data, temp_buf_data (buf), num_pixels);
width = buf->width;
height = buf->height;
bpp = buf->bytes;
}
}
}
@ -1526,7 +1529,7 @@ static ProcRecord drawable_thumbnail_proc =
{
"gimp_drawable_thumbnail",
"Get a thumbnail of a drawable.",
"This function gets data from which a thumbnail of a drawable preview can be created. Maximum x or y dimension is 128 pixels. The pixels are returned in the RGB[A] format. The bpp return value gives the number of bytes in the image. The alpha channel also returned if the drawable has one.",
"This function gets data from which a thumbnail of a drawable preview can be created. Maximum x or y dimension is 128 pixels. The pixels are returned in the RGB[A] format. The bpp return value gives the number of bytes in the image. The alpha channel is also returned if the drawable has one.",
"Andy Thomas",
"Andy Thomas",
"1999",

View File

@ -2618,24 +2618,27 @@ image_thumbnail_invoker (Gimp *gimp,
if (req_width <= 128 && req_height <= 128)
{
/* Adjust the width/height ratio */
dwidth = gimage->width;
dwidth = gimage->width;
dheight = gimage->height;
if (dwidth > dheight)
req_height = (req_width * dheight) / dwidth;
req_height = MAX (1, (req_width * dheight) / dwidth);
else
req_width = (req_height * dwidth) / dheight;
req_width = MAX (1, (req_height * dwidth) / dheight);
buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (gimage),
req_width,
req_height);
num_bytes = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_bytes);
g_memmove (thumbnail_data, temp_buf_data (buf), num_bytes);
width = buf->width;
height = buf->height;
bpp = buf->bytes;
temp_buf_free (buf);
req_width, req_height);
if (buf)
{
num_bytes = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_bytes);
g_memmove (thumbnail_data, temp_buf_data (buf), num_bytes);
width = buf->width;
height = buf->height;
bpp = buf->bytes;
temp_buf_free (buf);
}
}
}

View File

@ -660,8 +660,8 @@ gimp_drawable_is_channel (gint32 drawable_ID)
* This function gets data from which a thumbnail of a drawable preview
* can be created. Maximum x or y dimension is 128 pixels. The pixels
* are returned in the RGB[A] format. The bpp return value gives the
* number of bytes in the image. The alpha channel also returned if the
* drawable has one.
* number of bytes in the image. The alpha channel is also returned if
* the drawable has one.
*
* Returns: TRUE on success.
*/

View File

@ -456,7 +456,7 @@ sub drawable_thumbnail {
This function gets data from which a thumbnail of a drawable preview can be
created. Maximum x or y dimension is 128 pixels. The pixels are returned
in the RGB[A] format. The bpp return value gives the number of bytes in
the image. The alpha channel also returned if the drawable has one.
the image. The alpha channel is also returned if the drawable has one.
HELP
$author = $copyright = 'Andy Thomas';
@ -496,19 +496,22 @@ HELP
dheight = gimp_drawable_height (GIMP_DRAWABLE (drawable));
if (dwidth > dheight)
req_height = (req_width * dheight) / dwidth;
req_height = MAX (1, (req_width * dheight) / dwidth);
else
req_width = (req_height * dwidth) / dheight;
req_width = MAX (1, (req_height * dwidth) / dheight);
buf = gimp_viewable_get_preview (GIMP_VIEWABLE (drawable),
req_width, req_height);
num_pixels = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_pixels);
g_memmove (thumbnail_data, temp_buf_data (buf), num_pixels);
width = buf->width;
height = buf->height;
bpp = buf->bytes;
if (buf)
{
num_pixels = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_pixels);
g_memmove (thumbnail_data, temp_buf_data (buf), num_pixels);
width = buf->width;
height = buf->height;
bpp = buf->bytes;
}
}
}
CODE

View File

@ -1427,24 +1427,27 @@ HELP
if (req_width <= 128 && req_height <= 128)
{
/* Adjust the width/height ratio */
dwidth = gimage->width;
dwidth = gimage->width;
dheight = gimage->height;
if (dwidth > dheight)
req_height = (req_width * dheight) / dwidth;
req_height = MAX (1, (req_width * dheight) / dwidth);
else
req_width = (req_height * dwidth) / dheight;
req_width = MAX (1, (req_height * dwidth) / dheight);
buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (gimage),
req_width,
req_height);
num_bytes = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_bytes);
g_memmove (thumbnail_data, temp_buf_data (buf), num_bytes);
width = buf->width;
height = buf->height;
bpp = buf->bytes;
temp_buf_free (buf);
req_width, req_height);
if (buf)
{
num_bytes = buf->height * buf->width * buf->bytes;
thumbnail_data = g_new (guint8, num_bytes);
g_memmove (thumbnail_data, temp_buf_data (buf), num_bytes);
width = buf->width;
height = buf->height;
bpp = buf->bytes;
temp_buf_free (buf);
}
}
}
CODE