This allows for more sharing of resource objects. It also avoids some
confusion in trying to set independent resources at a global and a
per-page level, (which doesn't work since the inheritance only works
for an entire resources object---it can only be overriden in its
entirety, not for subsets of the resources).
Eliminate the named structure cairo_pdf_stream_t. This structure was
being dynamically allocated, passed around, and leaked when only an ID
was actually needed to be passed around.
Similarly, many other uses of PDF resources were passing bare unsigned
int types rather than the safer and more legible cairo_pdf_resource_t.
The new paginated create_similar simply forwards to target backend create_similar.
We maintain the fact that PS and PDF surfaces are returning image
surfaces for create_similar by moving that explicitly to their own
create_similar functions.
(This commit is the combination of the following original commits:
6b69e8c012adb4f2fc2ee9c1579fed8214e8f510
2589db92a4395f8e900dbc4eafc45982f0d985d3
)
The paginated surface layer was missing its get_font_options function.
It now defers to the target surface. The PDF backend already had a
get_font_options function, but the PS backend was also missing it.
This should fix the problem with 72DPI hinting seen in glyph paths in
PostScript output.
Thanks to Owen Taylor for identifying this problem and the correct
fix.
With this SMask support, the PDF backend is now able to handle a very
large subset of the things that are likely to be thrown at it in
common operation, (for example, when handling images and text from web
pages).
Since the switch to using paginated, we have a guarantee that the following functions
will never be called. So we drop them now:
_cairo_pdf_surface_composite
_cairo_pdf_surface_fill_rectangles
_cairo_pdf_surface_composite_trapezoids
_cairo_pdf_surface_old_show_glyphs
There's a bunch of careful matrix transformation here needed to
resolve the differences between cairo and PDF pattern matrices,
(primarily due to the different location for the origin).
This fixes the several PDF test suite failures that recently appeared
when we switched from ARGB32 to RGB24 source surface patterns.
This isn't very exciting text output---it simply turns every call to
cairo_show_glyphs into a single filled path. But at the very least,
text will no longer trigger image fallbacks for the PDF backend.
With this commit, the following tests change from all-fallback to
all-native for the PDF backend:
show-text-current-point
text-antialias-gray
text-antialias-none
text-antialias-subpixel
text-cache-crash
text-rotate
There are rasterization differences in the output (cairo vs. freetype)
so this commit also adds new PDF-specific reference images for some of
those tests so that the suite continues to report PASS.
Perhaps there's a way to preserve that hint in PDF output, but until
we have code that actually does that, the correct thing to do is to
call it unsupported and let the fallbacks do their thing.
With this commit, the two regressions that were recently introduced
now pass again. Specifically:
rectangle-rounding-error
unantialiased-shapes
Fix general broken-ness in emit_surface_pattern, enough so that a new
implementation of _cairo_pdf_surface_paint does something useful. With
this commit, the following tests switch from all-fallback to
all-native and still pass the test suite with flying colors:
caps-joins
caps-sub-paths
clip-fill-rule
clip-fill-rule-pixel-aligned
clip-nesting
clip-twice
dash-caps-joins
dash-offset-negative
leaky-polygon
line-width
paint
path-data
transforms
Meanwhile, the following two tests also switch from fallback to
native, but cause the test suite to complain about failures. These
both look like a mostly harmless failure to respect the ANTIALIAS_NONE
hint in the PDF output:
rectangle-rounding-error-pdf-argb32-out.pdf
unantialiased-shapes-pdf-argb32-out.pdf
Generalize all functions that emit a source pattern to emit both
for the stroking and non-stroking PDF properties. Also add an
implementation of _cairo_pdf_surface_stroke.
With this commit in place, the following tests change from
all-fallback to all-native output while no tests report any new
failures:
dash-zero-legnth
fill-and-stroke
multi-page
new-sub-path
rel-path
self-intersecting
These new stubs explicitly return UNSUPPORTED unconditionally. This is
no different than the implicit UNSUPPORTED which the analysis surface
was inferring from NULL for 4 of the functions before.
However, _cairo_pdf_surface_fill was actually trying to draw things,
but without correctly characterizing it during the analysis stage.
This was just an oversight, as the PDF surface was always triggereing
full page fall backs anway due to the initial unsupported paint with
CLEAR.
Now, we explicitly return UNSUPPORTED for all drawing operations so we
get image fallbacks by design and not by accident.
This allows for any surface using the paginated_surface backend to
easily do stuff at the beginning of each page, (such as writing out
any per-page header necessary).
This replaces some of the per-page state tracking that the PS surface
was doing, (though it still has some left for its optimization of
CLEAR on a blank page).
The cairo_output_stream_t object already had an internal status value,
but it was annoyingly returning status values from various functions.
It also was missing proper shutdown-on-error as well as nil-create
semantics.
This fixes those shortcomings and adjusts all callers for the new
semantics, (leading to simpler and more correct calling
code---particularly in the case of cairo-base85-stream.c).
Now _cairo_output_stream_create accepts a new close callback, (which
the base85 stream uses to write its trailer). This eliminates the
former kludge used to fclose the stdio output streams, and required a
bit of touchup to the pdf, ps, and svg-surface usage of streams.
This adds a new function which has as its only effect the elimination
of
the current point. This makes it much easier to use the various
cairo_arc calls when the initial line_to is not actually desired.
This function also unifies and generalizes the long-existing behavior
of cairo_line_to being treated as cairo_move_to when there is no
current point. With the addition of cairo_new_sub_path this becomes a
documented feature with similar behavior in cairo_curve_to as well.
This also has the benefit of preserving the API that has been in place for PS/PDF surface since the (experimental) stuff in 1.0.0.
Track API change.
Continue testing PS/PDF surfaces in the CAIRO_CONTENT_COLOR mode but do it by rendering to an intermediate similar surface rather than constructing the target surface differently.
Add documentation. Add a cairo_content_t argument to PDF surface constructors.
Add documentation. Add a cairo_content_t argument to PS surface constructors.
Track changes in PS/PDF surface constructor API.
The PS/PDF backends don't allow a content to be passed in right now, so they fail against the rgb24 tests, but the trivial addition to the constructors will allow them to pass all tests with both content values.
And new constructors (currently internal only) to create an image surface with a cairo_content_t rather than a cairo_format_t.
Add a cairo_content_t argument to the constructor.
Add a cairo_content_t to the constructor and use this content value when constructing intermediate image surfaces in acquire_source, show_page, copy_page, and snapshot.
Add image flattening by compositing over white, as is done in cairo-ps-surface.c.
Track changes to cairo-paginates-surface which now requires a cairo_content_t value (no change to public PS/PDF constructors yet).
Track change in meta-surface and paginated-surface interfaces by now accepting a cairo_content_t rather than a cairo_format_t.
Ignore new output files (argb32 from pdf and ps as well as rgb24 from test-fallback, test-meta, and test-paginated).
Add new utility for flattening PNG images in order to generate the -argbf-ref.png images.
Add image_diff_flattened for comparing flattened output from PS and PDF backend with ARGB reference images by first blending the reference images over white.
Get rid of conditional, format-specific background-color initialization before running tests. Now uses ARGB(0,0,0,0) in all cases. Switch from specifying tests with a format value to specifying tests with a content value. Add support for a 'fake' COLOR_ALPHA_FLATTENED content for testing the PS and PDF output against a flattened version of the argb32 reference images (first blended over white).
Track change in cairo_ps_surface_create (now requires cairo_content_t value).
Adjust tests that draw in default (black) to first paint white so that the results are visible.
Adjust ARGB32 reference images for new white background for changed tests.
Adjust RGB24 reference images for new black background due to changed initialization (and the tests themselves being unchanged).
Add new functions needed by users of cairo_paginated_surface_t.
Always snapshot a paginated surface to an image surface, rather than a surface similar to the target. We do this since paginated target surfaces are allowed to not be complete surfaces, (such as not implementing acquire_source_surface).
Switch the implementation of cairo_pdf_surface_t to use cairo_paginated_surface_t. For now this means that all PDF output is fallback images, but this can change incrementally as we go forward.