As we pre-check whether the operation is a no-op on an already cleared
surface, then for all but a paint with CLEAR and no clip, the result is
a non-clear surface.
The rationale behind this change is that when someone is trying to
draw on a SVG surface using image surface patterns, the resulting SVG
file can take up to ridiculous 20 megabytes for 3-4 typical
photographic images in a single SVG file. This also can take
significant amount of CPU time to complete.
The reason for this behaviour is that currently whenever SVG backend
needs to emit an image tag for a surface pattern it takes a snapshot
of the subject surface, encodes it in PNG, then Base64-encodes and
emits the (huge) resulting string. With use of
cairo_surface_set_mime_data API this can be somewhat improved by
associating JPEG image contents with the corresponding surfaces.
Still this doesn't allow for post-processing of involved photographic
images without regenerating the SVG file.
As SVG specification allows URIs in the image tag's xlink:href
attribute, it is possible instead of embedding encoded image data to
simply link image files residing physically on the same medium as the
generated SVG file: files on disk under common directory, files on a
web server at common base URI, etc.
To make this happen we add new (unofficial) MIME type "text/x-uri" and
let users associate URIs with surfaces through
cairo_surface_set_mime_data() API. When SVG backend needs to emit
surface contents and it sees "text/x-uri" attached to the surface, it
emits this data instead of taking snapshot. The URI data is emitted
as is, so correctness check is left solely to the client code.
A push/pop is an implicit save/restore, so a clip applied inside the
group is temporary, whereas a clip applied outside affects both the
geometry inside *and* the application of the group when painted. So
reset the clip afterwards to get the desired behaviour.
The new xcb surface uses xcb_writev() and xcb_take_socket()
which were introduced in libxcb 1.1.92. The boilerplate
in turn uses the major_code and minor_code fields in
xcb_generic_error_t, which were introduced in 1.4.
We were exposing the actual value of CAIRO_FORMAT_INVALID
through API functions already, so it makes sense to just
go ahead and put it in the cairo_format_t enum.
The image surface tries to convert surface pattern's extend
modes to EXTEND_NONE, if it can, when converting a cairo_pattern_t
to a pixman_image_t. The check was not taking into account the
transformation matrix on the pattern, so it was possible to
trick it into using EXTEND_NONE by downscaling the source
pattern enough. This patch changes the optimization to only
take if the pattern has no transformation.
Fixes surface-pattern-scale-down-extend-{pad,reflect,repeat}
failures in the test suite for the image backend.
Franz Schmid reported a regression in 1.9.6 when downscaling
and using EXTEND_REPEAT for an image surface pattern. This
patch adds such tests for every extend mode.
The clip-group-shapes-* tests check that it doesn't
matter whether the clip path is set before or after
pushing a group using specific types of clip paths
(aligned/unaligned rectangles and general paths.)
The slim_hidden_* macro definitions are rather cryptic at first
sight and I keep needing to rederive how they work just find out
what they're supposed to do. This patch adds a comment explaining
how they're used and work.
The test was returning a cairo_status_t, but should be returning
a cairo_test_status_t instead. When the test failed it was
being reported as having crashed, rather than merely failed,
because the enum value of CAIRO_TEST_CRASHED happened to be
same as the cairo_status_t value of the cairo context at
the end of the failing test.
Split into a general cairo_image_surface_coerce() that coerces to one of
the 3 supported formats (ARGB32, RGB24, A8) based on content and the
more general cairo_image_surface_coerce_to_format() that coerces to a
specified format.
Benjamin Otte tracked down an invalid read triggered by WebKit. The
cause is that we attempt to dereference the list_head as an edge as we
failed to check that during the skipping of colinear edges we advanced
to the end, under the false assumption that there would always
be a closing edge in a rectangle. This assumption is broken if the tail
rectangles having colinear right edges.
Change the operator used to upgrade the format of a glyph mask from
CAIRO_OPERATOR_SOURCE to CAIRO_OPERATOR_ADD.
The _cairo_scaled_font_show_glyphs() function upgrades the pixel
format of a glyph mask by calling _cairo_surface_composite() to copy
the mask to an image surface of the upgraded destination. The way it
was doing it however was to use CAIRO_OPERATOR_SOURCE, a white source
pattern and the glyph's rasterised glyph as the mask pattern. This
combination isn't supported by _cairo_surface_composite(), which
asserts that no mask is present when the operator is SOURCE or CLEAR.
Reported by Mikael Magnusson to #cairo on irc.freenode.net.
Since moving to pixman for the gradient textures, first=0 and last=1,
so there's no need to rescale to 0,1 any more. Shaves 6 Gen4 ISA
instructions, including 2 inverses, in the radial fragment shader.
Creates a texture and draws with it instead of doing TexSubImage.
Open question is whether this wouldn't be better in general. Fixes
several failures with ARB_texture_rectangle path due to fallbacks to
window drawing.
Most testcases are now passing like the ARB_texture_non_power_of_two
case. EXT_texture_rectangle support is dropped in favor of
ARB_texture_non_power_of_two. If we have issues with drivers not
having that but having EXT (which just lacks the GLSL part of the
spec), we can split it out. Right now non-GLSL support in cairo-gl is
probably in bad shape anyway and will require someone that cares for
it in order to get fixed up.
The only issue is the repeat modes aren't supported for rectangular
textures. In any case even with ARB_npot radeon's pre-r600 lie and
fail to do repeats anyway.
This code is stolen straight from cairo-drm-intel.c. This saves a
bunch of time calculating interpolated points when we just do
interpolation between points at sampling time anyway. Reduces
firefox-talos-svg from 47 seconds back to the 42 it was at before the
pixman change.
This regresses the reported result of huge-radial, but there's no
visible difference.