summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Pacaud <emmanuel.pacaud@free.fr>2006-05-01 22:01:38 +0200
committerEmmanuel Pacaud <emmanuel.pacaud@free.fr>2006-05-01 22:01:38 +0200
commit6a33993b1510d1c0d311f4a10832ab2bc5ea8f4e (patch)
tree2ac7f305dd98f8723cd4dcd5fb39967cef6e326d
parentb920dfd3df7ac1a0e49b7417b710f111a3780700 (diff)
parent3aa5d76d23ad9005d296fbb852e75924b0933c82 (diff)
Merge branch 'origin'
-rw-r--r--ROADMAP245
-rw-r--r--src/Makefile.am3
-rw-r--r--src/cairo-image-surface.c3
-rw-r--r--src/cairo-meta-surface-private.h3
-rw-r--r--src/cairo-meta-surface.c14
-rw-r--r--src/cairo-paginated-surface.c11
-rw-r--r--src/cairo-pdf-surface.c7
-rw-r--r--src/cairo-ps-surface.c30
-rw-r--r--src/cairo-win32-private.h8
-rw-r--r--src/cairo.c10
-rw-r--r--test/.gitignore2
-rw-r--r--test/Makefile.am129
-rw-r--r--test/a8-mask-rgb24-ref.pngbin128 -> 0 bytes
-rw-r--r--test/cairo-test.c20
-rw-r--r--test/caps-joins-alpha-rgb24-ref.pngbin2283 -> 0 bytes
-rw-r--r--test/caps-joins-rgb24-ref.pngbin1398 -> 0 bytes
-rw-r--r--test/caps-sub-paths-rgb24-ref.pngbin186 -> 0 bytes
-rw-r--r--test/clip-all-rgb24-ref.pngbin114 -> 0 bytes
-rw-r--r--test/composite-integer-translate-over-repeat-rgb24-ref.pngbin353 -> 0 bytes
-rw-r--r--test/composite-integer-translate-over-rgb24-ref.pngbin13041 -> 0 bytes
-rw-r--r--test/composite-integer-translate-source-rgb24-ref.pngbin14017 -> 0 bytes
-rw-r--r--test/create-from-png-rgb24-ref.pngbin115 -> 0 bytes
-rw-r--r--test/create-from-png-stream-rgb24-ref.pngbin115 -> 0 bytes
-rw-r--r--test/dash-caps-joins-rgb24-ref.pngbin2465 -> 0 bytes
-rw-r--r--test/dash-offset-negative-rgb24-ref.pngbin170 -> 0 bytes
-rw-r--r--test/filter-nearest-offset-rgb24-ref.pngbin254 -> 0 bytes
-rw-r--r--test/imagediff.c15
-rw-r--r--test/leaky-dash-ref.pngbin0 -> 241 bytes
-rw-r--r--test/leaky-dash.c68
-rw-r--r--test/leaky-polygon-rgb24-ref.pngbin344 -> 0 bytes
-rw-r--r--test/line-width-rgb24-ref.pngbin199 -> 0 bytes
-rw-r--r--test/line-width-scale-ps-argb32-ref.pngbin0 -> 1470 bytes
-rw-r--r--test/line-width-scale-ref.pngbin0 -> 4884 bytes
-rw-r--r--test/line-width-scale.c184
-rw-r--r--test/linear-gradient-rgb24-ref.pngbin11700 -> 0 bytes
-rw-r--r--test/mask.c3
-rw-r--r--test/move-to-show-surface-rgb24-ref.pngbin115 -> 0 bytes
-rw-r--r--test/paint-rgb24-ref.pngbin116 -> 0 bytes
-rw-r--r--test/paint-source-alpha-rgb24-ref.pngbin248 -> 0 bytes
-rw-r--r--test/paint-with-alpha-rgb24-ref.pngbin255 -> 0 bytes
-rw-r--r--test/path-data-rgb24-ref.pngbin523 -> 0 bytes
-rw-r--r--test/rectangle-rounding-error-rgb24-ref.pngbin298 -> 0 bytes
-rw-r--r--test/self-copy-rgb24-ref.pngbin291 -> 0 bytes
-rw-r--r--test/show-glyphs-many-rgb24-ref.pngbin115 -> 0 bytes
-rw-r--r--test/show-text-current-point-rgb24-ref.pngbin2173 -> 0 bytes
-rw-r--r--test/source-clip-rgb24-ref.pngbin180 -> 0 bytes
-rw-r--r--test/surface-pattern-rgb24-ref.pngbin194 -> 0 bytes
-rw-r--r--test/text-antialias-gray-rgb24-ref.pngbin995 -> 0 bytes
-rw-r--r--test/text-antialias-none-rgb24-ref.pngbin284 -> 0 bytes
-rw-r--r--test/text-antialias-subpixel-rgb24-ref.pngbin1121 -> 0 bytes
-rw-r--r--test/transforms-rgb24-ref.pngbin318 -> 0 bytes
-rw-r--r--test/translate-show-surface-rgb24-ref.pngbin115 -> 0 bytes
-rw-r--r--test/unantialiased-shapes-rgb24-ref.pngbin4449 -> 0 bytes
53 files changed, 487 insertions, 268 deletions
diff --git a/ROADMAP b/ROADMAP
index b8e410f27..8654bbd38 100644
--- a/ROADMAP
+++ b/ROADMAP
@@ -1,160 +1,177 @@
-cairo 1.0.4? bug fixes (I don't know if this release will be needed
-or not, but I wanted a place to lodge a bug that slipped from 1.0.2
-===================================================================
-For each bug number XXXX below, see:
-https://bugs.freedesktop.org/show_bug.cgi?id=XXXX
- 4630 Fonts too large when drawing to image surface while printing
- 4863 stroking problems with wide dashed lines
-
-cairo 1.2.0 essential features (targeted for 2006-03-08)
-The release won't happen without these being complete.
+This is the cairo roadmap.
+
+Everything here is subject to change, but it is hoped that all of it
+will be useful. If you want to influence, please feel free to get
+involved with cairo (see http://cairographics.org ).
+
+The intent is for this to be a living document. We want both the users
+of cairo, (GTK+, GNOME, Mozilla, Mono, etc. etc.) to let us know
+features they need and dates by which they are needed so that we can
+use those to guide our plans.
+
+Additionally, people who are actively developing cairo itself should
+regularly update this document to reflect their current plans. If you
+don't want to see a particular release happen without some essential
+feature, then put that feature on the list and put your name next to
+it to indicate you are working on it.
+
+Targets
+=======
+GTK+ 2.10 - http://www.gtk.org/plan/2.10/
+------------------------------------------
+The 2.10 release is scheduled for May 2006, (to be in time for GNOME 2.16).
+
+Satisfying GTK+ 2.10 well requires releasing cairo 1.2 with good
+printing support, (good PS/PDF output, per-page sizing and layout,
+etc.) sometime in April 2006.
+
+
+Firefox 3.0 - http://www.mozilla.org/projects/firefox/roadmap.html
+------------------------------------------------------------------
+Firefox 3 (scheduled for early 2007?) is the first release expected to
+use cairo for all rendering. In the meantime, development builds using
+cairo are available
+
+Satisfying firefox 3 well requiring releasing new versions of cairo in
+2006 that incorporate the patches coming from mozilla, (device offset,
+push/pop_group), and much-improved performance.
+
+Themes and Schedules
+====================
+cairo-1.2 (April 2006): Better printing
+ - Supported PS/PDF output
+ - New, printing-oriented API
+ - Mozilla patches? (device offset, push/pop_group)
+
+cairo-1.x (October 2006): Better performance
+ - New tessellator
+ - New rasterization
+ - Mozilla patches
+
+And there is room for other releases between those as needed. Once the
+mozilla patches land, we don't really have a lot of new API on the
+roadmap so it's hard to know whether any other releases would be 1.4
+vs. 1.2.2, etc.
+
+cairo 1.2.0 essential features
+We don't expect to release without these being complete.
========================================================
- A. PS backend
- ----------
- ✓1. Mark PS backend as supported:
-
+ PDF backend
+ ✓1. Mark PDF backend as supported
✓a. Incorporate into test suite
-
✓b. Correct output for the entire test suite
- 2. Image fallbacks at finer-than-whole-page granularity
-
+ 2. Reasonable, native output for common uses
✓a. Switch to using cairo_paginated_surface_t
+ ✓b. Opaque text and images are all native
+ ✓c. Translucent objects (using OVER) are also native
+ d. Text output uses PDF font features
+
+ Printing-oriented API
+ 1. Per-page settings (paper size, layout, anything else?)
+ 2. Document metadata
+
+ Mozilla needs
+ 1. Device-offset rework
+ 2. Push/pop_group
+
+ Bug fixes (For each XXXX, see: https://bugs.freedesktop.org/show_bug.cgi?id=XXXX )
+ 4630 Fonts too large when drawing to image surface while printing
+ 4863 stroking problems with wide dashed lines
+ FC_GLOBAL_ADVANCE (http://lists.freedesktop.org/archives/cairo/2005-August/004893.html)
+ 4705 crash at XRenderAddGlyphs
+ cairo_{ps,pdf}_surface_set_dpi have no effect
+ cairo_set_line_width should immediately use CTM
+ _transform_glyph_bitmap http://lists.freedesktop.org/archives/cairo/2005-October/005564.html
+ 6759 fontconfig option AntiAlias doesn't work in cairo 1.1.2
+
+ Fix memory leaks
+ 1. Ensure 'make check-valgrind' passes with no leaks
- b. Add analysis and clever replay to
- cairo_paginated_surface_t
-
- B. PDF backend
- -----------
- ✓1. Mark PDF backend as supported
+ Performance improvements
+ ✓1. Speed up glyph measurement (cache rewrite)
+ 2. Speed up gradient computations
+ ✓a. Better software gradients
+ b. Use X server gradients when available
+✓PS backend
+ ✓1. Mark PS backend as supported:
✓a. Incorporate into test suite
+ ✓b. Correct output for the entire test suite
- ✓b. Correct output for the entire test suite (use image
- fallbacks as necessary).
-
- 2. Image fallbacks at finer-than-whole-page granularity
-
+ ✓2. Reasonable, native output for common uses
✓a. Switch to using cairo_paginated_surface_t
+ ✓b. Opaque text and images are all native
+ ✓c. Text output uses PostScript font features
- b. Add analysis and clever replay to
- cairo_paginated_surface_t
-
- E. Fix memory leaks
- ----------------
- 1. Ensure 'make check-valgrind' passes with no leaks
+✓Pango needs
+ ✓5496 Add getters for cairo_scaled_font_t
+ ✓5495 Need cairo_scaled_font_text_extents
- H. Mozilla patches (at the very least, these need a response)
- ----------------------------------------------------------
- 1. Misc compilation fixes for pixman (submitted upstream)
- 2. mac compilation fix for cairo-atsui-font.c for 10.2 SDK (maybe should
- be upstream?)
- 3. Make mark_dirty() reset a surface's clip, so that we can call it
- when we RestoreDC() after native win32 drawing (submitted upstream)
- 4. Rework win32 surface clip and extents handling for correctness
- (submitted upstream)
- 5. Add GdiFlush() calls before each image surface get
- (Submitted upstream: https://bugs.freedesktop.org/show_bug.cgi?id=5845)
- 6. Move device offset/scale handling into surface layer; large rework
- of device offset/scale. (submitted upstream)
- 7. push-pop-group.patch (Updated 9 Feb 06)
- Implementation of push/pop group API; depends on device-offset-scale.
- (submitted upstream)
+✓SVG backend
+ ✓1. Add experimental SVG backend
+ ✓2. Incorporate into test suite
-cairo 1.2.0 desired features (targeted for 2006-01-13)
+cairo 1.2.0 desired features
If these aren't ready, they won't be in the release.
-[There are some bugs that need to be added here, and
- some bugs that should be bumped up into the essential
- features section.]
======================================================
-
- C. Win32 backend
- -------------
+ Win32 backend
✓1. Incorporate into test suite
-
2. Correct output for the entire suite
a. self-copy
b. trap-clip
-
[There is some mailing-list discussion about possible fixes
for these.]
- D. Bug fixes
- ---------
- ✓1. Fix dashed splines.
+ Mozilla patches
+ 1. Misc compilation fixes for pixman (submitted upstream)
+ 2. mac compilation fix for cairo-atsui-font.c for 10.2 SDK (maybe should
+ be upstream?)
+ 3. Make mark_dirty() reset a surface's clip, so that we can call it
+ when we RestoreDC() after native win32 drawing (submitted upstream)
+ 4. Rework win32 surface clip and extents handling for correctness
+ (submitted upstream)
+ 5. Add GdiFlush() calls before each image surface get
+ (Submitted upstream: https://bugs.freedesktop.org/show_bug.cgi?id=5845)
+ Bug fixes
2. Fix some expected failures (XFAIL) in the test suite
-
a. a8-mask
-
✓b. clip-all
-
c. filter-nearest-offset
-
d. pixman-rotate
-
e. extend-reflect
- E. API Additions
- -------------
- 1. cairo_begin/end/get_group
- Status: cworth has a posted a preliminary patch, and keithp,
- krh, and otaylor answered all the tough questions it
- raised. There's not much work left to finish this one.
- Vladimir Vukicevic has taken up the torch on this and
- has posted an almost-complete set of patches.
-
- 2. The pango developers need one or two additions in order to
- implement pango's hex-box drawing.
-
- 5496 Add getters for cairo_scaled_font_t
- - This looks trivial, and is maybe "enough" for an ugly
- solution in pango.
-
- 5495 Need cairo_scaled_font_text_extents
- - I think I would actually prefer to add
- cairo_text_to_glyphs for this fix.
-
- F. Performance improvements
- ------------------------
- 1. Cull and trim trapezoids outside clip region bounds
+ New API
+ cairo_arc_to
+ see http://lists.freedesktop.org/archives/cairo/2005-August/004801.html
+ or see arc_to branch in bedhad's repository
+ Performance improvements
+ 1. Cull and trim trapezoids outside clip region bounds
2. Generate more large pixel-aligned, rectangular trapezoids
- ✓3. Speed up glyph measurement (cache rewrite)
-
- ✓4. Speed up gradient computations
-
- G. SVG backend
- -----------
- ✓1. Add experimental SVG backend
+Longer-term desired stuff for cairo (not scheduled for any particular release)
+==============================================================================
+ PS/PDF improvements
+ 1. Make image fallbacks finer-grained than a whole page
+ 2. Ensure that PDF text output is "selectable"
-cairo 1.4.0 desired features (Schedule unknown)
-===============================================
- A. Quartz backend (maintainer needed!)
- -----------------------------------
+ Quartz backend (maintainer needed!)
1. Mark Quartz backend as supported:
-
a. Incorporate into test suite
-
b. Correct output for the entire suite
- B. SVG backend
- -----------
- 1. Mark SVG backend as supported
-
- a. Incorporate into test suite
-
- b. Correct output for the entire suite
+ SVG backend
+ 1. Correct output for the entire test suite
- B. Performance improvements
- ------------------------
+ Performance improvements
1. New tessellator (more robust and faster)
- C. Bug fixes
- ---------
+ Bug fixes
1. Fix all expected failures (XFAIL) in the test suite
a. self-intersecting
AKA. https://bugs.freedesktop.org/show_bug.cgi?id=3752
Fix depends on [A1].
+ b. text-rotate
diff --git a/src/Makefile.am b/src/Makefile.am
index a74338f04..0aa6e218d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -207,9 +207,6 @@ libcairo_la_LIBADD = $(top_builddir)/pixman/src/libpixman.la $(CAIRO_LIBS) $(noi
libcairo_la_DEPENDENCIES = $(cairo_def_dependency) $(top_builddir)/pixman/src/libpixman.la $(noinst_LTLIBRARIES)
-EXTRA_DIST = \
- cairo.def
-
cairo.def: $(cairo_win32_api_headers)
(echo EXPORTS; \
cat $(cairo_win32_api_headers) | \
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index cef455b64..adf2e7c49 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -271,6 +271,9 @@ _cairo_image_surface_create_with_content (cairo_content_t content,
* This function always returns a valid pointer, but it will return a
* pointer to a "nil" surface if an error such as out of memory
* occurs. You can use cairo_surface_status() to check for this.
+ *
+ * See cairo_surface_set_user_data() for a means of attaching a
+ * destroy-notification fallback to the surface if necessary.
**/
cairo_surface_t *
cairo_image_surface_create_for_data (unsigned char *data,
diff --git a/src/cairo-meta-surface-private.h b/src/cairo-meta-surface-private.h
index eafe3f441..24b1b4706 100644
--- a/src/cairo-meta-surface-private.h
+++ b/src/cairo-meta-surface-private.h
@@ -137,6 +137,9 @@ typedef struct _cairo_meta_surface {
cairo_array_t commands;
cairo_surface_t *commands_owner;
+
+ cairo_bool_t is_clipped;
+ int replay_start_idx;
} cairo_meta_surface_t;
cairo_private cairo_surface_t *
diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c
index f7aeb719c..f02f0a7f8 100644
--- a/src/cairo-meta-surface.c
+++ b/src/cairo-meta-surface.c
@@ -81,6 +81,9 @@ _cairo_meta_surface_create (cairo_content_t content,
_cairo_array_init (&meta->commands, sizeof (cairo_command_t *));
meta->commands_owner = NULL;
+ meta->is_clipped = FALSE;
+ meta->replay_start_idx = 0;
+
return &meta->base;
}
@@ -226,6 +229,12 @@ _cairo_meta_surface_paint (void *abstract_surface,
cairo_meta_surface_t *meta = abstract_surface;
cairo_command_paint_t *command;
+ /* An optimisation that takes care to not replay what was done
+ * before surface is cleared. We don't erase recorded commands
+ * since we may have earlier snapshots of this surface. */
+ if (op == CAIRO_OPERATOR_CLEAR && !meta->is_clipped)
+ meta->replay_start_idx = meta->commands.num_elements;
+
command = malloc (sizeof (cairo_command_paint_t));
if (command == NULL)
return CAIRO_STATUS_NO_MEMORY;
@@ -473,6 +482,7 @@ _cairo_meta_surface_snapshot (void *abstract_other)
meta->width_pixels = other->width_pixels;
meta->height_pixels = other->height_pixels;
+ meta->replay_start_idx = other->replay_start_idx;
_cairo_array_init_snapshot (&meta->commands, &other->commands);
meta->commands_owner = cairo_surface_reference (&other->base);
@@ -504,8 +514,10 @@ _cairo_meta_surface_intersect_clip_path (void *dst,
return status;
}
command->path_pointer = &command->path;
+ meta->is_clipped = TRUE;
} else {
command->path_pointer = NULL;
+ meta->is_clipped = FALSE;
}
command->fill_rule = fill_rule;
command->tolerance = tolerance;
@@ -610,7 +622,7 @@ _cairo_meta_surface_replay (cairo_surface_t *surface,
num_elements = meta->commands.num_elements;
elements = _cairo_array_index (&meta->commands, 0);
- for (i = 0; i < num_elements; i++) {
+ for (i = meta->replay_start_idx; i < num_elements; i++) {
command = elements[i];
switch (command->type) {
case CAIRO_COMMAND_PAINT:
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index b8395561a..080102b01 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -79,12 +79,6 @@ const cairo_private cairo_surface_backend_t cairo_paginated_surface_backend;
static cairo_int_status_t
_cairo_paginated_surface_show_page (void *abstract_surface);
-/* XXX: This would seem the natural thing to do here. But currently,
- * PDF and PS surfaces do not yet work as source surfaces. So instead,
- * we don't implement create_similar for the paginate_surface which
- * means that any create_similar() call on a paginated_surfacae will
- * result in a new image surface. */
-#if 0
static cairo_surface_t *
_cairo_paginated_surface_create_similar (void *abstract_surface,
cairo_content_t content,
@@ -95,7 +89,6 @@ _cairo_paginated_surface_create_similar (void *abstract_surface,
return cairo_surface_create_similar (surface->target, content,
width, height);
}
-#endif
cairo_surface_t *
_cairo_paginated_surface_create (cairo_surface_t *target,
@@ -241,6 +234,8 @@ _paint_page (cairo_paginated_surface_t *surface)
{
_cairo_meta_surface_replay (surface->meta, surface->target);
}
+
+ cairo_surface_destroy (analysis);
return CAIRO_STATUS_SUCCESS;
}
@@ -469,7 +464,7 @@ _cairo_paginated_surface_snapshot (void *abstract_other)
const cairo_surface_backend_t cairo_paginated_surface_backend = {
CAIRO_INTERNAL_SURFACE_TYPE_PAGINATED,
- NULL, /* create_similar --- see note for _cairo_paginated_surface_create_similar */
+ _cairo_paginated_surface_create_similar,
_cairo_paginated_surface_finish,
_cairo_paginated_surface_acquire_source_image,
_cairo_paginated_surface_release_source_image,
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 93a8217e0..4d557aaf9 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -456,10 +456,11 @@ _cairo_pdf_surface_create_similar (void *abstract_src,
int width,
int height)
{
- cairo_pdf_surface_t *template = abstract_src;
+ cairo_format_t format = _cairo_format_from_content (content);
- return _cairo_pdf_surface_create_for_document (template->document,
- width, height);
+ /* Just return an image for now, until PDF surface can be used
+ * as source. */
+ return cairo_image_surface_create (format, width, height);
}
static cairo_pdf_stream_t *
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index cf77db206..31498a83f 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -762,6 +762,19 @@ _word_wrap_stream_write (void *closure,
return _cairo_output_stream_get_status (stream->output);
}
+static cairo_status_t
+_word_wrap_stream_close (void *closure)
+{
+ cairo_status_t status;
+ word_wrap_stream_t *stream = closure;
+
+ status = _cairo_output_stream_get_status (stream->output);
+
+ free (stream);
+
+ return status;
+}
+
static cairo_output_stream_t *
_word_wrap_stream_create (cairo_output_stream_t *output, int max_column)
{
@@ -777,7 +790,20 @@ _word_wrap_stream_create (cairo_output_stream_t *output, int max_column)
stream->last_write_was_space = FALSE;
return _cairo_output_stream_create (_word_wrap_stream_write,
- NULL, stream);
+ _word_wrap_stream_close, stream);
+}
+
+static cairo_surface_t *
+_cairo_ps_surface_create_similar (void *abstract_src,
+ cairo_content_t content,
+ int width,
+ int height)
+{
+ cairo_format_t format = _cairo_format_from_content (content);
+
+ /* Just return an image for now, until PS surface can be used
+ * as source. */
+ return cairo_image_surface_create (format, width, height);
}
static cairo_status_t
@@ -1634,7 +1660,7 @@ _cairo_ps_surface_set_paginated_mode (void *abstract_surface,
static const cairo_surface_backend_t cairo_ps_surface_backend = {
CAIRO_SURFACE_TYPE_PS,
- NULL, /* create_similar */
+ _cairo_ps_surface_create_similar,
_cairo_ps_surface_finish,
NULL, /* acquire_source_image */
NULL, /* release_source_image */
diff --git a/src/cairo-win32-private.h b/src/cairo-win32-private.h
index fd6642413..42fafe442 100644
--- a/src/cairo-win32-private.h
+++ b/src/cairo-win32-private.h
@@ -39,6 +39,14 @@
#include <cairo-win32.h>
#include <cairoint.h>
+#ifndef SHADEBLENDCAPS
+#define SHADEBLENDCAPS 120
+#endif
+#ifndef SB_NONE
+#define SB_NONE 0
+#endif
+
+
typedef struct _cairo_win32_surface {
cairo_surface_t base;
diff --git a/src/cairo.c b/src/cairo.c
index 0f35fa674..70f14066d 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -623,9 +623,9 @@ cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule)
*
* Sets the current line width within the cairo context. The line
* width specifies the diameter of a pen that is circular in
- * user-space.
+ * user space.
*
- * As with the other stroke parameters, the current line cap style is
+ * As with the other stroke parameters, the current line width is
* examined by cairo_stroke(), cairo_stroke_extents(), and
* cairo_stroke_to_path(), but does not have any effect during path
* construction.
@@ -1131,9 +1131,9 @@ cairo_curve_to (cairo_t *cr,
* arc.
*
* Angles are measured in radians. An angle of 0.0 is in the direction
- * of the positive X axis (in user-space). An angle of %M_PI/2.0 radians
+ * of the positive X axis (in user space). An angle of %M_PI/2.0 radians
* (90 degrees) is in the direction of the positive Y axis (in
- * user-space). Angles increase in the direction from the positive X
+ * user space). Angles increase in the direction from the positive X
* axis toward the positive Y axis. So with the default transformation
* matrix, angles increase in a clockwise direction.
*
@@ -1144,7 +1144,7 @@ cairo_curve_to (cairo_t *cr,
* see cairo_arc_negative() to get the arc in the direction of
* decreasing angles.
*
- * The arc is circular in user-space. To achieve an elliptical arc,
+ * The arc is circular in user space. To achieve an elliptical arc,
* you can scale the current transformation matrix by different
* amounts in the X and Y directions. For example, to draw an ellipse
* in the box given by @x, @y, @width, @height:
diff --git a/test/.gitignore b/test/.gitignore
index 5ec879868..5ffa61d78 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -30,8 +30,10 @@ font-face-get-type
get-and-set
gradient-alpha
imagediff
+leaky-dash
leaky-polygon
line-width
+line-width-scale
linear-gradient
mask
mask-ctm
diff --git a/test/Makefile.am b/test/Makefile.am
index e4ca68e44..3d459c471 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -25,8 +25,10 @@ filter-nearest-offset \
font-face-get-type \
get-and-set \
gradient-alpha \
+leaky-dash \
leaky-polygon \
line-width \
+line-width-scale \
linear-gradient \
mask \
mask-ctm \
@@ -111,15 +113,10 @@ endif
# way to avoid it? Can I use a wildcard here?
EXTRA_DIST = \
a8-mask-ref.png \
-a8-mask-rgb24-ref.png \
caps-joins-ref.png \
-caps-joins-rgb24-ref.png \
caps-joins-alpha-ref.png \
-caps-joins-alpha-rgb24-ref.png \
caps-sub-paths-ref.png \
-caps-sub-paths-rgb24-ref.png \
clip-all-ref.png \
-clip-all-rgb24-ref.png \
clip-fill-rule-ref.png \
clip-fill-rule-pixel-aligned-ref.png \
clip-nesting-ref.png \
@@ -130,18 +127,11 @@ clip-twice-ref.png \
clip-twice-rgb24-ref.png \
composite-integer-translate-over-ref.png \
composite-integer-translate-over-repeat-ref.png \
-composite-integer-translate-over-repeat-rgb24-ref.png \
-composite-integer-translate-over-rgb24-ref.png \
composite-integer-translate-source-ref.png \
-composite-integer-translate-source-rgb24-ref.png \
create-from-png-ref.png \
-create-from-png-rgb24-ref.png \
create-from-png-stream-ref.png \
-create-from-png-stream-rgb24-ref.png \
dash-caps-joins-ref.png \
-dash-caps-joins-rgb24-ref.png \
dash-offset-negative-ref.png \
-dash-offset-negative-rgb24-ref.png \
dash-zero-length-ref.png \
dash-zero-length-rgb24-ref.png \
fill-and-stroke-ref.png \
@@ -149,15 +139,13 @@ fill-and-stroke-rgb24-ref.png \
fill-rule-ref.png \
fill-rule-rgb24-ref.png \
filter-nearest-offset-ref.png \
-filter-nearest-offset-rgb24-ref.png \
gradient-alpha-ref.png \
gradient-alpha-rgb24-ref.png \
+leaky-dash-ref.png \
leaky-polygon-ref.png \
-leaky-polygon-rgb24-ref.png \
linear-gradient-ref.png \
-linear-gradient-rgb24-ref.png \
line-width-ref.png \
-line-width-rgb24-ref.png \
+line-width-scale-ref.png \
mask-ctm-ref.png \
mask-ctm-rgb24-ref.png \
mask-ref.png \
@@ -165,7 +153,6 @@ mask-rgb24-ref.png \
mask-surface-ctm-ref.png \
mask-surface-ctm-rgb24-ref.png \
move-to-show-surface-ref.png \
-move-to-show-surface-rgb24-ref.png \
new-sub-path-ref.png \
new-sub-path-rgb24-ref.png \
nil-surface-ref.png \
@@ -175,53 +162,39 @@ operator-clear-rgb24-ref.png \
operator-source-ref.png \
operator-source-rgb24-ref.png \
paint-ref.png \
-paint-rgb24-ref.png \
paint-source-alpha-ref.png \
-paint-source-alpha-rgb24-ref.png \
paint-with-alpha-ref.png \
-paint-with-alpha-rgb24-ref.png \
path-data-ref.png \
-path-data-rgb24-ref.png \
pixman-rotate-ref.png \
pixman-rotate-rgb24-ref.png \
rectangle-rounding-error-ref.png \
-rectangle-rounding-error-rgb24-ref.png \
rel-path-ref.png \
rel-path-rgb24-ref.png \
romedalen.png \
scale-source-surface-paint-ref.png \
scale-source-surface-paint-rgb24-ref.png \
self-copy-ref.png \
-self-copy-rgb24-ref.png \
self-intersecting-ref.png \
self-intersecting-rgb24-ref.png \
set-source-ref.png \
set-source-rgb24-ref.png \
+show-glyphs-many-ref.png \
show-text-current-point-ref.png \
-show-text-current-point-rgb24-ref.png \
source-clip-ref.png \
-source-clip-rgb24-ref.png \
source-surface-scale-paint-ref.png \
source-surface-scale-paint-rgb24-ref.png \
surface-pattern-ref.png \
-surface-pattern-rgb24-ref.png \
text-antialias-gray-ref.png \
-text-antialias-gray-rgb24-ref.png \
text-antialias-none-ref.png \
-text-antialias-none-rgb24-ref.png \
text-antialias-subpixel-ref.png \
-text-antialias-subpixel-rgb24-ref.png \
text-pattern-ref.png \
text-pattern-rgb24-ref.png \
text-rotate-rgb24-ref.png \
transforms-ref.png \
-transforms-rgb24-ref.png \
translate-show-surface-ref.png \
-translate-show-surface-rgb24-ref.png \
trap-clip-ref.png \
trap-clip-rgb24-ref.png \
unantialiased-shapes-ref.png \
-unantialiased-shapes-rgb24-ref.png \
unbounded-operator-ref.png \
unbounded-operator-rgb24-ref.png
@@ -284,109 +257,31 @@ if CAIRO_HAS_DIRECTFB_SURFACE
libcairotest_la_SOURCES += cairo-test-directfb.c cairo-test-directfb.h
endif
-LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la
+LDADD = libcairotest.la $(top_builddir)/src/libcairo.la
if CAIRO_CAN_TEST_GLITZ_AGL_SURFACE
-LDADDS += $(GLITZ_AGL_LIBS)
+LDADD += $(GLITZ_AGL_LIBS)
endif
if CAIRO_CAN_TEST_GLITZ_EGL_SURFACE
-LDADDS += $(GLITZ_EGL_LIBS)
+LDADD += $(GLITZ_EGL_LIBS)
endif
if CAIRO_CAN_TEST_GLITZ_GLX_SURFACE
-LDADDS += $(GLITZ_GLX_LIBS)
+LDADD += $(GLITZ_GLX_LIBS)
endif
if CAIRO_CAN_TEST_GLITZ_WGL_SURFACE
-LDADDS += $(GLITZ_WGL_LIBS)
+LDADD += $(GLITZ_WGL_LIBS)
endif
if HAVE_PTHREAD
-LDADDS += -lpthread
+LDADD += -lpthread
endif
-# ARGH! I have to repeat the list of tests a third time. Maybe it's
-# time to break down and auto-generate the Makefile.am or something
-# from autogen.sh. My, but this is painful...
-a8_mask_LDADD = $(LDADDS)
-caps_joins_LDADD = $(LDADDS)
-caps_joins_alpha_LDADD = $(LDADDS)
-caps_sub_paths_LDADD = $(LDADDS)
-clip_all_LDADD = $(LDADDS)
-clip_fill_rule_LDADD = $(LDADDS)
-clip_fill_rule_pixel_aligned_LDADD = $(LDADDS)
-clip_nesting_LDADD = $(LDADDS)
-clip_operator_LDADD = $(LDADDS)
-clip_twice_LDADD = $(LDADDS)
-composite_integer_translate_source_LDADD = $(LDADDS)
-composite_integer_translate_over_LDADD = $(LDADDS)
-composite_integer_translate_over_repeat_LDADD = $(LDADDS)
-create_from_png_LDADD = $(LDADDS)
-create_from_png_stream_LDADD = $(LDADDS)
-dash_caps_joins_LDADD = $(LDADDS)
-dash_offset_negative_LDADD = $(LDADDS)
-dash_zero_length_LDADD = $(LDADDS)
-extend_reflect_LDADD = $(LDADDS)
-fill_and_stroke_LDADD = $(LDADDS)
-fill_rule_LDADD = $(LDADDS)
-font_face_get_type_LDADD = $(LDADDS)
-filter_nearest_offset_LDADD = $(LDADDS)
-ft_font_create_for_ft_face_LDADD = $(LDADDS)
-get_and_set_LDADD = $(LDADDS)
-gradient_alpha_LDADD = $(LDADDS)
-leaky_polygon_LDADD = $(LDADDS)
-line_width_LDADD = $(LDADDS)
-linear_gradient_LDADD = $(LDADDS)
-mask_LDADD = $(LDADDS)
-mask_ctm_LDADD = $(LDADDS)
-mask_surface_ctm_LDADD = $(LDADDS)
-multi_page_LDADD = $(LDADDS)
-move_to_show_surface_LDADD = $(LDADDS)
-new_sub_path_LDADD = $(LDADDS)
-nil_surface_LDADD = $(LDADDS)
-operator_clear_LDADD = $(LDADDS)
-operator_source_LDADD = $(LDADDS)
-paint_LDADD = $(LDADDS)
-paint_source_alpha_LDADD = $(LDADDS)
-paint_with_alpha_LDADD = $(LDADDS)
-path_data_LDADD = $(LDADDS)
-pattern_get_type_LDADD = $(LDADDS)
-svg_surface_LDADD = $(LDADDS)
-svg_clip_LDADD = $(LDADDS)
-pixman_rotate_LDADD = $(LDADDS)
-pthread_show_text_LDADD = $(LDADDS)
-rectangle_rounding_error_LDADD = $(LDADDS)
-scale_source_surface_paint_LDADD = $(LDADDS)
-select_font_no_show_text_LDADD = $(LDADDS)
-self_copy_LDADD = $(LDADDS)
-self_intersecting_LDADD = $(LDADDS)
-set_source_LDADD = $(LDADDS)
-show_text_current_point_LDADD = $(LDADDS)
-source_clip_LDADD = $(LDADDS)
-source_surface_scale_paint_LDADD = $(LDADDS)
-surface_finish_twice_LDADD = $(LDADDS)
-surface_pattern_LDADD = $(LDADDS)
-text_antialias_gray_LDADD = $(LDADDS)
-text_antialias_none_LDADD = $(LDADDS)
-text_antialias_subpixel_LDADD = $(LDADDS)
-text_cache_crash_LDADD = $(LDADDS)
-text_pattern_LDADD = $(LDADDS)
-text_rotate_LDADD = $(LDADDS)
-transforms_LDADD = $(LDADDS)
-translate_show_surface_LDADD = $(LDADDS)
-trap_clip_LDADD = $(LDADDS)
-unantialiased_shapes_LDADD = $(LDADDS)
-unbounded_operator_LDADD = $(LDADDS)
-user_data_LDADD = $(LDADDS)
-rel_path_LDADD = $(LDADDS)
-xlib_surface_LDADD = $(LDADDS)
-
noinst_PROGRAMS = imagediff png-flatten
-imagediff_LDADD = $(LDADDS)
-png_flatten_LDADD = $(LDADDS)
if CAIRO_CAN_TEST_PDF_SURFACE
noinst_PROGRAMS += pdf2png
pdf2png_CFLAGS = $(POPPLER_CFLAGS)
-pdf2png_LDADD = $(LDADDS) $(POPPLER_LIBS)
+pdf2png_LDADD = $(LDADD) $(POPPLER_LIBS)
endif
if CAIRO_CAN_TEST_SVG_SURFACE
diff --git a/test/a8-mask-rgb24-ref.png b/test/a8-mask-rgb24-ref.png
deleted file mode 100644
index 38556156c..000000000
--- a/test/a8-mask-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/cairo-test.c b/test/cairo-test.c
index 825012585..6615b87e3 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -85,7 +85,7 @@ static const char *fail_face = "", *normal_face = "";
/* Static data is messy, but we're coding for tests here, not a
* general-purpose library, and it keeps the tests cleaner to avoid a
* context object there, (though not a whole lot). */
-FILE *cairo_test_log_file;
+FILE *cairo_test_log_file = NULL;
void
cairo_test_init (const char *test_name)
@@ -107,9 +107,10 @@ void
cairo_test_log (const char *fmt, ...)
{
va_list va;
+ FILE *file = cairo_test_log_file ? cairo_test_log_file : stderr;
va_start (va, fmt);
- vfprintf (cairo_test_log_file, fmt, va);
+ vfprintf (file, fmt, va);
va_end (va);
}
@@ -1418,6 +1419,7 @@ cairo_test_for_target (cairo_test_t *test,
srcdir = ".";
format = _cairo_test_content_name (target->content);
+ /* First look for a target/format-specific reference image. */
xasprintf (&png_name, "%s-%s-%s%s", test->name,
target->name, format, CAIRO_TEST_PNG_SUFFIX);
xasprintf (&ref_name, "%s/%s-%s-%s%s", srcdir, test->name,
@@ -1425,13 +1427,17 @@ cairo_test_for_target (cairo_test_t *test,
if (access (ref_name, F_OK) != 0) {
free (ref_name);
- if (target->content == CAIRO_CONTENT_COLOR_ALPHA ||
- target->content == CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED)
+ /* Next, look for format-specifc reference image. */
+ xasprintf (&ref_name, "%s/%s-%s%s", srcdir, test->name,
+ format,CAIRO_TEST_REF_SUFFIX);
+
+ if (access (ref_name, F_OK) != 0) {
+ free (ref_name);
+
+ /* Finally, look for the standard reference image. */
xasprintf (&ref_name, "%s/%s%s", srcdir, test->name,
CAIRO_TEST_REF_SUFFIX);
- else
- xasprintf (&ref_name, "%s/%s-%s%s", srcdir, test->name,
- format,CAIRO_TEST_REF_SUFFIX);
+ }
}
xasprintf (&diff_name, "%s-%s-%s%s", test->name,
target->name, format, CAIRO_TEST_DIFF_SUFFIX);
diff --git a/test/caps-joins-alpha-rgb24-ref.png b/test/caps-joins-alpha-rgb24-ref.png
deleted file mode 100644
index 60163dd41..000000000
--- a/test/caps-joins-alpha-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/caps-joins-rgb24-ref.png b/test/caps-joins-rgb24-ref.png
deleted file mode 100644
index bf3b21478..000000000
--- a/test/caps-joins-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/caps-sub-paths-rgb24-ref.png b/test/caps-sub-paths-rgb24-ref.png
deleted file mode 100644
index 751194e7c..000000000
--- a/test/caps-sub-paths-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/clip-all-rgb24-ref.png b/test/clip-all-rgb24-ref.png
deleted file mode 100644
index 0e222f09e..000000000
--- a/test/clip-all-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/composite-integer-translate-over-repeat-rgb24-ref.png b/test/composite-integer-translate-over-repeat-rgb24-ref.png
deleted file mode 100644
index 8b84dd23b..000000000
--- a/test/composite-integer-translate-over-repeat-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/composite-integer-translate-over-rgb24-ref.png b/test/composite-integer-translate-over-rgb24-ref.png
deleted file mode 100644
index 40796e156..000000000
--- a/test/composite-integer-translate-over-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/composite-integer-translate-source-rgb24-ref.png b/test/composite-integer-translate-source-rgb24-ref.png
deleted file mode 100644
index 64c785924..000000000
--- a/test/composite-integer-translate-source-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/create-from-png-rgb24-ref.png b/test/create-from-png-rgb24-ref.png
deleted file mode 100644
index 0493617ab..000000000
--- a/test/create-from-png-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/create-from-png-stream-rgb24-ref.png b/test/create-from-png-stream-rgb24-ref.png
deleted file mode 100644
index 0493617ab..000000000
--- a/test/create-from-png-stream-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/dash-caps-joins-rgb24-ref.png b/test/dash-caps-joins-rgb24-ref.png
deleted file mode 100644
index 6ec274dfb..000000000
--- a/test/dash-caps-joins-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/dash-offset-negative-rgb24-ref.png b/test/dash-offset-negative-rgb24-ref.png
deleted file mode 100644
index 4c954e087..000000000
--- a/test/dash-offset-negative-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/filter-nearest-offset-rgb24-ref.png b/test/filter-nearest-offset-rgb24-ref.png
deleted file mode 100644
index 46092e3c7..000000000
--- a/test/filter-nearest-offset-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/imagediff.c b/test/imagediff.c
index 8e13a1fe5..de66b68d2 100644
--- a/test/imagediff.c
+++ b/test/imagediff.c
@@ -34,6 +34,7 @@
int
main (int argc, char *argv[])
{
+ read_png_status_t status;
unsigned char *buffer_a;
unsigned int width_a, height_a, stride_a;
unsigned char *buffer_b;
@@ -51,8 +52,13 @@ main (int argc, char *argv[])
exit (1);
}
- read_png_argb32 (argv[1], &buffer_a, &width_a, &height_a, &stride_a);
- read_png_argb32 (argv[2], &buffer_b, &width_b, &height_b, &stride_b);
+ status = read_png_argb32 (argv[1], &buffer_a, &width_a, &height_a, &stride_a);
+ if (status)
+ return 1;
+
+ status = read_png_argb32 (argv[2], &buffer_b, &width_b, &height_b, &stride_b);
+ if (status)
+ return 1;
if ((width_a == width_b) && (height_a == height_b) && (stride_a == stride_b))
{
@@ -77,8 +83,5 @@ main (int argc, char *argv[])
free (buffer);
- return total_pixels_changed;
+ return (total_pixels_changed != 0);
}
-
-
-
diff --git a/test/leaky-dash-ref.png b/test/leaky-dash-ref.png
new file mode 100644
index 000000000..e030f6cdf
--- /dev/null
+++ b/test/leaky-dash-ref.png
Binary files differ
diff --git a/test/leaky-dash.c b/test/leaky-dash.c
new file mode 100644
index 000000000..95c5ca753
--- /dev/null
+++ b/test/leaky-dash.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * 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
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org>
+ */
+
+/* Test case for bug #4863:
+ *
+ * stroking problems with wide dashed lines
+ * https://bugs.freedesktop.org/show_bug.cgi?id=4863
+ */
+
+#include "cairo-test.h"
+
+#define WIDTH 71
+#define HEIGHT 28
+
+cairo_test_t test = {
+ "leaky-dash",
+ "Exercises bug #4863 in which a dashed stroke leaks into half the rectangle being filled",
+ WIDTH, HEIGHT
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ double dash[2];
+
+ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
+ cairo_paint (cr);
+ cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
+
+ cairo_set_line_width (cr, 2);
+ dash[0] = 8.0;
+ dash[1] = 2.0;
+
+ cairo_rectangle (cr, 2.0, 2.0, 67.0, 24.0);
+
+ cairo_set_dash (cr, dash, 2, 9.0);
+ cairo_stroke (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/leaky-polygon-rgb24-ref.png b/test/leaky-polygon-rgb24-ref.png
deleted file mode 100644
index 6a77482bc..000000000
--- a/test/leaky-polygon-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/line-width-rgb24-ref.png b/test/line-width-rgb24-ref.png
deleted file mode 100644
index a63262f0c..000000000
--- a/test/line-width-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/line-width-scale-ps-argb32-ref.png b/test/line-width-scale-ps-argb32-ref.png
new file mode 100644
index 000000000..ab4d55299
--- /dev/null
+++ b/test/line-width-scale-ps-argb32-ref.png
Binary files differ
diff --git a/test/line-width-scale-ref.png b/test/line-width-scale-ref.png
new file mode 100644
index 000000000..9f1975900
--- /dev/null
+++ b/test/line-width-scale-ref.png
Binary files differ
diff --git a/test/line-width-scale.c b/test/line-width-scale.c
new file mode 100644
index 000000000..ec79a641c
--- /dev/null
+++ b/test/line-width-scale.c
@@ -0,0 +1,184 @@
+/*
+ * Copyright © 2006 Red Hat, Inc.
+ *
+ * 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
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+/* This test exercises the various interactions between
+ * cairo_set_line_width and cairo_scale. Specifically it show how
+ * separate transformations can affect the pen for stroking compared
+ * to the path itself.
+ *
+ * This was inspired by an image by Maxim Shemanarev demonstrating the
+ * flexible-pipeline nature of his Antigrain Geometry project:
+ *
+ * http://antigrain.com/tips/line_alignment/conv_order.gif
+ *
+ * It also uncovered a bug in cairo that cairo_set_line_width was not
+ * transforing the width according the the current CTM, but instead
+ * delaying that transformation until the time of cairo_stroke. See:
+ *
+ * http://article.gmane.org/gmane.comp.graphics.agg/2518
+ */
+
+#define LINE_WIDTH 13
+#define SPLINE 50.0
+#define XSCALE 0.5
+#define YSCALE 2.0
+#define WIDTH (XSCALE * SPLINE * 6.0)
+#define HEIGHT (YSCALE * SPLINE * 2.0)
+
+cairo_test_t test = {
+ "line-width-scale",
+ "Tests interaction of cairo_set_line_width with cairo_scale",
+ WIDTH, HEIGHT
+};
+
+static void
+spline_path (cairo_t *cr)
+{
+ cairo_save (cr);
+ {
+ cairo_move_to (cr,
+ - SPLINE, 0);
+ cairo_curve_to (cr,
+ - SPLINE / 4, - SPLINE,
+ SPLINE / 4, SPLINE,
+ SPLINE, 0);
+ }
+ cairo_restore (cr);
+}
+
+/* If we scale before setting the line width or creating the path,
+ * then obviously both will be scaled. */
+static void
+scale_then_set_line_width_and_stroke (cairo_t *cr)
+{
+ cairo_scale (cr, XSCALE, YSCALE);
+ cairo_set_line_width (cr, LINE_WIDTH);
+ spline_path (cr);
+ cairo_stroke (cr);
+}
+
+/* This is used to verify the results of
+ * scale_then_set_line_width_and_stroke.
+ *
+ * It uses save/restore pairs to isolate the scaling of the path and
+ * line_width and ensures that both are scaled.
+ */
+static void
+scale_path_and_line_width (cairo_t *cr)
+{
+ cairo_save (cr);
+ {
+ cairo_scale (cr, XSCALE, YSCALE);
+ spline_path (cr);
+ }
+ cairo_restore (cr);
+
+ cairo_save (cr);
+ {
+ cairo_scale (cr, XSCALE, YSCALE);
+ cairo_set_line_width (cr, LINE_WIDTH);
+ cairo_stroke (cr);
+ }
+ cairo_restore (cr);
+}
+
+/* This one's the bug.
+ *
+ * If we set the line width before scaling, then the path should be
+ * scaled but the line width should not.
+ *
+ * With the bug, the line_width is also being scaled here.
+ */
+static void
+set_line_width_then_scale_and_stroke (cairo_t *cr)
+{
+ cairo_set_line_width (cr, LINE_WIDTH);
+ cairo_scale (cr, XSCALE, YSCALE);
+ spline_path (cr);
+ cairo_stroke (cr);
+}
+
+/* This is used to verify what should be the results of
+ * set_line_width_then_scale_and_stroke (once the bug is fixed).
+ *
+ * It uses save/restore pairs to isolate the scaling of the path and
+ * line_width and ensures that the path is scaled while the line width
+ * is not.
+ */
+static void
+scale_path_not_line_width (cairo_t *cr)
+{
+ cairo_save (cr);
+ {
+ cairo_scale (cr, XSCALE, YSCALE);
+ spline_path (cr);
+ }
+ cairo_restore (cr);
+
+ cairo_save (cr);
+ {
+ cairo_set_line_width (cr, LINE_WIDTH);
+ cairo_stroke (cr);
+ }
+ cairo_restore (cr);
+}
+
+#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ int i;
+ typedef void (*figure_t) (cairo_t *cr);
+ figure_t figures[4] = {
+ scale_then_set_line_width_and_stroke,
+ scale_path_and_line_width,
+ set_line_width_then_scale_and_stroke,
+ scale_path_not_line_width
+ };
+
+ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
+ cairo_paint (cr);
+ cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
+
+ for (i = 0; i < 4; i++) {
+ cairo_save (cr);
+ cairo_translate (cr,
+ WIDTH/4 + (i % 2) * WIDTH/2,
+ HEIGHT/4 + (i / 2) * HEIGHT/2);
+ (figures[i]) (cr);
+ cairo_restore (cr);
+ }
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/linear-gradient-rgb24-ref.png b/test/linear-gradient-rgb24-ref.png
deleted file mode 100644
index 9cc545846..000000000
--- a/test/linear-gradient-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/mask.c b/test/mask.c
index 6d0e45878..2f0349d84 100644
--- a/test/mask.c
+++ b/test/mask.c
@@ -81,8 +81,7 @@ mask_polygon (cairo_t *cr, int x, int y)
cr2 = cairo_create (mask_surface);
cairo_save (cr2);
- cairo_set_source_rgba (cr2, 0, 0, 0, 0); /* transparent */
- cairo_set_operator (cr2, CAIRO_OPERATOR_SOURCE);
+ cairo_set_operator (cr2, CAIRO_OPERATOR_CLEAR);
cairo_paint (cr2);
cairo_restore (cr2);
diff --git a/test/move-to-show-surface-rgb24-ref.png b/test/move-to-show-surface-rgb24-ref.png
deleted file mode 100644
index b5f83489f..000000000
--- a/test/move-to-show-surface-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/paint-rgb24-ref.png b/test/paint-rgb24-ref.png
deleted file mode 100644
index fff03b363..000000000
--- a/test/paint-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/paint-source-alpha-rgb24-ref.png b/test/paint-source-alpha-rgb24-ref.png
deleted file mode 100644
index 490747013..000000000
--- a/test/paint-source-alpha-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/paint-with-alpha-rgb24-ref.png b/test/paint-with-alpha-rgb24-ref.png
deleted file mode 100644
index 228a78a25..000000000
--- a/test/paint-with-alpha-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/path-data-rgb24-ref.png b/test/path-data-rgb24-ref.png
deleted file mode 100644
index 627ba8686..000000000
--- a/test/path-data-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/rectangle-rounding-error-rgb24-ref.png b/test/rectangle-rounding-error-rgb24-ref.png
deleted file mode 100644
index c3a6840c0..000000000
--- a/test/rectangle-rounding-error-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/self-copy-rgb24-ref.png b/test/self-copy-rgb24-ref.png
deleted file mode 100644
index 92a20db64..000000000
--- a/test/self-copy-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/show-glyphs-many-rgb24-ref.png b/test/show-glyphs-many-rgb24-ref.png
deleted file mode 100644
index 450e8e0bb..000000000
--- a/test/show-glyphs-many-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/show-text-current-point-rgb24-ref.png b/test/show-text-current-point-rgb24-ref.png
deleted file mode 100644
index 9233244e1..000000000
--- a/test/show-text-current-point-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/source-clip-rgb24-ref.png b/test/source-clip-rgb24-ref.png
deleted file mode 100644
index 8df2bff97..000000000
--- a/test/source-clip-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/surface-pattern-rgb24-ref.png b/test/surface-pattern-rgb24-ref.png
deleted file mode 100644
index 1a641065b..000000000
--- a/test/surface-pattern-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/text-antialias-gray-rgb24-ref.png b/test/text-antialias-gray-rgb24-ref.png
deleted file mode 100644
index 8b60f7a5f..000000000
--- a/test/text-antialias-gray-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/text-antialias-none-rgb24-ref.png b/test/text-antialias-none-rgb24-ref.png
deleted file mode 100644
index a8ccf960d..000000000
--- a/test/text-antialias-none-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/text-antialias-subpixel-rgb24-ref.png b/test/text-antialias-subpixel-rgb24-ref.png
deleted file mode 100644
index 88f76c08e..000000000
--- a/test/text-antialias-subpixel-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/transforms-rgb24-ref.png b/test/transforms-rgb24-ref.png
deleted file mode 100644
index 574456926..000000000
--- a/test/transforms-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/translate-show-surface-rgb24-ref.png b/test/translate-show-surface-rgb24-ref.png
deleted file mode 100644
index a43f8b69c..000000000
--- a/test/translate-show-surface-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/unantialiased-shapes-rgb24-ref.png b/test/unantialiased-shapes-rgb24-ref.png
deleted file mode 100644
index ad7999327..000000000
--- a/test/unantialiased-shapes-rgb24-ref.png
+++ /dev/null
Binary files differ