Commit a384cca5 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

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
parent a6962b53
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>
* app/tools/gimppolygonselecttool.c: rename member num_points to
......
......@@ -324,8 +324,7 @@ gimp_display_shell_draw_pen (GimpDisplayShell *shell,
coords = g_new (GdkPoint, MAX (2, num_points));
gimp_display_shell_transform_points (shell,
(const gdouble *) points, coords,
num_points, FALSE);
points, coords, num_points, FALSE);
if (num_points == 1)
{
......
......@@ -276,7 +276,7 @@ gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
/**
* gimp_display_shell_transform_points:
* @shell: a #GimpDisplayShell
* @points: array of x, y coordinate pairs
* @points: array of GimpVectors2 coordinate pairs
* @coords: returns the corresponding display coordinates
* @n_points: number of points
* @use_offsets: if %TRUE, the source coordinates are in the coordinate
......@@ -286,11 +286,11 @@ gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
* objects can be rendered at the correct points on the display.
**/
void
gimp_display_shell_transform_points (GimpDisplayShell *shell,
const gdouble *points,
GdkPoint *coords,
gint n_points,
gboolean use_offsets)
gimp_display_shell_transform_points (GimpDisplayShell *shell,
const GimpVector2 *points,
GdkPoint *coords,
gint n_points,
gboolean use_offsets)
{
gint offset_x = 0;
gint offset_y = 0;
......@@ -308,8 +308,8 @@ gimp_display_shell_transform_points (GimpDisplayShell *shell,
for (i = 0; i < n_points ; i++)
{
gdouble x = points[i*2] + offset_x;
gdouble y = points[i*2+1] + offset_y;
gdouble x = points[i].x + offset_x;
gdouble y = points[i].y + offset_y;
x = x * shell->x_src_dec / shell->x_dest_inc;
y = y * shell->y_src_dec / shell->y_dest_inc;
......
......@@ -27,54 +27,54 @@ void gimp_display_shell_untransform_coordinate (GimpDisplayShell *shell,
GimpCoords *display_coords,
GimpCoords *image_coords);
void gimp_display_shell_transform_xy (GimpDisplayShell *shell,
gdouble x,
gdouble y,
gint *nx,
gint *ny,
gboolean use_offsets);
void gimp_display_shell_untransform_xy (GimpDisplayShell *shell,
gint x,
gint y,
gint *nx,
gint *ny,
gboolean round,
gboolean use_offsets);
void gimp_display_shell_transform_xy (GimpDisplayShell *shell,
gdouble x,
gdouble y,
gint *nx,
gint *ny,
gboolean use_offsets);
void gimp_display_shell_untransform_xy (GimpDisplayShell *shell,
gint x,
gint y,
gint *nx,
gint *ny,
gboolean round,
gboolean use_offsets);
void gimp_display_shell_transform_xy_f (GimpDisplayShell *shell,
gdouble x,
gdouble y,
gdouble *nx,
gdouble *ny,
gboolean use_offsets);
void gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
gdouble x,
gdouble y,
gdouble *nx,
gdouble *ny,
gboolean use_offsets);
void gimp_display_shell_transform_xy_f (GimpDisplayShell *shell,
gdouble x,
gdouble y,
gdouble *nx,
gdouble *ny,
gboolean use_offsets);
void gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
gdouble x,
gdouble y,
gdouble *nx,
gdouble *ny,
gboolean use_offsets);
void gimp_display_shell_transform_points (GimpDisplayShell *shell,
const gdouble *points,
GdkPoint *coords,
gint n_points,
gboolean use_offsets);
void gimp_display_shell_transform_coords (GimpDisplayShell *shell,
const GimpCoords *image_coords,
GdkPoint *disp_coords,
gint n_coords,
gboolean use_offsets);
void gimp_display_shell_transform_segments (GimpDisplayShell *shell,
const BoundSeg *src_segs,
GdkSegment *dest_segs,
gint n_segs,
gboolean use_offsets);
void gimp_display_shell_transform_points (GimpDisplayShell *shell,
const GimpVector2 *points,
GdkPoint *coords,
gint n_points,
gboolean use_offsets);
void gimp_display_shell_transform_coords (GimpDisplayShell *shell,
const GimpCoords *image_coords,
GdkPoint *disp_coords,
gint n_coords,
gboolean use_offsets);
void gimp_display_shell_transform_segments (GimpDisplayShell *shell,
const BoundSeg *src_segs,
GdkSegment *dest_segs,
gint n_segs,
gboolean use_offsets);
void gimp_display_shell_untransform_viewport (GimpDisplayShell *shell,
gint *x,
gint *y,
gint *width,
gint *height);
void gimp_display_shell_untransform_viewport (GimpDisplayShell *shell,
gint *x,
gint *y,
gint *width,
gint *height);
#endif /* __GIMP_DISPLAY_SHELL_TRANSFORM_H__ */
......@@ -1592,18 +1592,18 @@ gimp_draw_tool_on_vectors (GimpDrawTool *draw_tool,
}
void
gimp_draw_tool_draw_lines (GimpDrawTool *draw_tool,
const gdouble *points,
gint n_points,
gboolean filled,
gboolean use_offsets)
gimp_draw_tool_draw_lines (GimpDrawTool *draw_tool,
const GimpVector2 *points,
gint n_points,
gboolean filled,
gboolean use_offsets)
{
GimpDisplayShell *shell;
GdkPoint *coords;
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
if (n_points == 0)
if (points == NULL || n_points == 0)
return;
shell = GIMP_DISPLAY_SHELL (draw_tool->display->shell);
......
......@@ -226,7 +226,7 @@ gboolean gimp_draw_tool_on_vectors (GimpDrawTool *draw_tool,
GimpVectors **ret_vectors);
void gimp_draw_tool_draw_lines (GimpDrawTool *draw_tool,
const gdouble *points,
const GimpVector2 *points,
gint n_points,
gboolean filled,
gboolean use_offsets);
......
......@@ -281,8 +281,7 @@ gimp_free_select_tool_draw (GimpDrawTool *draw_tool)
GimpFreeSelectTool *free_sel = GIMP_FREE_SELECT_TOOL (draw_tool);
gimp_draw_tool_draw_lines (draw_tool,
(const gdouble *) free_sel->points,
free_sel->num_points,
free_sel->points, free_sel->num_points,
FALSE, FALSE);
}
......
......@@ -882,23 +882,23 @@ static void
iscissors_draw_curve (GimpDrawTool *draw_tool,
ICurve *curve)
{
gdouble *points;
gpointer *point;
gint i, len;
GimpVector2 *points;
gpointer *point;
gint i, len;
if (! curve->points)
return;
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++)
{
guint32 coords = GPOINTER_TO_INT (*point);
points[i * 2] = (coords & 0x0000ffff);
points[i * 2 + 1] = (coords >> 16);
points[i].x = (coords & 0x0000ffff);
points[i].y = (coords >> 16);
}
gimp_draw_tool_draw_lines (draw_tool, points, len, FALSE, FALSE);
......
......@@ -486,8 +486,7 @@ gimp_polygon_select_tool_draw (GimpDrawTool *draw_tool)
GimpPolygonSelectTool *poly_sel_tool = GIMP_POLYGON_SELECT_TOOL (draw_tool);
gimp_draw_tool_draw_lines (draw_tool,
(const gdouble *) poly_sel_tool->points,
poly_sel_tool->n_points,
poly_sel_tool->points, poly_sel_tool->n_points,
FALSE, FALSE);
if (poly_sel_tool->show_pending_point)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment