gimp r24979 - in trunk: . app/display app/tools



Author: mitch
Date: Tue Feb 26 17:30:33 2008
New Revision: 24979
URL: http://svn.gnome.org/viewvc/gimp?rev=24979&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/app/display/gimpdisplayshell-draw.c
   trunk/app/display/gimpdisplayshell-transform.c
   trunk/app/display/gimpdisplayshell-transform.h
   trunk/app/tools/gimpdrawtool.c
   trunk/app/tools/gimpdrawtool.h
   trunk/app/tools/gimpfreeselecttool.c
   trunk/app/tools/gimpiscissorstool.c
   trunk/app/tools/gimppolygonselecttool.c

Modified: trunk/app/display/gimpdisplayshell-draw.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-draw.c	(original)
+++ trunk/app/display/gimpdisplayshell-draw.c	Tue Feb 26 17:30:33 2008
@@ -324,8 +324,7 @@
   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)
     {

Modified: trunk/app/display/gimpdisplayshell-transform.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-transform.c	(original)
+++ trunk/app/display/gimpdisplayshell-transform.c	Tue Feb 26 17:30:33 2008
@@ -276,7 +276,7 @@
 /**
  * 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 @@
  * 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 @@
 
   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;

Modified: trunk/app/display/gimpdisplayshell-transform.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-transform.h	(original)
+++ trunk/app/display/gimpdisplayshell-transform.h	Tue Feb 26 17:30:33 2008
@@ -27,54 +27,54 @@
                                                  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_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_untransform_viewport (GimpDisplayShell *shell,
-                                               gint             *x,
-                                               gint             *y,
-                                               gint             *width,
-                                               gint             *height);
+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_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);
 
 
 #endif /* __GIMP_DISPLAY_SHELL_TRANSFORM_H__ */

Modified: trunk/app/tools/gimpdrawtool.c
==============================================================================
--- trunk/app/tools/gimpdrawtool.c	(original)
+++ trunk/app/tools/gimpdrawtool.c	Tue Feb 26 17:30:33 2008
@@ -1592,18 +1592,18 @@
 }
 
 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);

Modified: trunk/app/tools/gimpdrawtool.h
==============================================================================
--- trunk/app/tools/gimpdrawtool.h	(original)
+++ trunk/app/tools/gimpdrawtool.h	Tue Feb 26 17:30:33 2008
@@ -226,7 +226,7 @@
                                                     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);

Modified: trunk/app/tools/gimpfreeselecttool.c
==============================================================================
--- trunk/app/tools/gimpfreeselecttool.c	(original)
+++ trunk/app/tools/gimpfreeselecttool.c	Tue Feb 26 17:30:33 2008
@@ -281,8 +281,7 @@
   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);
 }
 

Modified: trunk/app/tools/gimpiscissorstool.c
==============================================================================
--- trunk/app/tools/gimpiscissorstool.c	(original)
+++ trunk/app/tools/gimpiscissorstool.c	Tue Feb 26 17:30:33 2008
@@ -882,23 +882,23 @@
 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);

Modified: trunk/app/tools/gimppolygonselecttool.c
==============================================================================
--- trunk/app/tools/gimppolygonselecttool.c	(original)
+++ trunk/app/tools/gimppolygonselecttool.c	Tue Feb 26 17:30:33 2008
@@ -486,8 +486,7 @@
   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)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]