The only caller of cairo_path_fixed_get_current_point(), used the status
return to determine whether or not the path had a current point (and did
not propagate the error) - for which we had already removed the
_cairo_error() markup. Now we reduce the boolean status return to a
cairo_bool_t, with a net reduction in code.
Adrian Johnson hit a SEGV after
_cairo_paginaged_surface_create_image_surface() tried to set the font
options on an error surface after running out of memory. So add the
usual checks that the surface is not a snapshot, or in an error state or
finished before modifying its font options.
Missed calling _cairo_error() for the CAIRO_STATUS_NULL_POINTER
returned by _cairo_gstate_init(). Rearrange the code to avoid the
overly complicated return statement. We note that _cairo_gstate_init()
is special as _cairo_gstate_fini() will always be called, even if an
error is thrown, and so do not do the usual cleanup in the case of an
aborted initialization.
Bill Spitzak said
"If you really want to match when the determinant is non-zero in the
resulting matrix, use sx*sy != 0. This appears the same as sx&&sy but
may also catch when underflow makes the determinant zero."
Return CAIRO_STATUS_INVALID_MATRIX if we know the user input will
generate a degenerate matrix. For additional paranoia we could recompute
and validate the inverse each time as well.
Testing win32-printing requires setting the default printer to
a PostScript level 3 color printer. The PostScript output is
saved to a file and converted to png using ghostscript.
The win32 CTM is changed to user space to set the stroke parameters.
As win32 uses integers for stroke parameters this will cause rounding
problems depending on the CTM used.
This is fixed by factoring out a scale from the user space CTM so that
xx, xy, yx, and yy in the CTM are all < 1. This preserves the shape
of the transformation while ensuring that the CTM does not cause
rounding problems. The stroke parameters are multiplied by the scale
value.
When using meta surface patterns, the win32 CTM is changed to the
inverted pattern matrix then the meta surface is replayed to the
surface. The problem with this is that win32 uses integer coordinates
for GDI functions. A pattern matrix that scale the CTM up will cause
rounding errors in the position of each path in the pattern.
This is fixed by always keeping the win32 CTM set to the identity
matrix. The CTM is stored in the surface and all coordinates are
transformed by the CTM before calling GDI functions.
This implements clipping using CGContextClipToMask, which
means that it will only have an effect on OS X 10.4+.
No additional tests pass with this fix - mainly due to
text effects and problems with the IN, OUT, DEST_IN, DEST_ATOP
operators.
Quartz was failing the dash-zero-length test for odd numbers
of dashes; it seems cairo wants 3 dashes to be on-off-on,
off-on-off, wheras quartz uses on-off-on, on-off-on. Fixed
by doubling the number of dashes used.
We had a bug which converted cairo_int_status_t to cairo_status_t,
causing an assertion; reported at http://developer.imendio.com/node/128.
Return the generic out of memory error instead.
This fixes statuses being ignored when calling
CreateSizedCopyOfStyle. As a side effect, it cleans up
two other bugs - the font object was sometimes not
freed, and a the scaled font mutex was aquired recursively,
causing a hang in the invalid-matrix test.
This fixes multiple instances where the return value of an ATSUI
call was ignored and converts them into CAIRO_STATUS_NO_MEMORY.
As a side effect it fixes a utf8 array not being freed.
When interpreting glyph paths in ATSUI callbacks we were ignoring
the cairo status. We need to return this to the caller. In order
to do this we introduce a custom OSStatus code in the range that
Apple reccommend.
There are several places in the quartz surface where we ignored
the returned status. This fixes the simple cases where the error
can just be returned to the caller.
The patch to repeat tests for similar surfaces changed the
format of the test log files, which were parsed to produce
index.html. This fixes the parser to understand those changes.
Immediately repeat the performance test against a similar surface to
ensure that they introduce no regressions. Primarily introduced to
sanity check the change to use XShmPixmaps instead of XPixmaps in the
xlib backend, but it should be generally useful.
Having noticed strange discrepancies creeping into similar surfaces
whilst working on the xlib backend, I thought it wise to also run
the test harness against similar targets. For consistency, only
targets whose similar surface use the same backend are included.
This can be disabled by exporting CAIRO_TEST_IGNORE_SIMILAR=1.
Do not rely on the assumption that if the destination has render support
then the source has it as well - breaks when the boilerplate disables
render support for a surface.
Similarly do not set the XRender attributes on the source surface
unless it actually has a xrender_format.
When the clip mask is empty we perform actions like composite 0x0
surfaces, which results in a lot of unnecessary work and allocations.
Avoid doing work when we know everything is clip out and take the
liberty of freeing any memory associated with the clop state.
The reasoning is that right now, applications render glyphs to images,
upload it to the X server, and keep a local copy in the cache. The X
server works hard to reuse glyph renderings, by hashing glyph images and
reusing them. So we are wasting memory in cairo apps that don't use the
glyph surface after uploading to the server, which is the case if you
don't use the glyph in an image surface. The patch does not release the
glyph surface if it already existed in the cache, so, worst case
scenario is that we render the glyph twice, if you first use it with
xlib, then with image surface. That effect should be negligible.
_xrender_format_to_content() was using the channel offset to determine
whether the format supported a content type.
For example, the XRenderPictFormat for the A8 format looks like:
direct.alpha = 0; direct.alphaMask = 0xff;
direct.red = 0; direct.redMask = 0x00;
direct.green = 0; direct.greenMask = 0x00;
direct.blue = 0; direct.blueMask = 0x00;
which _xrender_format_to_content() matched as CAIRO_CONTENT_COLOR.
Switch to using the channel masks for deducing content type.
_cairo_sub_font_lookup_glyph() was returning either a NULL_POINTER
error or success whereas its only caller was using it as a simple
predicate and handled the 'error' rather than propagate it upwards.