app/display/gimpdisplayshell-transform.[ch]

2008-02-26  Michael Natterer  <mitch@gimp.org>

	* app/display/gimpdisplayshell-transform.[ch]
	(gimp_display_shell_transform_points)
	* app/tools/gimpdrawtool.[ch] (gimp_draw_tool_draw_lines): take
	arrays of GimpVector2 instead of arrays of gdouble to represent
	the input points.

	* app/display/gimpdisplayshell-draw.c
	* app/tools/gimppolygonselecttool.c
	* app/tools/gimpfreeselecttool.c: don't cast the GimpVector2 arrays
	to double arrays when passing them to above functions.

	* app/tools/gimpiscissorstool.c: create a temporary GimpVector2
	array instead of a temporary gdouble array.


svn path=/trunk/; revision=24979
This commit is contained in:
Michael Natterer
2008-02-26 17:30:33 +00:00
committed by Michael Natterer
parent a6962b5355
commit a384cca5f3
9 changed files with 85 additions and 72 deletions

View File

@ -1,3 +1,19 @@
2008-02-26 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-transform.[ch]
(gimp_display_shell_transform_points)
* app/tools/gimpdrawtool.[ch] (gimp_draw_tool_draw_lines): take
arrays of GimpVector2 instead of arrays of gdouble to represent
the input points.
* app/display/gimpdisplayshell-draw.c
* app/tools/gimppolygonselecttool.c
* app/tools/gimpfreeselecttool.c: don't cast the GimpVector2 arrays
to double arrays when passing them to above functions.
* app/tools/gimpiscissorstool.c: create a temporary GimpVector2
array instead of a temporary gdouble array.
2008-02-26 Michael Natterer <mitch@gimp.org> 2008-02-26 Michael Natterer <mitch@gimp.org>
* app/tools/gimppolygonselecttool.c: rename member num_points to * app/tools/gimppolygonselecttool.c: rename member num_points to

View File

@ -324,8 +324,7 @@ gimp_display_shell_draw_pen (GimpDisplayShell *shell,
coords = g_new (GdkPoint, MAX (2, num_points)); coords = g_new (GdkPoint, MAX (2, num_points));
gimp_display_shell_transform_points (shell, gimp_display_shell_transform_points (shell,
(const gdouble *) points, coords, points, coords, num_points, FALSE);
num_points, FALSE);
if (num_points == 1) if (num_points == 1)
{ {

View File

@ -276,7 +276,7 @@ gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
/** /**
* gimp_display_shell_transform_points: * gimp_display_shell_transform_points:
* @shell: a #GimpDisplayShell * @shell: a #GimpDisplayShell
* @points: array of x, y coordinate pairs * @points: array of GimpVectors2 coordinate pairs
* @coords: returns the corresponding display coordinates * @coords: returns the corresponding display coordinates
* @n_points: number of points * @n_points: number of points
* @use_offsets: if %TRUE, the source coordinates are in the coordinate * @use_offsets: if %TRUE, the source coordinates are in the coordinate
@ -287,7 +287,7 @@ gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
**/ **/
void void
gimp_display_shell_transform_points (GimpDisplayShell *shell, gimp_display_shell_transform_points (GimpDisplayShell *shell,
const gdouble *points, const GimpVector2 *points,
GdkPoint *coords, GdkPoint *coords,
gint n_points, gint n_points,
gboolean use_offsets) gboolean use_offsets)
@ -308,8 +308,8 @@ gimp_display_shell_transform_points (GimpDisplayShell *shell,
for (i = 0; i < n_points ; i++) for (i = 0; i < n_points ; i++)
{ {
gdouble x = points[i*2] + offset_x; gdouble x = points[i].x + offset_x;
gdouble y = points[i*2+1] + offset_y; gdouble y = points[i].y + offset_y;
x = x * shell->x_src_dec / shell->x_dest_inc; x = x * shell->x_src_dec / shell->x_dest_inc;
y = y * shell->y_src_dec / shell->y_dest_inc; y = y * shell->y_src_dec / shell->y_dest_inc;

View File

@ -55,7 +55,7 @@ void gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
gboolean use_offsets); gboolean use_offsets);
void gimp_display_shell_transform_points (GimpDisplayShell *shell, void gimp_display_shell_transform_points (GimpDisplayShell *shell,
const gdouble *points, const GimpVector2 *points,
GdkPoint *coords, GdkPoint *coords,
gint n_points, gint n_points,
gboolean use_offsets); gboolean use_offsets);

View File

@ -1593,7 +1593,7 @@ gimp_draw_tool_on_vectors (GimpDrawTool *draw_tool,
void void
gimp_draw_tool_draw_lines (GimpDrawTool *draw_tool, gimp_draw_tool_draw_lines (GimpDrawTool *draw_tool,
const gdouble *points, const GimpVector2 *points,
gint n_points, gint n_points,
gboolean filled, gboolean filled,
gboolean use_offsets) gboolean use_offsets)
@ -1603,7 +1603,7 @@ gimp_draw_tool_draw_lines (GimpDrawTool *draw_tool,
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool)); g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
if (n_points == 0) if (points == NULL || n_points == 0)
return; return;
shell = GIMP_DISPLAY_SHELL (draw_tool->display->shell); shell = GIMP_DISPLAY_SHELL (draw_tool->display->shell);

View File

@ -226,7 +226,7 @@ gboolean gimp_draw_tool_on_vectors (GimpDrawTool *draw_tool,
GimpVectors **ret_vectors); GimpVectors **ret_vectors);
void gimp_draw_tool_draw_lines (GimpDrawTool *draw_tool, void gimp_draw_tool_draw_lines (GimpDrawTool *draw_tool,
const gdouble *points, const GimpVector2 *points,
gint n_points, gint n_points,
gboolean filled, gboolean filled,
gboolean use_offsets); gboolean use_offsets);

View File

@ -281,8 +281,7 @@ gimp_free_select_tool_draw (GimpDrawTool *draw_tool)
GimpFreeSelectTool *free_sel = GIMP_FREE_SELECT_TOOL (draw_tool); GimpFreeSelectTool *free_sel = GIMP_FREE_SELECT_TOOL (draw_tool);
gimp_draw_tool_draw_lines (draw_tool, gimp_draw_tool_draw_lines (draw_tool,
(const gdouble *) free_sel->points, free_sel->points, free_sel->num_points,
free_sel->num_points,
FALSE, FALSE); FALSE, FALSE);
} }

View File

@ -882,7 +882,7 @@ static void
iscissors_draw_curve (GimpDrawTool *draw_tool, iscissors_draw_curve (GimpDrawTool *draw_tool,
ICurve *curve) ICurve *curve)
{ {
gdouble *points; GimpVector2 *points;
gpointer *point; gpointer *point;
gint i, len; gint i, len;
@ -891,14 +891,14 @@ iscissors_draw_curve (GimpDrawTool *draw_tool,
len = curve->points->len; len = curve->points->len;
points = g_new (gdouble, 2 * len); points = g_new (GimpVector2, len);
for (i = 0, point = curve->points->pdata; i < len; i++, point++) for (i = 0, point = curve->points->pdata; i < len; i++, point++)
{ {
guint32 coords = GPOINTER_TO_INT (*point); guint32 coords = GPOINTER_TO_INT (*point);
points[i * 2] = (coords & 0x0000ffff); points[i].x = (coords & 0x0000ffff);
points[i * 2 + 1] = (coords >> 16); points[i].y = (coords >> 16);
} }
gimp_draw_tool_draw_lines (draw_tool, points, len, FALSE, FALSE); gimp_draw_tool_draw_lines (draw_tool, points, len, FALSE, FALSE);

View File

@ -486,8 +486,7 @@ gimp_polygon_select_tool_draw (GimpDrawTool *draw_tool)
GimpPolygonSelectTool *poly_sel_tool = GIMP_POLYGON_SELECT_TOOL (draw_tool); GimpPolygonSelectTool *poly_sel_tool = GIMP_POLYGON_SELECT_TOOL (draw_tool);
gimp_draw_tool_draw_lines (draw_tool, gimp_draw_tool_draw_lines (draw_tool,
(const gdouble *) poly_sel_tool->points, poly_sel_tool->points, poly_sel_tool->n_points,
poly_sel_tool->n_points,
FALSE, FALSE); FALSE, FALSE);
if (poly_sel_tool->show_pending_point) if (poly_sel_tool->show_pending_point)