Commit 0a123a81 authored by Ell's avatar Ell

Issue #2553 - Can't Move Imported or Pasted Path

Initialize the X/Y tilt fields of improted/pasted path control
points to 0, instead of 0.5, which is the normal value for these
fields in paths.  This avoids calculating bogus distances when
trying to pick the path, causing picking to fail.
parent ea2c9eef
...@@ -55,6 +55,19 @@ ...@@ -55,6 +55,19 @@
#include "gimp-intl.h" #include "gimp-intl.h"
#define COORDS_INIT \
{ \
.x = 0.0, \
.y = 0.0, \
.pressure = 1.0, \
.xtilt = 0.0, \
.ytilt = 0.0, \
.wheel = 0.5, \
.velocity = 0.0, \
.direction = 0.0 \
}
typedef struct typedef struct
{ {
GQueue *stack; GQueue *stack;
...@@ -743,7 +756,7 @@ svg_handler_rect_start (SvgHandler *handler, ...@@ -743,7 +756,7 @@ svg_handler_rect_start (SvgHandler *handler,
if (width > 0.0 && height > 0.0 && rx >= 0.0 && ry >= 0.0) if (width > 0.0 && height > 0.0 && rx >= 0.0 && ry >= 0.0)
{ {
GimpStroke *stroke; GimpStroke *stroke;
GimpCoords point = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords point = COORDS_INIT;
if (rx == 0.0) if (rx == 0.0)
rx = ry; rx = ry;
...@@ -759,7 +772,7 @@ svg_handler_rect_start (SvgHandler *handler, ...@@ -759,7 +772,7 @@ svg_handler_rect_start (SvgHandler *handler,
if (rx) if (rx)
{ {
GimpCoords end = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords end = COORDS_INIT;
end.x = x + width; end.x = x + width;
end.y = y + ry; end.y = y + ry;
...@@ -773,7 +786,7 @@ svg_handler_rect_start (SvgHandler *handler, ...@@ -773,7 +786,7 @@ svg_handler_rect_start (SvgHandler *handler,
if (rx) if (rx)
{ {
GimpCoords end = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords end = COORDS_INIT;
end.x = x + width - rx; end.x = x + width - rx;
end.y = y + height; end.y = y + height;
...@@ -787,7 +800,7 @@ svg_handler_rect_start (SvgHandler *handler, ...@@ -787,7 +800,7 @@ svg_handler_rect_start (SvgHandler *handler,
if (rx) if (rx)
{ {
GimpCoords end = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords end = COORDS_INIT;
end.x = x; end.x = x;
end.y = y + height - ry; end.y = y + height - ry;
...@@ -801,7 +814,7 @@ svg_handler_rect_start (SvgHandler *handler, ...@@ -801,7 +814,7 @@ svg_handler_rect_start (SvgHandler *handler,
if (rx) if (rx)
{ {
GimpCoords end = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords end = COORDS_INIT;
end.x = x + rx; end.x = x + rx;
end.y = y; end.y = y;
...@@ -825,7 +838,7 @@ svg_handler_ellipse_start (SvgHandler *handler, ...@@ -825,7 +838,7 @@ svg_handler_ellipse_start (SvgHandler *handler,
SvgParser *parser) SvgParser *parser)
{ {
SvgPath *path = g_slice_new0 (SvgPath); SvgPath *path = g_slice_new0 (SvgPath);
GimpCoords center = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords center = COORDS_INIT;
gdouble rx = 0.0; gdouble rx = 0.0;
gdouble ry = 0.0; gdouble ry = 0.0;
gdouble xres; gdouble xres;
...@@ -898,8 +911,8 @@ svg_handler_line_start (SvgHandler *handler, ...@@ -898,8 +911,8 @@ svg_handler_line_start (SvgHandler *handler,
SvgParser *parser) SvgParser *parser)
{ {
SvgPath *path = g_slice_new0 (SvgPath); SvgPath *path = g_slice_new0 (SvgPath);
GimpCoords start = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords start = COORDS_INIT;
GimpCoords end = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords end = COORDS_INIT;
GimpStroke *stroke; GimpStroke *stroke;
gdouble xres; gdouble xres;
gdouble yres; gdouble yres;
...@@ -1574,7 +1587,7 @@ static void ...@@ -1574,7 +1587,7 @@ static void
parse_path_do_cmd (ParsePathContext *ctx, parse_path_do_cmd (ParsePathContext *ctx,
gboolean final) gboolean final)
{ {
GimpCoords coords = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords coords = COORDS_INIT;
switch (ctx->cmd) switch (ctx->cmd)
{ {
...@@ -1618,8 +1631,8 @@ parse_path_do_cmd (ParsePathContext *ctx, ...@@ -1618,8 +1631,8 @@ parse_path_do_cmd (ParsePathContext *ctx,
/* curveto */ /* curveto */
if (ctx->param == 6 || final) if (ctx->param == 6 || final)
{ {
GimpCoords ctrl1 = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords ctrl1 = COORDS_INIT;
GimpCoords ctrl2 = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords ctrl2 = COORDS_INIT;
parse_path_default_xy (ctx, 6); parse_path_default_xy (ctx, 6);
...@@ -1640,8 +1653,8 @@ parse_path_do_cmd (ParsePathContext *ctx, ...@@ -1640,8 +1653,8 @@ parse_path_do_cmd (ParsePathContext *ctx,
/* smooth curveto */ /* smooth curveto */
if (ctx->param == 4 || final) if (ctx->param == 4 || final)
{ {
GimpCoords ctrl1 = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords ctrl1 = COORDS_INIT;
GimpCoords ctrl2 = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords ctrl2 = COORDS_INIT;
parse_path_default_xy (ctx, 4); parse_path_default_xy (ctx, 4);
...@@ -1688,7 +1701,7 @@ parse_path_do_cmd (ParsePathContext *ctx, ...@@ -1688,7 +1701,7 @@ parse_path_do_cmd (ParsePathContext *ctx,
/* quadratic bezier curveto */ /* quadratic bezier curveto */
if (ctx->param == 4 || final) if (ctx->param == 4 || final)
{ {
GimpCoords ctrl = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords ctrl = COORDS_INIT;
parse_path_default_xy (ctx, 4); parse_path_default_xy (ctx, 4);
...@@ -1707,7 +1720,7 @@ parse_path_do_cmd (ParsePathContext *ctx, ...@@ -1707,7 +1720,7 @@ parse_path_do_cmd (ParsePathContext *ctx,
/* truetype quadratic bezier curveto */ /* truetype quadratic bezier curveto */
if (ctx->param == 2 || final) if (ctx->param == 2 || final)
{ {
GimpCoords ctrl = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords ctrl = COORDS_INIT;
parse_path_default_xy (ctx, 2); parse_path_default_xy (ctx, 2);
...@@ -1724,7 +1737,7 @@ parse_path_do_cmd (ParsePathContext *ctx, ...@@ -1724,7 +1737,7 @@ parse_path_do_cmd (ParsePathContext *ctx,
{ {
if (ctx->param > 2) if (ctx->param > 2)
{ {
GimpCoords ctrl = { 0.0, 0.0, 1.0, 0.5, 0.5, 0.5 }; GimpCoords ctrl = COORDS_INIT;
parse_path_default_xy (ctx, 4); parse_path_default_xy (ctx, 4);
......
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