[cairo-commit] 5 commits - perf/cairo-perf-diff-files.c src/cairo-surface-fallback.c src/cairo-win32-printing-surface.c src/cairo-win32-surface.c src/cairo-xlib-display.c test/clip-fill-unbounded.argb32.ref.png test/clip-fill-unbounded.c test/clip-fill-unbounded.rgb24.ref.png test/clip-fill-unbounded.svg12.argb32.xfail.png test/clip-fill-unbounded.svg12.rgb24.xfail.png test/clip-fill-unbounded.xlib.argb32.ref.png test/clip-fill-unbounded.xlib-fallback.rgb24.ref.png test/clip-fill-unbounded.xlib.rgb24.ref.png test/clip-stroke-unbounded.argb32.ref.png test/clip-stroke-unbounded.c test/clip-stroke-unbounded.rgb24.ref.png test/clip-stroke-unbounded.svg12.argb32.xfail.png test/clip-stroke-unbounded.svg12.rgb24.xfail.png test/clip-stroke-unbounded.xlib.argb32.ref.png test/clip-stroke-unbounded.xlib-fallback.rgb24.ref.png test/clip-stroke-unbounded.xlib.rgb24.ref.png test/Makefile.am test/Makefile.sources

Chris Wilson ickle at kemper.freedesktop.org
Fri Sep 4 01:37:22 PDT 2009


 perf/cairo-perf-diff-files.c                           |   13 +-
 src/cairo-surface-fallback.c                           |   57 ++++++---
 src/cairo-win32-printing-surface.c                     |    2 
 src/cairo-win32-surface.c                              |   57 ---------
 src/cairo-xlib-display.c                               |   19 +--
 test/Makefile.am                                       |   14 ++
 test/Makefile.sources                                  |    2 
 test/clip-fill-unbounded.argb32.ref.png                |binary
 test/clip-fill-unbounded.c                             |  105 +++++++++++++++++
 test/clip-fill-unbounded.rgb24.ref.png                 |binary
 test/clip-fill-unbounded.svg12.argb32.xfail.png        |binary
 test/clip-fill-unbounded.svg12.rgb24.xfail.png         |binary
 test/clip-fill-unbounded.xlib-fallback.rgb24.ref.png   |binary
 test/clip-fill-unbounded.xlib.argb32.ref.png           |binary
 test/clip-fill-unbounded.xlib.rgb24.ref.png            |binary
 test/clip-stroke-unbounded.argb32.ref.png              |binary
 test/clip-stroke-unbounded.c                           |  102 ++++++++++++++++
 test/clip-stroke-unbounded.rgb24.ref.png               |binary
 test/clip-stroke-unbounded.svg12.argb32.xfail.png      |binary
 test/clip-stroke-unbounded.svg12.rgb24.xfail.png       |binary
 test/clip-stroke-unbounded.xlib-fallback.rgb24.ref.png |binary
 test/clip-stroke-unbounded.xlib.argb32.ref.png         |binary
 test/clip-stroke-unbounded.xlib.rgb24.ref.png          |binary
 23 files changed, 287 insertions(+), 84 deletions(-)

New commits:
commit b065303740cc18fbcabfeef34d09c7d8b617647e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 4 09:35:22 2009 +0100

    [xlib] Enable pad_reflect by default
    
    If the XServer claims to support the required Render extension then send
    it the operations. However for the cases where we know it does not work,
    i.e. the current and previous generations (<=1.6) of Xorg servers, enable
    the buggy_pad_reflect fallbacks.

diff --git a/src/cairo-xlib-display.c b/src/cairo-xlib-display.c
index 0c0ce61..b517fbf 100644
--- a/src/cairo-xlib-display.c
+++ b/src/cairo-xlib-display.c
@@ -316,7 +316,7 @@ _cairo_xlib_display_get (Display *dpy,
 #else
     display->buggy_gradients = FALSE;
 #endif
-    display->buggy_pad_reflect = TRUE;
+    display->buggy_pad_reflect = FALSE;
     display->buggy_repeat = FALSE;
 
     /* This buggy_repeat condition is very complicated because there
@@ -361,28 +361,33 @@ _cairo_xlib_display_get (Display *dpy,
      *    exactly when second the bug started, but since bug 1 is
      *    present through 6.8.2 and bug 2 is present in 6.9.0 it seems
      *    safest to just blacklist all old-versioning-scheme X servers,
-     *    (just using VendorRelase < 70000000), as buggy_repeat=TRUE.
+     *    (just using VendorRelease < 70000000), as buggy_repeat=TRUE.
      */
     if (strstr (ServerVendor (dpy), "X.Org") != NULL) {
 	if (VendorRelease (dpy) >= 60700000) {
 	    if (VendorRelease (dpy) < 70000000)
 		display->buggy_repeat = TRUE;
 
-	    /* We know that gradients simply do not work in eary Xorg servers */
+	    /* We know that gradients simply do not work in early Xorg servers */
 	    if (VendorRelease (dpy) < 70200000)
-	    {
 		display->buggy_gradients = TRUE;
-	    }
+
+	    /* And the extended repeat modes were not fixed until much later */
+	    display->buggy_pad_reflect = TRUE;
 	} else {
 	    if (VendorRelease (dpy) < 10400000)
 		display->buggy_repeat = TRUE;
-	    if (VendorRelease (dpy) >= 10699000)
-		display->buggy_pad_reflect = FALSE;
+
+	    /* Too many bugs in the early drivers */
+	    if (VendorRelease (dpy) < 10699000)
+		display->buggy_pad_reflect = TRUE;
 	}
     } else if (strstr (ServerVendor (dpy), "XFree86") != NULL) {
 	if (VendorRelease (dpy) <= 40500000)
 	    display->buggy_repeat = TRUE;
 
+	display->buggy_gradients = TRUE;
+	display->buggy_pad_reflect = TRUE;
     }
 
     display->next = _cairo_xlib_display_list;
commit 634fdb4afd15e2467979609b1af7c1c198fc83d4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 4 09:14:12 2009 +0100

    [test] Add unbounded variants of clip-{fill,stroke}
    
    Add a couple of tests to exercise a bug that Joonas spotted that I had
    introduced with the clip-reduction scheme - namely that I had
    incorrectly removed the clip on unbounded operations.

diff --git a/test/Makefile.am b/test/Makefile.am
index 6b084e6..f3e6536 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -179,6 +179,13 @@ REFERENCE_IMAGES = \
 	clip-fill-rule.rgb24.ref.png \
 	clip-fill-rule.test-paginated.rgb24.ref.png \
 	clip-fill-rule.xlib.rgb24.ref.png \
+	clip-fill-unbounded.argb32.ref.png \
+	clip-fill-unbounded.rgb24.ref.png \
+	clip-fill-unbounded.svg12.argb32.xfail.png \
+	clip-fill-unbounded.svg12.rgb24.xfail.png \
+	clip-fill-unbounded.xlib.argb32.ref.png \
+	clip-fill-unbounded.xlib.rgb24.ref.png \
+	clip-fill-unbounded.xlib-fallback.rgb24.ref.png \
 	clip-image.ref.png \
 	clip-nesting.pdf.argb32.ref.png \
 	clip-nesting.ps2.argb32.ref.png \
@@ -224,6 +231,13 @@ REFERENCE_IMAGES = \
 	clip-stroke.ref.png \
 	clip-stroke.xlib.ref.png \
 	clip-stroke.xlib-fallback.ref.png \
+	clip-stroke-unbounded.argb32.ref.png \
+	clip-stroke-unbounded.rgb24.ref.png \
+	clip-stroke-unbounded.svg12.argb32.xfail.png \
+	clip-stroke-unbounded.svg12.rgb24.xfail.png \
+	clip-stroke-unbounded.xlib.argb32.ref.png \
+	clip-stroke-unbounded.xlib.rgb24.ref.png \
+	clip-stroke-unbounded.xlib-fallback.rgb24.ref.png \
 	clip-text.ref.png \
 	clip-text.ps.xfail.png \
 	clip-text.svg.ref.png \
diff --git a/test/Makefile.sources b/test/Makefile.sources
index aec133f..68672f5 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -19,11 +19,13 @@ test_sources = \
 	clip-fill.c					\
 	clip-fill-rule.c				\
 	clip-fill-rule-pixel-aligned.c			\
+	clip-fill-unbounded.c				\
 	clip-image.c					\
 	clip-nesting.c					\
 	clip-operator.c					\
 	clip-push-group.c				\
 	clip-stroke.c					\
+	clip-stroke-unbounded.c				\
 	clip-text.c					\
 	clip-twice.c					\
 	clip-unbounded.c				\
diff --git a/test/clip-fill-unbounded.argb32.ref.png b/test/clip-fill-unbounded.argb32.ref.png
new file mode 100644
index 0000000..9adf992
Binary files /dev/null and b/test/clip-fill-unbounded.argb32.ref.png differ
diff --git a/test/clip-fill-unbounded.c b/test/clip-fill-unbounded.c
new file mode 100644
index 0000000..893eb41
--- /dev/null
+++ b/test/clip-fill-unbounded.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2009 Chris Wilson
+ *
+ * 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
+ * Chris Wilson not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Chris Wilson makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL CHRIS WILSON 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: Chris Wilson <chris at chris-wilson.co.uk>
+ */
+
+#include "cairo-test.h"
+
+#define WIDTH 40
+#define HEIGHT 40
+
+static void
+shapes (cairo_t *cr)
+{
+    cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+    cairo_set_source_rgb (cr, 1, 0, 0);
+    cairo_paint (cr);
+
+    cairo_set_operator (cr, CAIRO_OPERATOR_IN);
+    cairo_set_source_rgb (cr, 0, 0.7, 0);
+    cairo_new_sub_path (cr);
+    cairo_arc (cr, 10, 10, 8.5, 0, 2 * M_PI);
+    cairo_new_sub_path (cr);
+    cairo_arc_negative (cr, 10, 10, 6.5, 2 * M_PI, 0);
+    cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING);
+    cairo_fill (cr);
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+    cairo_set_source_rgb (cr, 1, 1, 1);
+    cairo_paint (cr);
+
+    cairo_translate (cr, 10, 10);
+
+    /* simple clip */
+    cairo_save (cr);
+    cairo_rectangle (cr, 0, 0, 20, 20);
+    cairo_clip (cr);
+    shapes (cr);
+    cairo_restore (cr);
+
+    cairo_translate (cr, WIDTH, 0);
+
+    /* unaligned clip */
+    cairo_save (cr);
+    cairo_rectangle (cr, 0.5, 0.5, 20, 20);
+    cairo_clip (cr);
+    shapes (cr);
+    cairo_restore (cr);
+
+    cairo_translate (cr, -WIDTH, HEIGHT);
+
+    /* aligned-clip */
+    cairo_save (cr);
+    cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
+    cairo_rectangle (cr, 0, 0, 20, 20);
+    cairo_rectangle (cr, 3, 3, 10, 10);
+    cairo_rectangle (cr, 7, 7, 10, 10);
+    cairo_clip (cr);
+    shapes (cr);
+    cairo_restore (cr);
+
+    cairo_translate (cr, WIDTH, 0);
+
+    /* force a clip-mask */
+    cairo_save (cr);
+    cairo_arc (cr, 10, 10, 10, 0, 2 * M_PI);
+    cairo_new_sub_path (cr);
+    cairo_arc_negative (cr, 10, 10, 5, 2 * M_PI, 0);
+    cairo_new_sub_path (cr);
+    cairo_arc (cr, 10, 10, 2, 0, 2 * M_PI);
+    cairo_clip (cr);
+    shapes (cr);
+    cairo_restore (cr);
+
+    return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (clip_fill_unbounded,
+	    "Tests unbounded fill through complex clips.",
+	    "clip, fill, unbounded", /* keywords */
+	    NULL, /* requirements */
+	    2 * WIDTH, 2* HEIGHT,
+	    NULL, draw)
diff --git a/test/clip-fill-unbounded.rgb24.ref.png b/test/clip-fill-unbounded.rgb24.ref.png
new file mode 100644
index 0000000..e57e296
Binary files /dev/null and b/test/clip-fill-unbounded.rgb24.ref.png differ
diff --git a/test/clip-fill-unbounded.svg12.argb32.xfail.png b/test/clip-fill-unbounded.svg12.argb32.xfail.png
new file mode 100644
index 0000000..32c760e
Binary files /dev/null and b/test/clip-fill-unbounded.svg12.argb32.xfail.png differ
diff --git a/test/clip-fill-unbounded.svg12.rgb24.xfail.png b/test/clip-fill-unbounded.svg12.rgb24.xfail.png
new file mode 100644
index 0000000..32c760e
Binary files /dev/null and b/test/clip-fill-unbounded.svg12.rgb24.xfail.png differ
diff --git a/test/clip-fill-unbounded.xlib-fallback.rgb24.ref.png b/test/clip-fill-unbounded.xlib-fallback.rgb24.ref.png
new file mode 100644
index 0000000..7fc229f
Binary files /dev/null and b/test/clip-fill-unbounded.xlib-fallback.rgb24.ref.png differ
diff --git a/test/clip-fill-unbounded.xlib.argb32.ref.png b/test/clip-fill-unbounded.xlib.argb32.ref.png
new file mode 100644
index 0000000..c7f4cb7
Binary files /dev/null and b/test/clip-fill-unbounded.xlib.argb32.ref.png differ
diff --git a/test/clip-fill-unbounded.xlib.rgb24.ref.png b/test/clip-fill-unbounded.xlib.rgb24.ref.png
new file mode 100644
index 0000000..1da9992
Binary files /dev/null and b/test/clip-fill-unbounded.xlib.rgb24.ref.png differ
diff --git a/test/clip-stroke-unbounded.argb32.ref.png b/test/clip-stroke-unbounded.argb32.ref.png
new file mode 100644
index 0000000..39b9a30
Binary files /dev/null and b/test/clip-stroke-unbounded.argb32.ref.png differ
diff --git a/test/clip-stroke-unbounded.c b/test/clip-stroke-unbounded.c
new file mode 100644
index 0000000..990b618
--- /dev/null
+++ b/test/clip-stroke-unbounded.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2009 Chris Wilson
+ *
+ * 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
+ * Chris Wilson not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Chris Wilson makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL CHRIS WILSON 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: Chris Wilson <chris at chris-wilson.co.uk>
+ */
+
+#include "cairo-test.h"
+
+#define WIDTH 40
+#define HEIGHT 40
+
+static void
+shapes (cairo_t *cr)
+{
+    cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+    cairo_set_source_rgb (cr, 1, 0, 0);
+    cairo_paint (cr);
+
+    cairo_set_operator (cr, CAIRO_OPERATOR_IN);
+    cairo_set_source_rgb (cr, 0, 0.7, 0);
+    cairo_arc (cr, 10, 10, 7.5, 0, 2 * M_PI);
+    cairo_stroke (cr);
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+    cairo_set_source_rgb (cr, 1, 1, 1);
+    cairo_paint (cr);
+
+    cairo_translate (cr, 10, 10);
+
+    /* simple clip */
+    cairo_save (cr);
+    cairo_rectangle (cr, 0, 0, 20, 20);
+    cairo_clip (cr);
+    shapes (cr);
+    cairo_restore (cr);
+
+    cairo_translate (cr, WIDTH, 0);
+
+    /* unaligned clip */
+    cairo_save (cr);
+    cairo_rectangle (cr, 0.5, 0.5, 20, 20);
+    cairo_clip (cr);
+    shapes (cr);
+    cairo_restore (cr);
+
+    cairo_translate (cr, -WIDTH, HEIGHT);
+
+    /* aligned-clip */
+    cairo_save (cr);
+    cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
+    cairo_rectangle (cr, 0, 0, 20, 20);
+    cairo_rectangle (cr, 3, 3, 10, 10);
+    cairo_rectangle (cr, 7, 7, 10, 10);
+    cairo_clip (cr);
+    shapes (cr);
+    cairo_restore (cr);
+
+    cairo_translate (cr, WIDTH, 0);
+
+    /* force a clip-mask */
+    cairo_save (cr);
+    cairo_arc (cr, 10, 10, 10, 0, 2 * M_PI);
+    cairo_new_sub_path (cr);
+    cairo_arc_negative (cr, 10, 10, 5, 2 * M_PI, 0);
+    cairo_new_sub_path (cr);
+    cairo_arc (cr, 10, 10, 2, 0, 2 * M_PI);
+    cairo_clip (cr);
+    shapes (cr);
+    cairo_restore (cr);
+
+    return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (clip_stroke_unbounded,
+	    "Tests unbounded stroke through complex clips.",
+	    "clip, stroke, unbounded", /* keywords */
+	    NULL, /* requirements */
+	    2 * WIDTH, 2* HEIGHT,
+	    NULL, draw)
+
diff --git a/test/clip-stroke-unbounded.rgb24.ref.png b/test/clip-stroke-unbounded.rgb24.ref.png
new file mode 100644
index 0000000..a30352e
Binary files /dev/null and b/test/clip-stroke-unbounded.rgb24.ref.png differ
diff --git a/test/clip-stroke-unbounded.svg12.argb32.xfail.png b/test/clip-stroke-unbounded.svg12.argb32.xfail.png
new file mode 100644
index 0000000..6e7b48d
Binary files /dev/null and b/test/clip-stroke-unbounded.svg12.argb32.xfail.png differ
diff --git a/test/clip-stroke-unbounded.svg12.rgb24.xfail.png b/test/clip-stroke-unbounded.svg12.rgb24.xfail.png
new file mode 100644
index 0000000..6e7b48d
Binary files /dev/null and b/test/clip-stroke-unbounded.svg12.rgb24.xfail.png differ
diff --git a/test/clip-stroke-unbounded.xlib-fallback.rgb24.ref.png b/test/clip-stroke-unbounded.xlib-fallback.rgb24.ref.png
new file mode 100644
index 0000000..7fc229f
Binary files /dev/null and b/test/clip-stroke-unbounded.xlib-fallback.rgb24.ref.png differ
diff --git a/test/clip-stroke-unbounded.xlib.argb32.ref.png b/test/clip-stroke-unbounded.xlib.argb32.ref.png
new file mode 100644
index 0000000..f94e716
Binary files /dev/null and b/test/clip-stroke-unbounded.xlib.argb32.ref.png differ
diff --git a/test/clip-stroke-unbounded.xlib.rgb24.ref.png b/test/clip-stroke-unbounded.xlib.rgb24.ref.png
new file mode 100644
index 0000000..1da9992
Binary files /dev/null and b/test/clip-stroke-unbounded.xlib.rgb24.ref.png differ
commit de99f841886de5cc6e5bc91f9d3e82076d838dee
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 4 08:55:19 2009 +0100

    [fallback] Only eliminate the clip if the operation is bounded
    
    For unbounded operations we still need to pass along the clip in order to
    correctly limit the extents of the operation.

diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c
index 79d719d..35befa5 100644
--- a/src/cairo-surface-fallback.c
+++ b/src/cairo-surface-fallback.c
@@ -907,9 +907,10 @@ _clip_contains_rectangle (cairo_clip_t *clip,
     return TRUE;
 }
 
-static cairo_status_t
+static inline cairo_status_t
 _clip_to_boxes (cairo_clip_t **clip,
 		const cairo_rectangle_int_t *extents,
+		cairo_bool_t is_bounded,
 		cairo_box_t **boxes,
 		int *num_boxes)
 {
@@ -923,7 +924,8 @@ _clip_to_boxes (cairo_clip_t **clip,
     status = _cairo_clip_get_boxes (*clip, boxes, num_boxes);
     switch ((int) status) {
     case CAIRO_STATUS_SUCCESS:
-	*clip = NULL;
+	if (is_bounded)
+	    *clip = NULL;
 	goto DONE;
 
     case  CAIRO_INT_STATUS_UNSUPPORTED:
@@ -955,15 +957,18 @@ _cairo_surface_fallback_paint (cairo_surface_t		*surface,
     is_bounded = _cairo_surface_get_extents (surface, &extents);
     assert (is_bounded || clip);
 
+    is_bounded = FALSE;
     if (_cairo_operator_bounded_by_source (op)) {
 	cairo_rectangle_int_t source_extents;
 
 	_cairo_pattern_get_extents (source, &source_extents);
 	if (! _cairo_rectangle_intersect (&extents, &source_extents))
 	    return CAIRO_STATUS_SUCCESS;
+
+	is_bounded = TRUE;
     }
 
-    if (clip != NULL && _clip_contains_rectangle (clip, &extents))
+    if (is_bounded && clip != NULL && _clip_contains_rectangle (clip, &extents))
 	clip = NULL;
 
     status = _rectangle_intersect_clip (&extents, clip);
@@ -973,7 +978,7 @@ _cairo_surface_fallback_paint (cairo_surface_t		*surface,
 	return status;
     }
 
-    status = _clip_to_boxes (&clip, &extents, &boxes, &num_boxes);
+    status = _clip_to_boxes (&clip, &extents, is_bounded, &boxes, &num_boxes);
     if (unlikely (status)) {
 	if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
 	    status = CAIRO_STATUS_SUCCESS;
@@ -1057,12 +1062,15 @@ _cairo_surface_fallback_mask (cairo_surface_t		*surface,
     is_bounded = _cairo_surface_get_extents (surface, &extents);
     assert (is_bounded || clip);
 
+    is_bounded = FALSE;
     if (_cairo_operator_bounded_by_source (op)) {
 	cairo_rectangle_int_t source_extents;
 
 	_cairo_pattern_get_extents (source, &source_extents);
 	if (! _cairo_rectangle_intersect (&extents, &source_extents))
 	    return CAIRO_STATUS_SUCCESS;
+
+	is_bounded = TRUE;
     }
 
     if (_cairo_operator_bounded_by_mask (op)) {
@@ -1071,9 +1079,11 @@ _cairo_surface_fallback_mask (cairo_surface_t		*surface,
 	_cairo_pattern_get_extents (mask, &mask_extents);
 	if (! _cairo_rectangle_intersect (&extents, &mask_extents))
 	    return CAIRO_STATUS_SUCCESS;
+
+	is_bounded = TRUE;
     }
 
-    if (clip != NULL && _clip_contains_rectangle (clip, &extents))
+    if (is_bounded && clip != NULL && _clip_contains_rectangle (clip, &extents))
 	clip = NULL;
 
     status = _rectangle_intersect_clip (&extents, clip);
@@ -1112,12 +1122,15 @@ _cairo_surface_fallback_stroke (cairo_surface_t		*surface,
     is_bounded = _cairo_surface_get_extents (surface, &extents);
     assert (is_bounded || clip);
 
+    is_bounded = FALSE;
     if (_cairo_operator_bounded_by_source (op)) {
 	cairo_rectangle_int_t source_extents;
 
 	_cairo_pattern_get_extents (source, &source_extents);
 	if (! _cairo_rectangle_intersect (&extents, &source_extents))
 	    return CAIRO_STATUS_SUCCESS;
+
+	is_bounded = TRUE;
     }
 
     if (_cairo_operator_bounded_by_mask (op)) {
@@ -1128,9 +1141,11 @@ _cairo_surface_fallback_stroke (cairo_surface_t		*surface,
 						      &path_extents);
 	if (! _cairo_rectangle_intersect (&extents, &path_extents))
 	    return CAIRO_STATUS_SUCCESS;
+
+	is_bounded = TRUE;
     }
 
-    if (clip != NULL && _clip_contains_rectangle (clip, &extents))
+    if (is_bounded && clip != NULL && _clip_contains_rectangle (clip, &extents))
 	clip = NULL;
 
     status = _rectangle_intersect_clip (&extents, clip);
@@ -1140,7 +1155,7 @@ _cairo_surface_fallback_stroke (cairo_surface_t		*surface,
 	return status;
     }
 
-    status = _clip_to_boxes (&clip, &extents, &boxes, &num_boxes);
+    status = _clip_to_boxes (&clip, &extents, is_bounded, &boxes, &num_boxes);
     if (unlikely (status)) {
 	if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
 	    status = CAIRO_STATUS_SUCCESS;
@@ -1239,12 +1254,15 @@ _cairo_surface_fallback_fill (cairo_surface_t		*surface,
     is_bounded = _cairo_surface_get_extents (surface, &extents);
     assert (is_bounded || clip);
 
+    is_bounded = FALSE;
     if (_cairo_operator_bounded_by_source (op)) {
 	cairo_rectangle_int_t source_extents;
 
 	_cairo_pattern_get_extents (source, &source_extents);
 	if (! _cairo_rectangle_intersect (&extents, &source_extents))
 	    return CAIRO_STATUS_SUCCESS;
+
+	is_bounded = TRUE;
     }
 
     if (_cairo_operator_bounded_by_mask (op)) {
@@ -1253,15 +1271,19 @@ _cairo_surface_fallback_fill (cairo_surface_t		*surface,
 	_cairo_path_fixed_approximate_fill_extents (path, &path_extents);
 	if (! _cairo_rectangle_intersect (&extents, &path_extents))
 	    return CAIRO_STATUS_SUCCESS;
+
+	is_bounded = TRUE;
     }
 
-    if (clip != NULL && _clip_contains_rectangle (clip, &extents))
-	clip = NULL;
+    if (is_bounded) {
+	if (clip != NULL && _clip_contains_rectangle (clip, &extents))
+	    clip = NULL;
 
-    if (clip != NULL && clip->path->prev == NULL &&
-	_cairo_path_fixed_equal (&clip->path->path, path))
-    {
-	clip = NULL;
+	if (clip != NULL && clip->path->prev == NULL &&
+	    _cairo_path_fixed_equal (&clip->path->path, path))
+	{
+	    clip = NULL;
+	}
     }
 
     status = _rectangle_intersect_clip (&extents, clip);
@@ -1271,7 +1293,7 @@ _cairo_surface_fallback_fill (cairo_surface_t		*surface,
 	return status;
     }
 
-    status = _clip_to_boxes (&clip, &extents, &boxes, &num_boxes);
+    status = _clip_to_boxes (&clip, &extents, is_bounded, &boxes, &num_boxes);
     if (unlikely (status)) {
 	if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
 	    status = CAIRO_STATUS_SUCCESS;
@@ -1433,12 +1455,15 @@ _cairo_surface_fallback_show_glyphs (cairo_surface_t		*surface,
     is_bounded = _cairo_surface_get_extents (surface, &extents);
     assert (is_bounded || clip);
 
+    is_bounded = FALSE;
     if (_cairo_operator_bounded_by_source (op)) {
 	cairo_rectangle_int_t source_extents;
 
 	_cairo_pattern_get_extents (source, &source_extents);
 	if (! _cairo_rectangle_intersect (&extents, &source_extents))
 	    return CAIRO_STATUS_SUCCESS;
+
+	is_bounded = TRUE;
     }
 
     if (_cairo_operator_bounded_by_mask (op)) {
@@ -1454,9 +1479,11 @@ _cairo_surface_fallback_show_glyphs (cairo_surface_t		*surface,
 
 	if (! _cairo_rectangle_intersect (&extents, &glyph_extents))
 	    return CAIRO_STATUS_SUCCESS;
+
+	is_bounded = TRUE;
     }
 
-    if (clip != NULL && _clip_contains_rectangle (clip, &extents))
+    if (is_bounded && clip != NULL && _clip_contains_rectangle (clip, &extents))
 	clip = NULL;
 
     status = _rectangle_intersect_clip (&extents, clip);
commit 0ffca06d7feec6fdc56c47a378fcc37c1951a00a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 4 08:32:31 2009 +0100

    [perf] Use milliseconds by default in cairo-perf-diff-files
    
    Necessary when comparing performance reports from different machines (or
    even at different CPU states).

diff --git a/perf/cairo-perf-diff-files.c b/perf/cairo-perf-diff-files.c
index dddf684..2d3b085 100644
--- a/perf/cairo-perf-diff-files.c
+++ b/perf/cairo-perf-diff-files.c
@@ -39,7 +39,7 @@ typedef struct _cairo_perf_report_options {
     double min_change;
     int use_utf;
     int print_change_bars;
-    int use_ms;
+    int use_ticks;
 } cairo_perf_report_options_t;
 
 typedef struct _cairo_perf_diff_files_args {
@@ -180,7 +180,7 @@ test_diff_print_multi (test_diff_t			*diff,
 
     for (i = 0; i < diff->num_tests; i++) {
 	test_time = diff->tests[i]->stats.min_ticks;
-	if (options->use_ms)
+	if (! options->use_ticks)
 	    test_time /= diff->tests[i]->stats.ticks_per_ms;
 	change = diff->max / test_time;
 	printf ("%8s %6.2f: %5.2fx ",
@@ -266,7 +266,7 @@ cairo_perf_reports_compare (cairo_perf_report_t		*reports,
 		test_report_cmp_backend_then_name (tests[i], min_test) == 0)
 	    {
 		test_time = tests[i]->stats.min_ticks;
-		if (options->use_ms)
+		if (! options->use_ticks)
 		    test_time /= tests[i]->stats.ticks_per_ms;
 		if (diff->num_tests == 0) {
 		    diff->min = test_time;
@@ -294,7 +294,7 @@ cairo_perf_reports_compare (cairo_perf_report_t		*reports,
 	    }
 	    old_time = diff->tests[0]->stats.min_ticks;
 	    new_time = diff->tests[1]->stats.min_ticks;
-	    if (options->use_ms) {
+	    if (! options->use_ticks) {
 		old_time /= diff->tests[0]->stats.ticks_per_ms;
 		new_time /= diff->tests[1]->stats.ticks_per_ms;
 	    }
@@ -405,7 +405,10 @@ parse_args(int				  argc,
 	    args->options.print_change_bars = 0;
 	}
 	else if (strcmp (argv[i], "--use-ms") == 0) {
-	    args->options.use_ms = 1;
+	    /* default */
+	}
+	else if (strcmp (argv[i], "--use-ticks") == 0) {
+	    args->options.use_ticks = 1;
 	}
 	else if (strcmp (argv[i], "--min-change") == 0) {
 	    char *end = NULL;
commit 00ca0780b8f06ec160d8f969e316c21fbbde04bc
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Sep 3 23:25:53 2009 +0100

    [win32] Remove unused clone_similar()
    
    The win32 backend handles surface sources directly and never calls
    _cairo_pattern_acquire_surface() which is the only other possible user of
    clone_similar().

diff --git a/src/cairo-win32-printing-surface.c b/src/cairo-win32-printing-surface.c
index f4c384d..f20b5f9 100644
--- a/src/cairo-win32-printing-surface.c
+++ b/src/cairo-win32-printing-surface.c
@@ -1741,7 +1741,7 @@ static const cairo_surface_backend_t cairo_win32_printing_surface_backend = {
     NULL, /* release_source_image */
     NULL, /* acquire_dest_image */
     NULL, /* release_dest_image */
-    _cairo_win32_surface_clone_similar,
+    NULL, /* clone_similar */
     NULL, /* composite */
     NULL, /* fill_rectangles */
     NULL, /* composite_trapezoids */
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index d946dfe..69afa17 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -432,61 +432,6 @@ _cairo_win32_surface_create_similar (void	    *abstract_src,
 }
 
 cairo_status_t
-_cairo_win32_surface_clone_similar (void *abstract_surface,
-				    cairo_surface_t *src,
-				    cairo_content_t content,
-				    int src_x,
-				    int src_y,
-				    int width,
-				    int height,
-				    int *clone_offset_x,
-				    int *clone_offset_y,
-				    cairo_surface_t **clone_out)
-{
-    cairo_content_t src_content;
-    cairo_surface_t *new_surface;
-    cairo_status_t status;
-    cairo_surface_pattern_t pattern;
-
-    src_content = src->content & content;
-    new_surface =
-	_cairo_win32_surface_create_similar_internal (abstract_surface,
-						      src_content,
-						      width, height,
-						      FALSE);
-    if (new_surface == NULL)
-	return CAIRO_INT_STATUS_UNSUPPORTED;
-
-    status = new_surface->status;
-    if (status)
-	return status;
-
-    _cairo_pattern_init_for_surface (&pattern, src);
-
-    status = _cairo_surface_composite (CAIRO_OPERATOR_SOURCE,
-				       &pattern.base,
-				       NULL,
-				       new_surface,
-				       src_x, src_y,
-				       0, 0,
-				       0, 0,
-				       width, height,
-				       NULL);
-
-    _cairo_pattern_fini (&pattern.base);
-
-    if (status == CAIRO_STATUS_SUCCESS) {
-	*clone_offset_x = src_x;
-	*clone_offset_y = src_y;
-	*clone_out = new_surface;
-    } else
-	cairo_surface_destroy (new_surface);
-
-    return status;
-}
-
-
-cairo_status_t
 _cairo_win32_surface_finish (void *abstract_surface)
 {
     cairo_win32_surface_t *surface = abstract_surface;
@@ -2069,7 +2014,7 @@ static const cairo_surface_backend_t cairo_win32_surface_backend = {
     _cairo_win32_surface_release_source_image,
     _cairo_win32_surface_acquire_dest_image,
     _cairo_win32_surface_release_dest_image,
-    _cairo_win32_surface_clone_similar,
+    NULL, /* clone similar */
     _cairo_win32_surface_composite,
     _cairo_win32_surface_fill_rectangles,
     NULL, /* composite_trapezoids */


More information about the cairo-commit mailing list