mirror of https://github.com/GNOME/gimp.git
limit the size of the preview to 512 pixels. This prevents plug-ins using
* libgimp/gimpaspectpreview.c: limit the size of the preview to 512 pixels. This prevents plug-ins using gimp_drawable_get_thumbnail_data to crash.
This commit is contained in:
parent
02f46efdcd
commit
c1ab97ec4b
|
@ -1,3 +1,9 @@
|
||||||
|
2004-10-03 DindinX <dindinx@gimp.org>
|
||||||
|
|
||||||
|
* libgimp/gimpaspectpreview.c: limit the size of the preview to 512
|
||||||
|
pixels. This prevents plug-ins using gimp_drawable_get_thumbnail_data
|
||||||
|
to crash.
|
||||||
|
|
||||||
2004-10-03 DindinX <dindinx@gimp.org>
|
2004-10-03 DindinX <dindinx@gimp.org>
|
||||||
|
|
||||||
* plug-ins/common/emboss.c: ported to GimpAspectPreview and made some
|
* plug-ins/common/emboss.c: ported to GimpAspectPreview and made some
|
||||||
|
|
|
@ -166,6 +166,7 @@ gimp_aspect_preview_new (GimpDrawable *drawable,
|
||||||
{
|
{
|
||||||
GimpAspectPreview *preview;
|
GimpAspectPreview *preview;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
gint max_width, max_height;
|
||||||
|
|
||||||
preview = g_object_new (GIMP_TYPE_ASPECT_PREVIEW, NULL);
|
preview = g_object_new (GIMP_TYPE_ASPECT_PREVIEW, NULL);
|
||||||
|
|
||||||
|
@ -173,7 +174,18 @@ gimp_aspect_preview_new (GimpDrawable *drawable,
|
||||||
width = gimp_drawable_width (drawable->drawable_id);
|
width = gimp_drawable_width (drawable->drawable_id);
|
||||||
height = gimp_drawable_height (drawable->drawable_id);
|
height = gimp_drawable_height (drawable->drawable_id);
|
||||||
|
|
||||||
gimp_preview_set_bounds (GIMP_PREVIEW (preview), 0, 0, width, height);
|
if (width > height)
|
||||||
|
{
|
||||||
|
max_width = MIN (width, 512);
|
||||||
|
max_height = (height * max_width) / width;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
max_height = MIN (height, 512);
|
||||||
|
max_width = (width * max_height) / height;
|
||||||
|
}
|
||||||
|
gimp_preview_set_bounds (GIMP_PREVIEW (preview),
|
||||||
|
0, 0, max_width, max_height);
|
||||||
|
|
||||||
g_object_set (GIMP_PREVIEW (preview)->frame,
|
g_object_set (GIMP_PREVIEW (preview)->frame,
|
||||||
"ratio", (gdouble) width / (gdouble) height,
|
"ratio", (gdouble) width / (gdouble) height,
|
||||||
|
|
Loading…
Reference in New Issue