check zero division in the right place. Fixes bug #348807.

2006-07-30  Karine Delvare  <edhel@gimp.org>

	* app/tools/gimprectangletool.c: check zero division in the right
	place. Fixes bug #348807.
This commit is contained in:
Karine Delvare 2006-07-30 19:38:50 +00:00 committed by Karine Delvare
parent 05fb296cf6
commit d16cfa55d7
2 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2006-07-30 Karine Delvare <edhel@gimp.org>
* app/tools/gimprectangletool.c: check zero division in the right
place. Fixes bug #348807.
2006-07-28 DindinX <dindinx@gimp.org>
* plug-ins/bmp/bmpwrite.c: small cleanups.

View File

@ -1203,7 +1203,7 @@ gimp_rectangle_tool_motion (GimpTool *tool,
switch (function)
{
case RECT_RESIZING_UPPER_LEFT:
if (inc_y == 0 || inc_x / inc_y < aspect)
if (inc_y != 0 && inc_x / inc_y < aspect)
x1 = rx2 - (ry2 - y1) * aspect + .5;
else
y1 = ry2 - (rx2 - x1) / aspect + .5;
@ -1211,7 +1211,7 @@ gimp_rectangle_tool_motion (GimpTool *tool,
case RECT_RESIZING_UPPER_RIGHT:
case RECT_RESIZING_TOP:
if (inc_y == 0 || inc_x / inc_y < aspect)
if (inc_y != 0 && inc_x / inc_y < aspect)
x2 = rx1 + (ry2 - y1) * aspect + .5;
else
y1 = ry2 - (x2 - rx1) / aspect + .5;
@ -1219,7 +1219,7 @@ gimp_rectangle_tool_motion (GimpTool *tool,
case RECT_RESIZING_LOWER_LEFT:
case RECT_RESIZING_LEFT:
if (inc_y == 0 || inc_x / inc_y < aspect)
if (inc_y != 0 && inc_x / inc_y < aspect)
x1 = rx2 - (y2 - ry1) * aspect + .5;
else
y2 = ry1 + (rx2 - x1) / aspect + .5;
@ -1228,7 +1228,7 @@ gimp_rectangle_tool_motion (GimpTool *tool,
case RECT_RESIZING_LOWER_RIGHT:
case RECT_RESIZING_RIGHT:
case RECT_RESIZING_BOTTOM:
if (inc_y == 0 || inc_x / inc_y < aspect)
if (inc_y != 0 && inc_x / inc_y < aspect)
x2 = rx1 + (y2 - ry1) * aspect + .5;
else
y2 = ry1 + (x2 - rx1) / aspect + .5;