check that the resulting area has positive width and height.

2008-11-14  Sven Neumann  <sven@gimp.org>

	* app/display/gimpdisplayshell-preview.c
	(gimp_display_shell_draw_quad): check that the resulting area 
has
	positive width and height.


svn path=/trunk/; revision=27642
This commit is contained in:
Sven Neumann 2008-11-13 23:12:56 +00:00 committed by Sven Neumann
parent efb5c20ef8
commit 987824b301
2 changed files with 30 additions and 19 deletions

View File

@ -1,3 +1,9 @@
2008-11-14 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell-preview.c
(gimp_display_shell_draw_quad): check that the resulting area has
positive width and height.
2008-11-13 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpcursorview.[ch]: Move the instance struct to the

View File

@ -350,14 +350,13 @@ gimp_display_shell_draw_quad (GimpDrawable *texture,
gfloat *v,
guchar opacity)
{
gint x2[3], y2[3];
gfloat u2[3], v2[3];
gint minx, maxx, miny, maxy; /* screen bounds of the quad */
gint dwidth, dheight; /* dimensions of dest */
GdkPixbuf *area; /* quad sized area with dest pixels */
gint c;
gint x2[3], y2[3];
gfloat u2[3], v2[3];
gint minx, maxx, miny, maxy; /* screen bounds of the quad */
gint dwidth, dheight; /* dimensions of dest */
gint c;
g_return_if_fail(GDK_IS_DRAWABLE (dest));
g_return_if_fail (GDK_IS_DRAWABLE (dest));
x2[0] = x[3]; y2[0] = y[3]; u2[0] = u[3]; v2[0] = v[3];
x2[1] = x[2]; y2[1] = y[2]; u2[1] = u[2]; v2[1] = v[2];
@ -383,21 +382,27 @@ gimp_display_shell_draw_quad (GimpDrawable *texture,
}
if (minx < 0) minx = 0;
if (miny < 0) miny = 0;
if (maxx > dwidth - 1) maxx=dwidth - 1;
if (maxy > dheight - 1) maxy=dheight - 1;
if (maxx > dwidth - 1) maxx = dwidth - 1;
if (maxy > dheight - 1) maxy = dheight - 1;
area = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
maxx - minx + 1, maxy - miny + 1);
g_return_if_fail (area != NULL);
if (minx <= maxx && miny <= maxy)
{
GdkPixbuf *area;
gimp_display_shell_draw_tri (texture, dest, area, minx, miny,
mask, mask_offx, mask_offy,
x, y, u, v, opacity);
gimp_display_shell_draw_tri (texture, dest, area, minx, miny,
mask, mask_offx, mask_offy,
x2, y2, u2, v2, opacity);
area = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
maxx - minx + 1, maxy - miny + 1);
g_object_unref (area);
g_return_if_fail (area != NULL);
gimp_display_shell_draw_tri (texture, dest, area, minx, miny,
mask, mask_offx, mask_offy,
x, y, u, v, opacity);
gimp_display_shell_draw_tri (texture, dest, area, minx, miny,
mask, mask_offx, mask_offy,
x2, y2, u2, v2, opacity);
g_object_unref (area);
}
}
/**