app: remove the "auto_center" params from gimpdrawable-transform.[ch]

Instead, add utility functions that calculate the centers for rotate
and flip and use them where we used to pass "auto_center". This looks
pretty much poinless, but a commit will follow that makes it look
better...
This commit is contained in:
Michael Natterer
2010-09-07 23:43:18 +02:00
parent 095ae5cc9b
commit 8b38bde642
8 changed files with 98 additions and 49 deletions

View File

@ -26,6 +26,55 @@
#include "gimp-transform-utils.h"
void
gimp_transform_get_rotate_center (gint x,
gint y,
gint width,
gint height,
gboolean auto_center,
gdouble *center_x,
gdouble *center_y)
{
g_return_if_fail (center_x != NULL);
g_return_if_fail (center_y != NULL);
if (auto_center)
{
*center_x = (gdouble) x + (gdouble) width / 2.0;
*center_y = (gdouble) y + (gdouble) height / 2.0;
}
}
void
gimp_transform_get_flip_axis (gint x,
gint y,
gint width,
gint height,
GimpOrientationType flip_type,
gboolean auto_center,
gdouble *axis)
{
g_return_if_fail (axis != NULL);
if (auto_center)
{
switch (flip_type)
{
case GIMP_ORIENTATION_HORIZONTAL:
*axis = ((gdouble) x + (gdouble) width / 2.0);
break;
case GIMP_ORIENTATION_VERTICAL:
*axis = ((gdouble) y + (gdouble) height / 2.0);
break;
default:
g_return_if_reached ();
break;
}
}
}
void
gimp_transform_matrix_flip (GimpMatrix3 *matrix,
GimpOrientationType flip_type,