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.
This commit is contained in:
Carl Worth 2005-11-08 17:43:13 +00:00
parent 48218fec48
commit 5b6c912667
25 changed files with 231 additions and 27 deletions

View file

@ -1,3 +1,49 @@
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:

10
ROADMAP
View file

@ -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

View file

@ -467,10 +467,57 @@ _cairo_ps_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
num_glyphs);
}
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

View file

@ -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,

View file

@ -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;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 517 B

View file

@ -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;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB