summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-03-08 10:26:06 +0100
committerAndrea Canciani <ranma42@gmail.com>2011-03-18 10:30:25 +0100
commitc0fe55651565fa63586b7e4d675149a98c7e549c (patch)
tree5f951c274021375e30bd53aa4e3f40feaf4650bb
parent43692559614e841dc169e3cec213033b0298da87 (diff)
path: Fix _cairo_path_fixed_is_rectangle()
__cairo_path_fixed_is_rectangle() is used by the PS and PDF backends to check if a path is equivalent to a rectangle when stroking. This is different from being a rectangle when filling, because of the implicit close_path appended to every subpath when filling. Fixes stroke-open-box. See https://bugs.freedesktop.org/show_bug.cgi?id=34560
-rw-r--r--src/cairo-path-fixed.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c
index e3e273b46..58d4f4b20 100644
--- a/src/cairo-path-fixed.c
+++ b/src/cairo-path-fixed.c
@@ -1290,8 +1290,11 @@ _cairo_path_fixed_is_rectangle (const cairo_path_fixed_t *path,
if (! _cairo_path_fixed_is_box (path, box))
return FALSE;
+ /* This check is valid because the current implementation of
+ * _cairo_path_fixed_is_box () only accepts rectangles like:
+ * move,line,line,line[,line|close[,close|move]]. */
buf = cairo_path_head (path);
- if (buf->points[0].y == buf->points[1].y)
+ if (buf->num_ops > 4)
return TRUE;
return FALSE;