Previously the CGFontRef was recreated each time in show_glyphs; this
caused the font to get re-embedded in any PDF files that were being
generated through Quartz.
Avoid checking the gradient type twice. This refactor
also makes it easier to check when the gradient has no stops,
and will make it easier to separate out the different
implementations of EXTEND_REPEAT, REFLECT for linear and
radial gradients.
7 quartz/argb32/similar tests were showing failures due to
random bits being set. The problem turned out to be that the
initial test surface was not cleared before the similar surface
was created by push_group. The problem behaviour is more obvious
if you run the tests with MallocScribble=1.
Fix this by calling memset after bitmap allocation; the multiplication
here cannot overflow since we already checked that in malloc_ab.
The implementation of EXTEND_NONE was not filling areas outside
the image with rgba(0,0,0,0). This showed up on the operator-source
test, the fix makes the quartz and image renderings identical.
This reverts commit 2fd50a7897.
Spoke too soon, quartz doesn't like creating those 0x0
images; while the tests pass, its putting warnings in the logs.
Reverting to make a better fix.
Some tests, like invalid-matrix, generate a 0x0 bitmap; in
the quartz backend this caused a nil surface to be returned,
whereas the tests expect a quartz surface. Other surfaces
return a backend-specific surface with a zero-sized bitmap,
quartz should do the same.
Fixes the tests ft-font-create-for-ft-face, get-and-set,
get-clip, invalid-matrix, line-width-zero,
select-font-no-show-text, solid-pattern-cache-stress,
surface-finish-twice, and text-cache-crash.
Quartz has a bug with images greater than (signed) 16 bits in height; avoid
creating or working with those. Also fixes some memory leaks.
Patch from John Daggett.
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.
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.
Every time we assign or return a hard-coded error status wrap that value
with a call to _cairo_error(). So the idiom becomes:
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
or
return _cairo_error (CAIRO_STATUS_INVALID_DASH);
This ensures that a breakpoint placed on _cairo_error() will trigger
immediately cairo detects the error.
This reverts commit 919bea6dbb.
Sadly as Behdad points out some backends do modify the glyph array and,
for example cairo-xlib-surface, hide this from the compiler with some
evil casts.
Skip the memory duplication of the incoming glyphs if we do not need
to transform them into the backend coordinate system.
As a consequence we need to constify the glyphs passed to the backend
functions.
This patch introduces three macros: _cairo_malloc_ab,
_cairo_malloc_abc, _cairo_malloc_ab_plus_c and replaces various calls
to malloc(a*b), malloc(a*b*c), and malloc(a*b+c) with them. The macros
return NULL if int overflow would occur during the allocation. See
CODING_STYLE for more information.
[quartz] move glyph array declarations
Move declarations causing a warning. A separate patch from
the other warning cleanups because it moves where the allocation
happens.
cairo-gstate applies the ctm to the coordinates used in paths,
but not to the line width. In quartz this ends up drawing unscaled
lines. This is a minimal fix - it undoes the scaling applied to the
points and then draws the path scaled correctly.
Implement extend-none for surface patterns, by using a single
DrawImage where possible. There is some code duplication in this
patch, to make it easier to edit this patch series without conflicts.
A patch to remove duplicate code will be required later..
The image surface that _cairo_quartz_surface_acquire_source_image creates never
seems to be released, probably because there is no release_source_image callback
in the quartz code.
The attached patch fixes that problem, at least insofar as the image surface
itself is no longer leaking. I'm not sure whether any other cleanup needs to
happen here.
-Boris