Commit 2498c665 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

Completed the fix for bug #136702:

2004-03-13  Michael Natterer  <mitch@gimp.org>

	Completed the fix for bug #136702:

	* app/core/gimpitem.[ch]: added "gboolean supersample" and
	"gint recursion_level" to GimpItem::transform().

	* app/core/gimpitem-linked.[ch]	(gimp_item_linked_transform): ditto.

	* app/core/gimpdrawable-transform.[ch]: added "recursion_level"
	parameters and removed the RECURSION_LEVEL #define.

	* app/core/gimpchannel.c
	* app/core/gimpdrawable.c
	* app/core/gimplayer.c
	* app/vectors/gimpvectors.c: changed accordingly.

	* app/tools/gimptransformoptions.[ch]: added new property
	"recursion_level" which is not serializable and has no GUI. Pretty
	useless, but it's IMHO better to hardcode the default value here
	than in gimpdrawable-transform.c

	* app/tools/gimptransformtool.c: changed accordingly.

	* tools/pdbgen/pdb/transform_tools.pdb: hardcode "recursion_level"
	to 3.

	* app/pdb/transform_tools_cmds.c: regenerated.
parent b3cc1578
2004-03-13 Michael Natterer <mitch@gimp.org>
Completed the fix for bug #136702:
* app/core/gimpitem.[ch]: added "gboolean supersample" and
"gint recursion_level" to GimpItem::transform().
* app/core/gimpitem-linked.[ch] (gimp_item_linked_transform): ditto.
* app/core/gimpdrawable-transform.[ch]: added "recursion_level"
parameters and removed the RECURSION_LEVEL #define.
* app/core/gimpchannel.c
* app/core/gimpdrawable.c
* app/core/gimplayer.c
* app/vectors/gimpvectors.c: changed accordingly.
* app/tools/gimptransformoptions.[ch]: added new property
"recursion_level" which is not serializable and has no GUI. Pretty
useless, but it's IMHO better to hardcode the default value here
than in gimpdrawable-transform.c
* app/tools/gimptransformtool.c: changed accordingly.
* tools/pdbgen/pdb/transform_tools.pdb: hardcode "recursion_level"
to 3.
* app/pdb/transform_tools_cmds.c: regenerated.
2004-03-13 Simon Budig <simon@gimp.org>
 
* app/widgets/widgets-enums.h
......@@ -53,11 +53,6 @@
#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d))
/* recursion level should be a usersettable parameter,
3 seems to be a reasonable default */
#define RECURSION_LEVEL 3
/* forward function prototypes */
static gboolean supersample_dtest (gdouble u0, gdouble v0,
......@@ -65,34 +60,31 @@ static gboolean supersample_dtest (gdouble u0, gdouble v0,
gdouble u2, gdouble v2,
gdouble u3, gdouble v3);
static void sample_adapt (TileManager *tm,
gdouble uc, gdouble vc,
gdouble u0, gdouble v0,
gdouble u1, gdouble v1,
gdouble u2, gdouble v2,
gdouble u3, gdouble v3,
gint level,
guchar *color,
guchar *bg_color,
gint bpp,
gint alpha);
static void
sample_cubic (PixelSurround *surround,
gdouble u,
gdouble v,
guchar *color,
gint bytes,
gint alpha);
static void
sample_linear(PixelSurround *surround,
gdouble u,
gdouble v,
guchar *color,
gint bytes,
gint alpha);
static void sample_adapt (TileManager *tm,
gdouble uc, gdouble vc,
gdouble u0, gdouble v0,
gdouble u1, gdouble v1,
gdouble u2, gdouble v2,
gdouble u3, gdouble v3,
gint level,
guchar *color,
guchar *bg_color,
gint bpp,
gint alpha);
static void sample_cubic (PixelSurround *surround,
gdouble u,
gdouble v,
guchar *color,
gint bytes,
gint alpha);
static void sample_linear (PixelSurround *surround,
gdouble u,
gdouble v,
guchar *color,
gint bytes,
gint alpha);
/* public functions */
......@@ -104,6 +96,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
......@@ -111,8 +104,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
GimpImage *gimage;
PixelRegion destPR;
TileManager *new_tiles;
GimpMatrix3 m = *matrix;
GimpMatrix3 inv = *matrix;
GimpMatrix3 m;
GimpMatrix3 inv;
PixelSurround surround;
gint x1, y1, x2, y2; /* target bounding box */
......@@ -147,6 +140,9 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
m = *matrix;
inv = *matrix;
alpha = 0;
/* turn interpolation off for simple transformations (e.g. rot90) */
......@@ -383,7 +379,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
u[2]-u1, v[2]-v1,
u[3]-u1, v[3]-v1,
u[4]-u1, v[4]-v1,
RECURSION_LEVEL,
recursion_level,
color, bg_color, bytes, alpha);
}
else
......@@ -808,6 +804,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result)
{
GimpImage *gimage;
......@@ -843,6 +840,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
GIMP_TRANSFORM_FORWARD,
interpolation_type,
supersample,
recursion_level,
FALSE,
NULL, NULL);
......
......@@ -98,6 +98,8 @@ static void gimp_channel_transform (GimpItem *item,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
......@@ -589,6 +591,8 @@ gimp_channel_transform (GimpItem *item,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
......@@ -606,7 +610,9 @@ gimp_channel_transform (GimpItem *item,
clip_result = TRUE;
GIMP_ITEM_CLASS (parent_class)->transform (item, matrix, direction,
interpolation_type, clip_result,
interpolation_type,
supersample, recursion_level,
clip_result,
progress_callback, progress_data);
gimp_image_undo_group_end (gimage);
......
......@@ -53,11 +53,6 @@
#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d))
/* recursion level should be a usersettable parameter,
3 seems to be a reasonable default */
#define RECURSION_LEVEL 3
/* forward function prototypes */
static gboolean supersample_dtest (gdouble u0, gdouble v0,
......@@ -65,34 +60,31 @@ static gboolean supersample_dtest (gdouble u0, gdouble v0,
gdouble u2, gdouble v2,
gdouble u3, gdouble v3);
static void sample_adapt (TileManager *tm,
gdouble uc, gdouble vc,
gdouble u0, gdouble v0,
gdouble u1, gdouble v1,
gdouble u2, gdouble v2,
gdouble u3, gdouble v3,
gint level,
guchar *color,
guchar *bg_color,
gint bpp,
gint alpha);
static void
sample_cubic (PixelSurround *surround,
gdouble u,
gdouble v,
guchar *color,
gint bytes,
gint alpha);
static void
sample_linear(PixelSurround *surround,
gdouble u,
gdouble v,
guchar *color,
gint bytes,
gint alpha);
static void sample_adapt (TileManager *tm,
gdouble uc, gdouble vc,
gdouble u0, gdouble v0,
gdouble u1, gdouble v1,
gdouble u2, gdouble v2,
gdouble u3, gdouble v3,
gint level,
guchar *color,
guchar *bg_color,
gint bpp,
gint alpha);
static void sample_cubic (PixelSurround *surround,
gdouble u,
gdouble v,
guchar *color,
gint bytes,
gint alpha);
static void sample_linear (PixelSurround *surround,
gdouble u,
gdouble v,
guchar *color,
gint bytes,
gint alpha);
/* public functions */
......@@ -104,6 +96,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
......@@ -111,8 +104,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
GimpImage *gimage;
PixelRegion destPR;
TileManager *new_tiles;
GimpMatrix3 m = *matrix;
GimpMatrix3 inv = *matrix;
GimpMatrix3 m;
GimpMatrix3 inv;
PixelSurround surround;
gint x1, y1, x2, y2; /* target bounding box */
......@@ -147,6 +140,9 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
m = *matrix;
inv = *matrix;
alpha = 0;
/* turn interpolation off for simple transformations (e.g. rot90) */
......@@ -383,7 +379,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
u[2]-u1, v[2]-v1,
u[3]-u1, v[3]-v1,
u[4]-u1, v[4]-v1,
RECURSION_LEVEL,
recursion_level,
color, bg_color, bytes, alpha);
}
else
......@@ -808,6 +804,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result)
{
GimpImage *gimage;
......@@ -843,6 +840,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
GIMP_TRANSFORM_FORWARD,
interpolation_type,
supersample,
recursion_level,
FALSE,
NULL, NULL);
......
......@@ -39,6 +39,7 @@ TileManager * gimp_drawable_transform_tiles_affine (GimpDrawable *draw
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
......@@ -59,6 +60,7 @@ gboolean gimp_drawable_transform_affine (GimpDrawable *draw
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result);
gboolean gimp_drawable_transform_flip (GimpDrawable *drawable,
GimpOrientationType flip_type);
......
......@@ -97,6 +97,7 @@ static void gimp_drawable_transform (GimpItem *item,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
......@@ -536,6 +537,7 @@ gimp_drawable_transform (GimpItem *item,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
......@@ -556,7 +558,7 @@ gimp_drawable_transform (GimpItem *item,
drawable->tiles,
matrix, direction,
interpolation_type,
supersample,
supersample, recursion_level,
clip_result,
progress_callback,
progress_data);
......
......@@ -125,6 +125,8 @@ gimp_item_linked_transform (GimpItem *item,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
......@@ -145,7 +147,9 @@ gimp_item_linked_transform (GimpItem *item,
for (list = linked_list; list; list = g_list_next (list))
gimp_item_transform (GIMP_ITEM (list->data),
matrix, direction,
interpolation_type, clip_result,
interpolation_type,
supersample, recursion_level,
clip_result,
progress_callback, progress_data);
g_list_free (linked_list);
......
......@@ -49,6 +49,8 @@ void gimp_item_linked_transform (GimpItem *item,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
......
......@@ -803,6 +803,8 @@ gimp_item_transform (GimpItem *item,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
......@@ -814,6 +816,7 @@ gimp_item_transform (GimpItem *item,
item_class = GIMP_ITEM_GET_CLASS (item);
item_class->transform (item, matrix, direction, interpolation,
supersample, recursion_level,
clip_result,
progress_callback, progress_data);
}
......
......@@ -104,6 +104,8 @@ struct _GimpItemClass
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
......@@ -199,6 +201,8 @@ void gimp_item_transform (GimpItem *item,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
......
......@@ -113,6 +113,8 @@ static void gimp_layer_transform (GimpItem *item,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
......@@ -761,6 +763,8 @@ gimp_layer_transform (GimpItem *item,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
......@@ -774,14 +778,18 @@ gimp_layer_transform (GimpItem *item,
_("Transform Layer"));
GIMP_ITEM_CLASS (parent_class)->transform (item, matrix, direction,
interpolation_type, clip_result,
interpolation_type,
supersample, recursion_level,
clip_result,
progress_callback, progress_data);
/* If there is a layer mask, make sure it gets flipped also */
if (layer->mask)
gimp_item_transform (GIMP_ITEM (layer->mask),
matrix, direction,
interpolation_type, clip_result,
interpolation_type,
supersample, recursion_level,
clip_result,
progress_callback, progress_data);
gimp_image_undo_group_end (gimage);
......
......@@ -187,7 +187,7 @@ perspective_invoker (Gimp *gimp,
/* Perspective the selection */
success = gimp_drawable_transform_affine (drawable,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, TRUE,
interpolation_type, TRUE, 3,
FALSE);
}
}
......@@ -321,7 +321,7 @@ rotate_invoker (Gimp *gimp,
/* Rotate the selection */
success = gimp_drawable_transform_affine (drawable,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, FALSE,
interpolation_type, FALSE, 3,
FALSE);
}
}
......@@ -430,7 +430,7 @@ scale_invoker (Gimp *gimp,
/* Scale the selection */
success = gimp_drawable_transform_affine (drawable,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, TRUE,
interpolation_type, TRUE, 3,
FALSE);
}
}
......@@ -550,7 +550,7 @@ shear_invoker (Gimp *gimp,
/* Shear the selection */
success = gimp_drawable_transform_affine (drawable,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, FALSE,
interpolation_type, FALSE, 3,
FALSE);
}
}
......@@ -672,7 +672,7 @@ transform_2d_invoker (Gimp *gimp,
/* Transform the selection */
success = gimp_drawable_transform_affine (drawable,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, TRUE,
interpolation_type, TRUE, 3,
FALSE);
}
}
......
......@@ -49,6 +49,7 @@ enum
PROP_DIRECTION,
PROP_INTERPOLATION,
PROP_SUPERSAMPLE,
PROP_RECURSION_LEVEL,
PROP_CLIP,
PROP_GRID_TYPE,
PROP_GRID_SIZE,
......@@ -142,6 +143,21 @@ gimp_transform_options_class_init (GimpTransformOptionsClass *klass)
"supersample", NULL,
FALSE,
0);
#if 0
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_RECURSION_LEVEL,
"recursion-level", NULL,
1, 5, 3,
0);
#endif
g_object_class_install_property (object_class, PROP_RECURSION_LEVEL,
g_param_spec_int ("recursion-level",
NULL, NULL,
1, 5, 3,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_CLIP,
"clip", NULL,
FALSE,
......@@ -194,6 +210,9 @@ gimp_transform_options_set_property (GObject *object,
case PROP_SUPERSAMPLE:
options->supersample = g_value_get_boolean (value);
break;
case PROP_RECURSION_LEVEL:
options->recursion_level = g_value_get_int (value);
break;
case PROP_CLIP:
options->clip = g_value_get_boolean (value);
break;
......@@ -239,6 +258,9 @@ gimp_transform_options_get_property (GObject *object,
case PROP_SUPERSAMPLE:
g_value_set_boolean (value, options->supersample);
break;
case PROP_RECURSION_LEVEL:
g_value_set_int (value, options->recursion_level);
break;
case PROP_CLIP:
g_value_set_boolean (value, options->clip);
break;
......
......@@ -42,6 +42,7 @@ struct _GimpTransformOptions
GimpTransformDirection direction;
GimpInterpolationType interpolation;
gboolean supersample;
gint recursion_level;
gboolean clip;
GimpTransformGridType grid_type;
gint grid_size;
......
......@@ -823,6 +823,8 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
&tr_tool->transform,
options->direction,
options->interpolation,
options->supersample,
options->recursion_level,
options->clip,
progress ?
gimp_progress_update_and_flush : NULL,
......@@ -849,6 +851,7 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
options->direction,
options->interpolation,
options->supersample,
options->recursion_level,
clip_result,
progress ?
gimp_progress_update_and_flush :
......@@ -862,6 +865,8 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
&tr_tool->transform,
options->direction,
options->interpolation,
options->supersample,
options->recursion_level,
options->clip,
progress ?
gimp_progress_update_and_flush :
......
......@@ -103,6 +103,8 @@ static void gimp_vectors_transform (GimpItem *item,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interp_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
......@@ -513,6 +515,8 @@ gimp_vectors_transform (GimpItem *item,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean supersample,
gint recursion_level,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
......
......@@ -152,7 +152,7 @@ HELP
/* Perspective the selection */
success = gimp_drawable_transform_affine (drawable,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, TRUE,
interpolation_type, TRUE, 3,
FALSE);
}
}
......@@ -212,7 +212,7 @@ HELP
/* Rotate the selection */
success = gimp_drawable_transform_affine (drawable,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, FALSE,
interpolation_type, FALSE, 3,
FALSE);
}
}
......@@ -286,7 +286,7 @@ HELP
/* Scale the selection */
success = gimp_drawable_transform_affine (drawable,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, TRUE,
interpolation_type, TRUE, 3,
FALSE);