summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2005-11-08 17:43:13 +0000
committerCarl Worth <cworth@cworth.org>2005-11-08 17:43:13 +0000
commit5b6c912667f62f808b9cf533b4486ce906197543 (patch)
tree3a9cd71f9f10151ba30fe6bcb42b3ddd5832cad0
parent48218fec48d1bfa2a93cc21f8f9df569e40ca79e (diff)
Note that PS is now passing all tests except for self-copy.
Add missing glue to hook up PS backend with new meta-surface support for the 5 basic drawing operations. Currently, this forces image fallbacks for all operations. Switch from gs device of pngalpha to png16m which for some reason gives the correct result for nil-surface now, while pngalpha does not. Key off of N_OPERATORS as the loop control for easier trimming down of this test case when debugging. Rename stroke_style parameter to style in backend->stroke parameter list. Remove PS-specific reference images for many tests which are now using more fallback paths than before.
-rw-r--r--ChangeLog46
-rw-r--r--ROADMAP10
-rw-r--r--src/cairo-ps-surface.c196
-rw-r--r--src/cairoint.h2
-rw-r--r--test/cairo-test.c2
-rw-r--r--test/caps-joins-ps-rgb24-ref.pngbin1420 -> 0 bytes
-rw-r--r--test/caps-sub-paths-ps-rgb24-ref.pngbin237 -> 0 bytes
-rw-r--r--test/clip-fill-rule-ps-rgb24-ref.pngbin309 -> 0 bytes
-rw-r--r--test/clip-nesting-ps-rgb24-ref.pngbin517 -> 0 bytes
-rw-r--r--test/clip-operator.c2
-rw-r--r--test/clip-twice-ps-rgb24-ref.pngbin605 -> 0 bytes
-rw-r--r--test/dash-caps-joins-ps-rgb24-ref.pngbin2362 -> 0 bytes
-rw-r--r--test/dash-offset-negative-ps-rgb24-ref.pngbin202 -> 0 bytes
-rw-r--r--test/fill-and-stroke-ps-rgb24-ref.pngbin328 -> 0 bytes
-rw-r--r--test/fill-rule-ps-rgb24-ref.pngbin2167 -> 0 bytes
-rw-r--r--test/leaky-polygon-ps-rgb24-ref.pngbin353 -> 0 bytes
-rw-r--r--test/line-width-ps-rgb24-ref.pngbin242 -> 0 bytes
-rw-r--r--test/path-data-ps-rgb24-ref.pngbin440 -> 0 bytes
-rw-r--r--test/rectangle-rounding-error-ps-rgb24-ref.pngbin365 -> 0 bytes
-rw-r--r--test/show-text-current-point-ps-rgb24-ref.pngbin1477 -> 0 bytes
-rw-r--r--test/text-antialias-gray-ps-rgb24-ref.pngbin714 -> 0 bytes
-rw-r--r--test/text-antialias-none-ps-rgb24-ref.pngbin714 -> 0 bytes
-rw-r--r--test/text-antialias-subpixel-ps-rgb24-ref.pngbin714 -> 0 bytes
-rw-r--r--test/transforms-ps-rgb24-ref.pngbin418 -> 0 bytes
-rw-r--r--test/unantialiased-shapes-ps-rgb24-ref.pngbin9899 -> 0 bytes
25 files changed, 231 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 7b34bd3ec..dbe6e5ce0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,51 @@
2005-11-08 Carl Worth <cworth@cworth.org>
+ * ROADMAP: Note that PS is now passing all tests except for
+ self-copy.
+
+ * src/cairo-ps-surface.c: (_cairo_ps_surface_paint),
+ (_cairo_ps_surface_mask), (_cairo_ps_surface_stroke),
+ (_cairo_ps_surface_fill), (_cairo_ps_surface_show_glyphs),
+ (_ps_output_paint), (_ps_output_mask), (_ps_output_stroke),
+ (_ps_output_fill), (_ps_output_show_glyphs): Add missing glue to
+ hook up PS backend with new meta-surface support for the 5 basic
+ drawing operations. Currently, this forces image fallbacks for all
+ operations.
+
+ * test/cairo-test.c: (ps_surface_write_to_png): Switch from gs
+ device of pngalpha to png16m which for some reason gives the
+ correct result for nil-surface now, while pngalpha does not.
+
+ * test/clip-operator.c: (draw): Key off of N_OPERATORS as the loop
+ control for easier trimming down of this test case when debugging.
+
+ * src/cairoint.h: Rename stroke_style parameter to style in
+ backend->stroke parameter list.
+
+ * test/caps-joins-ps-rgb24-ref.png:
+ * test/caps-sub-paths-ps-rgb24-ref.png:
+ * test/clip-fill-rule-ps-rgb24-ref.png:
+ * test/clip-nesting-ps-rgb24-ref.png:
+ * test/clip-twice-ps-rgb24-ref.png:
+ * test/dash-caps-joins-ps-rgb24-ref.png:
+ * test/dash-offset-negative-ps-rgb24-ref.png:
+ * test/fill-and-stroke-ps-rgb24-ref.png:
+ * test/fill-rule-ps-rgb24-ref.png:
+ * test/leaky-polygon-ps-rgb24-ref.png:
+ * test/line-width-ps-rgb24-ref.png:
+ * test/path-data-ps-rgb24-ref.png:
+ * test/rectangle-rounding-error-ps-rgb24-ref.png:
+ * test/show-text-current-point-ps-rgb24-ref.png:
+ * test/text-antialias-gray-ps-rgb24-ref.png:
+ * test/text-antialias-none-ps-rgb24-ref.png:
+ * test/text-antialias-subpixel-ps-rgb24-ref.png:
+ * test/transforms-ps-rgb24-ref.png:
+ * test/unantialiased-shapes-ps-rgb24-ref.png: Remove PS-specific
+ reference images for many tests which are now using more fallback
+ paths than before.
+
+2005-11-08 Carl Worth <cworth@cworth.org>
+
* src/cairo-meta-surface-private.h:
* src/cairo-meta-surface.c: (_cairo_meta_surface_finish),
(_cairo_meta_surface_paint),
diff --git a/ROADMAP b/ROADMAP
index 6154c0339..b44e23285 100644
--- a/ROADMAP
+++ b/ROADMAP
@@ -16,15 +16,15 @@ The release won't happen without these being complete.
✓a. Incorporate into test suite
b. Correct output for the entire test suite
- clip-operator
+ ✓clip-operator
✓composite-integer-translate-source
- linear-gradient
- operator-clear
+ ✓linear-gradient
+ ✓operator-clear
✓operator-source
self-copy
- text-pattern
+ ✓text-pattern
✓trap-clip
- unbounded-operator
+ ✓unbounded-operator
2. Image fallbacks at finer-than-whole-page granularity
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 7b9ec7253..36db6f5a4 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -468,9 +468,56 @@ _cairo_ps_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
}
static cairo_int_status_t
+_cairo_ps_surface_paint (void *abstract_surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source)
+{
+ cairo_ps_surface_t *surface = abstract_surface;
+
+ assert (_cairo_surface_is_meta (surface->current_page));
+
+ return _cairo_surface_paint (surface->current_page, operator, source);
+}
+
+static cairo_int_status_t
+_cairo_ps_surface_mask (void *abstract_surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_pattern_t *mask)
+{
+ cairo_ps_surface_t *surface = abstract_surface;
+
+ assert (_cairo_surface_is_meta (surface->current_page));
+
+ return _cairo_surface_mask (surface->current_page, operator, source,
+ mask);
+}
+
+static cairo_int_status_t
+_cairo_ps_surface_stroke (void *abstract_surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_path_fixed_t *path,
+ cairo_stroke_style_t *style,
+ cairo_matrix_t *ctm,
+ cairo_matrix_t *ctm_inverse,
+ double tolerance,
+ cairo_antialias_t antialias)
+{
+ cairo_ps_surface_t *surface = abstract_surface;
+
+ assert (_cairo_surface_is_meta (surface->current_page));
+
+ return _cairo_surface_stroke (surface->current_page, operator, source,
+ path, style,
+ ctm, ctm_inverse,
+ tolerance, antialias);
+}
+
+static cairo_int_status_t
_cairo_ps_surface_fill (void *abstract_surface,
cairo_operator_t operator,
- cairo_pattern_t *pattern,
+ cairo_pattern_t *source,
cairo_path_fixed_t *path,
cairo_fill_rule_t fill_rule,
double tolerance,
@@ -480,13 +527,26 @@ _cairo_ps_surface_fill (void *abstract_surface,
assert (_cairo_surface_is_meta (surface->current_page));
- return _cairo_surface_fill (surface->current_page,
- operator,
- pattern,
- path,
- fill_rule,
- tolerance,
- antialias);
+ return _cairo_surface_fill (surface->current_page, operator, source,
+ path, fill_rule,
+ tolerance, antialias);
+}
+
+static cairo_int_status_t
+_cairo_ps_surface_show_glyphs (void *abstract_surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ const cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_scaled_font_t *scaled_font)
+{
+ cairo_ps_surface_t *surface = abstract_surface;
+
+ assert (_cairo_surface_is_meta (surface->current_page));
+
+ return _cairo_surface_show_glyphs (surface->current_page, operator, source,
+ glyphs, num_glyphs,
+ scaled_font);
}
static const cairo_surface_backend_t cairo_ps_surface_backend = {
@@ -514,11 +574,11 @@ static const cairo_surface_backend_t cairo_ps_surface_backend = {
/* Here are the drawing functions */
- NULL, /* paint */
- NULL, /* mask */
- NULL, /* stroke */
+ _cairo_ps_surface_paint,
+ _cairo_ps_surface_mask,
+ _cairo_ps_surface_stroke,
_cairo_ps_surface_fill,
- NULL /* show_glyphs */
+ _cairo_ps_surface_show_glyphs
};
static cairo_int_status_t
@@ -1379,10 +1439,83 @@ _ps_output_old_show_glyphs (cairo_scaled_font_t *scaled_font,
return CAIRO_STATUS_SUCCESS;
}
+/* XXX: Just stubbing this out for now. Should be able to do much
+ * better here. */
+static cairo_int_status_t
+_ps_output_paint (void *abstract_surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source)
+{
+ ps_output_surface_t *surface = abstract_surface;
+
+ if (pattern_operation_needs_fallback (operator, source))
+ return _ps_output_add_fallback_area (surface,
+ 0, 0,
+ surface->parent->width,
+ surface->parent->height);
+
+ /* XXX: Should be able to do much better here. */
+ return _ps_output_add_fallback_area (surface,
+ 0, 0,
+ surface->parent->width,
+ surface->parent->height);
+}
+
+/* XXX: Just stubbing this out for now. Should be able to do much
+ * better here. */
+static cairo_int_status_t
+_ps_output_mask (void *abstract_surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_pattern_t *mask)
+{
+ ps_output_surface_t *surface = abstract_surface;
+
+ if (pattern_operation_needs_fallback (operator, source))
+ return _ps_output_add_fallback_area (surface,
+ 0, 0,
+ surface->parent->width,
+ surface->parent->height);
+
+ /* XXX: Should be able to do much better here. */
+ return _ps_output_add_fallback_area (surface,
+ 0, 0,
+ surface->parent->width,
+ surface->parent->height);
+}
+
+/* XXX: Just stubbing this out for now. Should be able to do much
+ * better here. */
+static cairo_int_status_t
+_ps_output_stroke (void *abstract_surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_path_fixed_t *path,
+ cairo_stroke_style_t *style,
+ cairo_matrix_t *ctm,
+ cairo_matrix_t *ctm_inverse,
+ double tolerance,
+ cairo_antialias_t antialias)
+{
+ ps_output_surface_t *surface = abstract_surface;
+
+ if (pattern_operation_needs_fallback (operator, source))
+ return _ps_output_add_fallback_area (surface,
+ 0, 0,
+ surface->parent->width,
+ surface->parent->height);
+
+ /* XXX: Should be able to do much better here. */
+ return _ps_output_add_fallback_area (surface,
+ 0, 0,
+ surface->parent->width,
+ surface->parent->height);
+}
+
static cairo_int_status_t
_ps_output_fill (void *abstract_surface,
cairo_operator_t operator,
- cairo_pattern_t *pattern,
+ cairo_pattern_t *source,
cairo_path_fixed_t *path,
cairo_fill_rule_t fill_rule,
double tolerance,
@@ -1394,7 +1527,7 @@ _ps_output_fill (void *abstract_surface,
ps_output_path_info_t info;
const char *ps_operator;
- if (pattern_operation_needs_fallback (operator, pattern))
+ if (pattern_operation_needs_fallback (operator, source))
return _ps_output_add_fallback_area (surface,
0, 0,
surface->parent->width,
@@ -1402,7 +1535,7 @@ _ps_output_fill (void *abstract_surface,
_cairo_output_stream_printf (stream,
"%% _ps_output_fill\n");
- emit_pattern (surface->parent, pattern);
+ emit_pattern (surface->parent, source);
info.output_stream = stream;
info.has_current_point = FALSE;
@@ -1432,6 +1565,31 @@ _ps_output_fill (void *abstract_surface,
return status;
}
+/* XXX: Just stubbing this out for now. Should be able to do much
+ * better here. */
+static cairo_int_status_t
+_ps_output_show_glyphs (void *abstract_surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ const cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_scaled_font_t *scaled_font)
+{
+ ps_output_surface_t *surface = abstract_surface;
+
+ if (pattern_operation_needs_fallback (operator, source))
+ return _ps_output_add_fallback_area (surface,
+ 0, 0,
+ surface->parent->width,
+ surface->parent->height);
+
+ /* XXX: Should be able to do much better here. */
+ return _ps_output_add_fallback_area (surface,
+ 0, 0,
+ surface->parent->width,
+ surface->parent->height);
+}
+
static const cairo_surface_backend_t ps_output_backend = {
NULL, /* create_similar */
_ps_output_finish,
@@ -1457,11 +1615,11 @@ static const cairo_surface_backend_t ps_output_backend = {
/* Here are the drawing functions */
- NULL, /* paint */
- NULL, /* mask */
- NULL, /* stroke */
+ _ps_output_paint,
+ _ps_output_mask,
+ _ps_output_stroke,
_ps_output_fill,
- NULL /* show_glyphs */
+ _ps_output_show_glyphs
};
static cairo_int_status_t
diff --git a/src/cairoint.h b/src/cairoint.h
index 45cdcfeaa..b27624dcb 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -768,7 +768,7 @@ struct _cairo_surface_backend {
cairo_operator_t operator,
cairo_pattern_t *source,
cairo_path_fixed_t *path,
- cairo_stroke_style_t *stroke_style,
+ cairo_stroke_style_t *style,
cairo_matrix_t *ctm,
cairo_matrix_t *ctm_inverse,
double tolerance,
diff --git a/test/cairo-test.c b/test/cairo-test.c
index 2136dde29..712749edb 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -519,7 +519,7 @@ ps_surface_write_to_png (cairo_surface_t *surface, const char *filename)
char command[4096];
cairo_surface_finish (surface);
- sprintf (command, "gs -q -r72 -g%dx%d -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pngalpha -sOutputFile=%s %s",
+ sprintf (command, "gs -q -r72 -g%dx%d -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -sOutputFile=%s %s",
ptc->width, ptc->height, filename, ptc->filename);
if (system (command) == 0)
return CAIRO_STATUS_SUCCESS;
diff --git a/test/caps-joins-ps-rgb24-ref.png b/test/caps-joins-ps-rgb24-ref.png
deleted file mode 100644
index db31cc65f..000000000
--- a/test/caps-joins-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/caps-sub-paths-ps-rgb24-ref.png b/test/caps-sub-paths-ps-rgb24-ref.png
deleted file mode 100644
index 319e492e7..000000000
--- a/test/caps-sub-paths-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/clip-fill-rule-ps-rgb24-ref.png b/test/clip-fill-rule-ps-rgb24-ref.png
deleted file mode 100644
index f9bd0e1c4..000000000
--- a/test/clip-fill-rule-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/clip-nesting-ps-rgb24-ref.png b/test/clip-nesting-ps-rgb24-ref.png
deleted file mode 100644
index f5b638590..000000000
--- a/test/clip-nesting-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/clip-operator.c b/test/clip-operator.c
index 6cc5216c2..378d6bd52 100644
--- a/test/clip-operator.c
+++ b/test/clip-operator.c
@@ -158,7 +158,7 @@ draw (cairo_t *cr, int width, int height)
cairo_font_options_destroy (font_options);
for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
- for (op = CAIRO_OPERATOR_CLEAR; op <= CAIRO_OPERATOR_SATURATE; op++) {
+ for (op = CAIRO_OPERATOR_CLEAR; op < N_OPERATORS; op++) {
x = op * (WIDTH + PAD) + PAD;
y = j * (HEIGHT + PAD) + PAD;
diff --git a/test/clip-twice-ps-rgb24-ref.png b/test/clip-twice-ps-rgb24-ref.png
deleted file mode 100644
index e93defeca..000000000
--- a/test/clip-twice-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/dash-caps-joins-ps-rgb24-ref.png b/test/dash-caps-joins-ps-rgb24-ref.png
deleted file mode 100644
index 5ca095453..000000000
--- a/test/dash-caps-joins-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/dash-offset-negative-ps-rgb24-ref.png b/test/dash-offset-negative-ps-rgb24-ref.png
deleted file mode 100644
index 9f783b77d..000000000
--- a/test/dash-offset-negative-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/fill-and-stroke-ps-rgb24-ref.png b/test/fill-and-stroke-ps-rgb24-ref.png
deleted file mode 100644
index 003f44bae..000000000
--- a/test/fill-and-stroke-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/fill-rule-ps-rgb24-ref.png b/test/fill-rule-ps-rgb24-ref.png
deleted file mode 100644
index 5857e49c9..000000000
--- a/test/fill-rule-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/leaky-polygon-ps-rgb24-ref.png b/test/leaky-polygon-ps-rgb24-ref.png
deleted file mode 100644
index c2638368c..000000000
--- a/test/leaky-polygon-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/line-width-ps-rgb24-ref.png b/test/line-width-ps-rgb24-ref.png
deleted file mode 100644
index 89433d415..000000000
--- a/test/line-width-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/path-data-ps-rgb24-ref.png b/test/path-data-ps-rgb24-ref.png
deleted file mode 100644
index ae6f60f0f..000000000
--- a/test/path-data-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/rectangle-rounding-error-ps-rgb24-ref.png b/test/rectangle-rounding-error-ps-rgb24-ref.png
deleted file mode 100644
index 0ad003aef..000000000
--- a/test/rectangle-rounding-error-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/show-text-current-point-ps-rgb24-ref.png b/test/show-text-current-point-ps-rgb24-ref.png
deleted file mode 100644
index 69827c1a8..000000000
--- a/test/show-text-current-point-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/text-antialias-gray-ps-rgb24-ref.png b/test/text-antialias-gray-ps-rgb24-ref.png
deleted file mode 100644
index 9b52a9389..000000000
--- a/test/text-antialias-gray-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/text-antialias-none-ps-rgb24-ref.png b/test/text-antialias-none-ps-rgb24-ref.png
deleted file mode 100644
index 9b52a9389..000000000
--- a/test/text-antialias-none-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/text-antialias-subpixel-ps-rgb24-ref.png b/test/text-antialias-subpixel-ps-rgb24-ref.png
deleted file mode 100644
index 9b52a9389..000000000
--- a/test/text-antialias-subpixel-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/transforms-ps-rgb24-ref.png b/test/transforms-ps-rgb24-ref.png
deleted file mode 100644
index 2399148b7..000000000
--- a/test/transforms-ps-rgb24-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/unantialiased-shapes-ps-rgb24-ref.png b/test/unantialiased-shapes-ps-rgb24-ref.png
deleted file mode 100644
index b73300b33..000000000
--- a/test/unantialiased-shapes-ps-rgb24-ref.png
+++ /dev/null
Binary files differ