[cairo-commit] 2 commits - src/cairo-path-stroke.c test/.gitignore test/Makefile.am test/mask-ctm-image.c test/mask-ctm-image-ref.png test/mask-ctm-similar.c test/mask-ctm-similar-ref.png test/mask-transformed-image.c test/mask-transformed-image-ref.png test/mask-transformed-similar.c test/mask-transformed-similar-ref.png
Chris Wilson
ickle at kemper.freedesktop.org
Wed Sep 24 10:41:38 PDT 2008
dev/null |binary
src/cairo-path-stroke.c | 8 ++
test/.gitignore | 4 -
test/Makefile.am | 8 +-
test/mask-ctm-image.c | 100 ---------------------------------
test/mask-ctm-similar.c | 102 ----------------------------------
test/mask-transformed-image-ref.png |binary
test/mask-transformed-image.c | 100 +++++++++++++++++++++++++++++++++
test/mask-transformed-similar-ref.png |binary
test/mask-transformed-similar.c | 102 ++++++++++++++++++++++++++++++++++
10 files changed, 216 insertions(+), 208 deletions(-)
New commits:
commit 8f157303681a3d58471ffbe004bc140b7a3a48be
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Sep 24 18:39:29 2008 +0100
[test] Rename mask-ctm-* to avoid conflict with mask-ctm.
Using mask-ctm-image as a test name was causing a naming conflict with
mask-ctm, so rename the new tests.
diff --git a/test/.gitignore b/test/.gitignore
index 5800cdf..9244051 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -120,9 +120,9 @@ long-lines
mask
mask-alpha
mask-ctm
-mask-ctm-image
-mask-ctm-similar
mask-surface-ctm
+mask-transformed-image
+mask-transformed-similar
meta-surface-pattern
miter-precision
move-to-show-surface
diff --git a/test/Makefile.am b/test/Makefile.am
index 629eda4..780a5f7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -96,9 +96,9 @@ long-lines$(EXEEXT) \
mask$(EXEEXT) \
mask-alpha$(EXEEXT) \
mask-ctm$(EXEEXT) \
-mask-ctm-image$(EXEEXT) \
-mask-ctm-similar$(EXEEXT) \
mask-surface-ctm$(EXEEXT) \
+mask-transformed-image$(EXEEXT) \
+mask-transformed-similar$(EXEEXT) \
meta-surface-pattern$(EXEEXT) \
miter-precision$(EXEEXT) \
move-to-show-surface$(EXEEXT) \
@@ -512,8 +512,6 @@ REFERENCE_IMAGES = \
mask-ctm-ref.png \
mask-ctm-rgb24-ref.png \
mask-ctm-svg-argb32-ref.png \
- mask-ctm-image-ref.png \
- mask-ctm-similar-ref.png \
mask-ref.png \
mask-rgb24-ref.png \
mask-pdf-argb32-ref.png \
@@ -525,6 +523,8 @@ REFERENCE_IMAGES = \
mask-surface-ctm-svg-argb32-ref.png \
mask-svg-rgb24-ref.png \
mask-svg-argb32-ref.png \
+ mask-transformed-image-ref.png \
+ mask-transformed-similar-ref.png \
meta-surface-pattern-ref.png \
meta-surface-pattern-rgb24-ref.png \
meta-surface-pattern-pdf-ref.png \
diff --git a/test/mask-ctm-image-ref.png b/test/mask-ctm-image-ref.png
deleted file mode 100644
index e634f75..0000000
Binary files a/test/mask-ctm-image-ref.png and /dev/null differ
diff --git a/test/mask-ctm-image.c b/test/mask-ctm-image.c
deleted file mode 100644
index e57e697..0000000
--- a/test/mask-ctm-image.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2008 Kai-Uwe Behrmann
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Kai-Uwe Behrmann not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. Kai-Uwe Behrmann makes no representations about the
- * suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * KAI_UWE BEHRMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL KAI_UWE BEHRMANN BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Kai-Uwe Behrmann <ku.b at gmx.de>
- * Chris Wilson <chris at chris-wilson.co.uk>
- */
-
-#include "cairo-test.h"
-
-static cairo_test_draw_function_t draw;
-static const char png_filename[] = "romedalen.png";
-
-static const cairo_test_t test = {
- "mask-ctm-image",
- "Test that cairo_mask() is affected properly by the CTM and not the image",
- 80, 80,
- draw
-};
-
-static cairo_surface_t *
-create_mask (cairo_t *dst, int width, int height)
-{
- cairo_surface_t *mask;
- cairo_t *cr;
-
- mask = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height);
- cr = cairo_create (mask);
- cairo_surface_destroy (mask);
-
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_rectangle (cr, width/4, height/4, width/2, height/2);
- cairo_fill (cr);
-
- mask = cairo_surface_reference (cairo_get_target (cr));
- cairo_destroy (cr);
-
- return mask;
-}
-
-static cairo_test_status_t
-draw (cairo_t *cr, int width, int height)
-{
- const cairo_test_context_t *ctx = cairo_test_get_context (cr);
- cairo_surface_t *image, *mask;
-
- image = cairo_test_create_surface_from_png (ctx, png_filename);
- mask = create_mask (cr, 40, 40);
-
- /* opaque background */
- cairo_paint (cr);
-
- /* center */
- cairo_translate (cr,
- (width - cairo_image_surface_get_width (image)) / 2.,
- (height - cairo_image_surface_get_height (image)) / 2.);
-
- /* rotate 30 degree around the center */
- cairo_translate (cr, width/2., height/2.);
- cairo_rotate (cr, -30 * 2 * M_PI / 360);
- cairo_translate (cr, -width/2., -height/2.);
-
- /* place the image on our surface */
- cairo_set_source_surface (cr, image, 0, 0);
-
- /* reset the drawing matrix */
- cairo_identity_matrix (cr);
-
- /* fill nicely */
- cairo_scale (cr, width / 40., height / 40.);
-
- /* apply the mask */
- cairo_mask_surface (cr, mask, 0, 0);
-
- return CAIRO_TEST_SUCCESS;
-}
-
-int
-main (void)
-{
- return cairo_test (&test);
-}
diff --git a/test/mask-ctm-similar-ref.png b/test/mask-ctm-similar-ref.png
deleted file mode 100644
index e634f75..0000000
Binary files a/test/mask-ctm-similar-ref.png and /dev/null differ
diff --git a/test/mask-ctm-similar.c b/test/mask-ctm-similar.c
deleted file mode 100644
index 502837a..0000000
--- a/test/mask-ctm-similar.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2008 Kai-Uwe Behrmann
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Kai-Uwe Behrmann not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. Kai-Uwe Behrmann makes no representations about the
- * suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * KAI_UWE BEHRMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL KAI_UWE BEHRMANN BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Kai-Uwe Behrmann <ku.b at gmx.de>
- * Chris Wilson <chris at chris-wilson.co.uk>
- */
-
-#include "cairo-test.h"
-
-static cairo_test_draw_function_t draw;
-static const char png_filename[] = "romedalen.png";
-
-static const cairo_test_t test = {
- "mask-ctm-similar",
- "Test that cairo_mask() is affected properly by the CTM and not the image",
- 80, 80,
- draw
-};
-
-static cairo_surface_t *
-create_mask (cairo_t *dst, int width, int height)
-{
- cairo_surface_t *mask;
- cairo_t *cr;
-
- mask = cairo_surface_create_similar (cairo_get_target (dst),
- CAIRO_CONTENT_ALPHA,
- width, height);
- cr = cairo_create (mask);
- cairo_surface_destroy (mask);
-
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_rectangle (cr, width/4, height/4, width/2, height/2);
- cairo_fill (cr);
-
- mask = cairo_surface_reference (cairo_get_target (cr));
- cairo_destroy (cr);
-
- return mask;
-}
-
-static cairo_test_status_t
-draw (cairo_t *cr, int width, int height)
-{
- const cairo_test_context_t *ctx = cairo_test_get_context (cr);
- cairo_surface_t *image, *mask;
-
- image = cairo_test_create_surface_from_png (ctx, png_filename);
- mask = create_mask (cr, 40, 40);
-
- /* opaque background */
- cairo_paint (cr);
-
- /* center */
- cairo_translate (cr,
- (width - cairo_image_surface_get_width (image)) / 2.,
- (height - cairo_image_surface_get_height (image)) / 2.);
-
- /* rotate 30 degree around the center */
- cairo_translate (cr, width/2., height/2.);
- cairo_rotate (cr, -30 * 2 * M_PI / 360);
- cairo_translate (cr, -width/2., -height/2.);
-
- /* place the image on our surface */
- cairo_set_source_surface (cr, image, 0, 0);
-
- /* reset the drawing matrix */
- cairo_identity_matrix (cr);
-
- /* fill nicely */
- cairo_scale (cr, width / 40., height / 40.);
-
- /* apply the mask */
- cairo_mask_surface (cr, mask, 0, 0);
-
- return CAIRO_TEST_SUCCESS;
-}
-
-int
-main (void)
-{
- return cairo_test (&test);
-}
diff --git a/test/mask-transformed-image-ref.png b/test/mask-transformed-image-ref.png
new file mode 100644
index 0000000..e634f75
Binary files /dev/null and b/test/mask-transformed-image-ref.png differ
diff --git a/test/mask-transformed-image.c b/test/mask-transformed-image.c
new file mode 100644
index 0000000..5906833
--- /dev/null
+++ b/test/mask-transformed-image.c
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2008 Kai-Uwe Behrmann
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Kai-Uwe Behrmann not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Kai-Uwe Behrmann makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * KAI_UWE BEHRMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL KAI_UWE BEHRMANN BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Kai-Uwe Behrmann <ku.b at gmx.de>
+ * Chris Wilson <chris at chris-wilson.co.uk>
+ */
+
+#include "cairo-test.h"
+
+static cairo_test_draw_function_t draw;
+static const char png_filename[] = "romedalen.png";
+
+static const cairo_test_t test = {
+ "mask-transformed-image",
+ "Test that cairo_mask() is affected properly by the CTM and not the image",
+ 80, 80,
+ draw
+};
+
+static cairo_surface_t *
+create_mask (cairo_t *dst, int width, int height)
+{
+ cairo_surface_t *mask;
+ cairo_t *cr;
+
+ mask = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height);
+ cr = cairo_create (mask);
+ cairo_surface_destroy (mask);
+
+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+ cairo_rectangle (cr, width/4, height/4, width/2, height/2);
+ cairo_fill (cr);
+
+ mask = cairo_surface_reference (cairo_get_target (cr));
+ cairo_destroy (cr);
+
+ return mask;
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ const cairo_test_context_t *ctx = cairo_test_get_context (cr);
+ cairo_surface_t *image, *mask;
+
+ image = cairo_test_create_surface_from_png (ctx, png_filename);
+ mask = create_mask (cr, 40, 40);
+
+ /* opaque background */
+ cairo_paint (cr);
+
+ /* center */
+ cairo_translate (cr,
+ (width - cairo_image_surface_get_width (image)) / 2.,
+ (height - cairo_image_surface_get_height (image)) / 2.);
+
+ /* rotate 30 degree around the center */
+ cairo_translate (cr, width/2., height/2.);
+ cairo_rotate (cr, -30 * 2 * M_PI / 360);
+ cairo_translate (cr, -width/2., -height/2.);
+
+ /* place the image on our surface */
+ cairo_set_source_surface (cr, image, 0, 0);
+
+ /* reset the drawing matrix */
+ cairo_identity_matrix (cr);
+
+ /* fill nicely */
+ cairo_scale (cr, width / 40., height / 40.);
+
+ /* apply the mask */
+ cairo_mask_surface (cr, mask, 0, 0);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test);
+}
diff --git a/test/mask-transformed-similar-ref.png b/test/mask-transformed-similar-ref.png
new file mode 100644
index 0000000..e634f75
Binary files /dev/null and b/test/mask-transformed-similar-ref.png differ
diff --git a/test/mask-transformed-similar.c b/test/mask-transformed-similar.c
new file mode 100644
index 0000000..f4d46f6
--- /dev/null
+++ b/test/mask-transformed-similar.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2008 Kai-Uwe Behrmann
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Kai-Uwe Behrmann not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Kai-Uwe Behrmann makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * KAI_UWE BEHRMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL KAI_UWE BEHRMANN BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Kai-Uwe Behrmann <ku.b at gmx.de>
+ * Chris Wilson <chris at chris-wilson.co.uk>
+ */
+
+#include "cairo-test.h"
+
+static cairo_test_draw_function_t draw;
+static const char png_filename[] = "romedalen.png";
+
+static const cairo_test_t test = {
+ "mask-transformed-similar",
+ "Test that cairo_mask() is affected properly by the CTM and not the image",
+ 80, 80,
+ draw
+};
+
+static cairo_surface_t *
+create_mask (cairo_t *dst, int width, int height)
+{
+ cairo_surface_t *mask;
+ cairo_t *cr;
+
+ mask = cairo_surface_create_similar (cairo_get_target (dst),
+ CAIRO_CONTENT_ALPHA,
+ width, height);
+ cr = cairo_create (mask);
+ cairo_surface_destroy (mask);
+
+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+ cairo_rectangle (cr, width/4, height/4, width/2, height/2);
+ cairo_fill (cr);
+
+ mask = cairo_surface_reference (cairo_get_target (cr));
+ cairo_destroy (cr);
+
+ return mask;
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ const cairo_test_context_t *ctx = cairo_test_get_context (cr);
+ cairo_surface_t *image, *mask;
+
+ image = cairo_test_create_surface_from_png (ctx, png_filename);
+ mask = create_mask (cr, 40, 40);
+
+ /* opaque background */
+ cairo_paint (cr);
+
+ /* center */
+ cairo_translate (cr,
+ (width - cairo_image_surface_get_width (image)) / 2.,
+ (height - cairo_image_surface_get_height (image)) / 2.);
+
+ /* rotate 30 degree around the center */
+ cairo_translate (cr, width/2., height/2.);
+ cairo_rotate (cr, -30 * 2 * M_PI / 360);
+ cairo_translate (cr, -width/2., -height/2.);
+
+ /* place the image on our surface */
+ cairo_set_source_surface (cr, image, 0, 0);
+
+ /* reset the drawing matrix */
+ cairo_identity_matrix (cr);
+
+ /* fill nicely */
+ cairo_scale (cr, width / 40., height / 40.);
+
+ /* apply the mask */
+ cairo_mask_surface (cr, mask, 0, 0);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test);
+}
commit 444d44acde4ac73641c789c19ec7a3199211b594
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Sep 24 18:12:22 2008 +0100
[stroke] Cap trailing segment when skipping invisible segments.
If we do not maintain the current_face even for invisible dashed segments,
then we will generate spurious line segments when attempting to close the
path (ala leaky-dashed-rectangle).
This fixes the long standing regression introduced just prior to 1.6 and
captured in these bug reports:
http://lists.cairographics.org/archives/cairo/2008-April/013912.html
http://bugs.freedesktop.org/show_bug.cgi?id=17177
diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index 24d0550..419412a 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -915,6 +915,14 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point)
stroker->has_current_face = FALSE;
}
}
+ } else {
+ if (stroker->has_current_face) {
+ /* Cap final face from previous segment */
+ status = _cairo_stroker_add_trailing_cap (stroker, &stroker->current_face);
+ if (status)
+ return status;
+ stroker->has_current_face = FALSE;
+ }
}
_cairo_stroker_step_dash (stroker, step_length);
More information about the cairo-commit
mailing list