Commit graph

101 commits

Author SHA1 Message Date
Vladimir Vukicevic
57c2b75c22 [quartz] Store the CGFontRef and reuse it for rendering
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.
2008-01-15 14:27:14 -08:00
Kouhei Sutou
3610841910 Fix typo in comment. 2008-01-11 14:40:06 -08:00
Brian Ewins
19680f545a [quartz] fix gradient-zero-stops crash (moz#407104)
Fixes failure in gradient-zero-stops test, reported
by Boris Zbarsky (thanks!) as Mozill a bug#407104.
2007-12-06 21:31:15 +00:00
Brian Ewins
e6c34bb691 [quartz] refactor gradient handling
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.
2007-12-06 21:31:14 +00:00
Vladimir Vukicevic
150564c7f8 [quartz] use rectangle_int_t, not rectangle_int16_t 2007-12-04 14:05:47 -08:00
Vladimir Vukicevic
e8574022f9 [quartz] cleanup: remove trailing whitespace 2007-12-04 13:54:32 -08:00
Vladimir Vukicevic
ee01a94726 [quartz] Use CGContextDrawTiledImage if available
Use this 10.5-only method if available, as it greatly speeds up
tiled image rendering (EXTEND_REPEAT).
2007-12-04 13:53:03 -08:00
Vladimir Vukicevic
2c25033e14 [quartz] Handle creating 0x0 surfaces
Make all 0x0 surfaces be no-ops when used in a rendering operation.
2007-12-04 13:50:49 -08:00
Brian Ewins
ba239a474a [quartz] zero memory on bitmap creation
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.
2007-11-18 20:30:49 +00:00
Brian Ewins
58e828a9a3 [quartz] fill with alpha for EXTEND_NONE
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.
2007-11-15 21:29:07 +00:00
Vladimir Vukicevic
50d5f5a4e6 [quartz] Fix gradients; the wrong color field was being used
The wrong color field was being used, effectively making gradients always
have transparent black as their color stops.
2007-11-15 11:56:56 -08:00
Brian Ewins
bcb0f57e5e [quartz] remove double malloc in dashing code.
fdash is reallocated without being released, and is
allocated at the wrong size too.
2007-11-14 01:50:34 +00:00
Brian Ewins
e6bc049465 [quartz] typo checking for malloc failure
The check after the malloc of cg_advances looked at the wrong
variable.
2007-11-13 00:43:59 +00:00
Brian Ewins
bb2674207c [quartz] fix leak in show_glyphs
In cairo_quartz_show_glyphs we may leak the source if
there is a failure to malloc the glyph arrays. Fix this.
2007-11-12 23:56:01 +00:00
Brian Ewins
7ad34c1bdc [quartz] fix for cairo_reset_clip() 2007-11-12 23:52:52 +00:00
Brian Ewins
717ccbcf0c Revert "[quartz] handle 0x0 surfaces."
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.
2007-11-12 23:51:39 +00:00
Brian Ewins
2fd50a7897 [quartz] handle 0x0 surfaces.
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.
2007-11-11 01:49:36 +00:00
Vladimir Vukicevic
f11f7524b6 [quartz] work around Quartz bugs with images bigger than a certain size
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.
2007-11-09 12:50:45 -08:00
Vladimir Vukicevic
fa7e36669a [quartz] Fix for 10.5 SDK; the FloatToFixed macro started doing strange things 2007-11-09 12:50:45 -08:00
Brian Ewins
8f6abdbc26 [quartz] return status instead of CGPatternRef
Returning status improves error handling, since
returning NULL doesn't let us distinguish different
types of error.
2007-10-20 23:41:46 +01:00
Brian Ewins
cfb26fdf0f [quartz] return status instead of cairo_quartz_surface_t
Returning status improves error handling, since
returning NULL doesn't let us distinguish different
types of error.
2007-10-20 23:41:32 +01:00
Brian Ewins
dec3099585 [quartz] return status instead of CGShadingRef
Returning status improves error handling, since
returning NULL doesn't let us distinguish different
types of error. Suggested by Chris Wilson.
2007-10-20 22:45:30 +01:00
Brian Ewins
481ce2b8cb implement clipping with surface masks.
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.
2007-10-20 14:06:07 +01:00
Brian Ewins
b9c065df74 fix dash-zero-length test
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.
2007-10-20 14:02:19 +01:00
Brian Ewins
f334ee0397 Implement EXTEND_NONE for gradients.
Fixes linear and radial gradients, which were displaying with
extend_pad when extend_none was requested. Makes the
radial-gradient test pass.
2007-10-20 14:02:17 +01:00
Brian Ewins
0eeec372c0 call _cairo_error on failure
Call _cairo_error to enable setting a breakpoint on quartz errors.
2007-10-20 14:02:16 +01:00
Brian Ewins
8c8ec63903 do not return a cairo_status_t of UNSUPPORTED
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.
2007-10-20 14:02:15 +01:00
Brian Ewins
6fec51990e do not ignore errors, return NULL instead (moz#874315)
In the quartz backend there are occasional errors where returning NULL
can be used to signal that an error has occured.

Mozilla bug #874315.
2007-10-20 14:00:15 +01:00
Brian Ewins
07fd091e3e do not ignore errors in setup_source
In setup_source we were ignoring a return value, but we can't relay
it to the caller. This patch treats the error as an unsupported
operation.
2007-10-20 13:52:09 +01:00
Brian Ewins
95c708c717 propagate cairo_status_t return values
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.
2007-10-20 13:52:08 +01:00
Chris Wilson
bed8239f03 [cairo-error] Clean up all the warnings and missing _cairo_error() calls.
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.
2007-10-04 13:31:44 +01:00
Chris Wilson
8ad56b308a [malloc/error] Add call to _cairo_error() after a failed malloc.
Blitz all allocations to ensure that they raise a
_cairo_error(CAIRO_STATUS_NO_MEMORY) on failure.
2007-10-04 00:42:30 +01:00
Chris Wilson
e8e3bfc130 Revert "[cairo-gstate] Avoid copying untransformed glyphs."
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.
2007-08-31 16:53:21 +01:00
Chris Wilson
919bea6dbb [cairo-gstate] Avoid copying untransformed glyphs.
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.
2007-08-31 16:28:06 +01:00
Vladimir Vukicevic
be3516335c [fixpt] Replace cairo_rectangle_int16_t with cairo_rectangle_int_t
Mostly s/cairo_rectangle_int16_t/cairo_rectangle_int_t/,
as well as definitions to pick cairo_rectangle_int_t.
2007-07-18 22:45:21 +02:00
Vladimir Vukicevic
0048a26a44 [fixpt] Make fixed point methods static inline and generic
Move the fixed point methods to static inline versions in
cairo-fixed-private.h, and don't hardcode fixed to be 16.16.
2007-07-18 22:45:21 +02:00
Vladimir Vukicevic
76c32f899a [fixpt] Update quartz surface for new types 2007-07-18 13:08:39 -07:00
Vladimir Vukicevic
5c7d2d14d7 [fix] Avoid int overflow when allocating large buffers
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.
2007-06-29 09:46:08 -07:00
Brian Ewins
fd1edaa5d3 [quartz] remove unused code
clean up warnings about unused code: removing 
_cairo_quartz_cairo_path_to_quartz_path and the functions
it calls.
2007-06-13 01:27:36 +01:00
Brian Ewins
d7a0816ec3 [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.
2007-06-13 01:27:36 +01:00
Brian Ewins
bf39b28b77 commit 75be87b4093aaa7f477d587d5a68308cade1b29c
[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.
2007-06-13 01:27:36 +01:00
Brian Ewins
2034d1dbd5 [quartz] pass quartz_stroke_t not CGContextRef
Fix a typo where an incompatible pointer was being passed.
2007-06-13 01:27:36 +01:00
Vladimir Vukicevic
00063a65f7 [quartz] fix DO_IMAGE
The implementation of DO_IMAGE leaks memory via a referenced surface,
and wasn't applied for strokes and glyphs. This patch corrects those
issues.
2007-06-08 01:46:27 +01:00
Brian Ewins
39e6a0090f [quartz] fall back on extended gradients
A temporary fix for mozilla bug 379321, use an image fallback for
gradients that use EXTEND_REPEAT or EXTEND_REFLECT.
2007-06-08 01:46:27 +01:00
Brian Ewins
7c1afdcd59 [quartz] fixes the offsets in the font-matrix test
Apply the font matrix offset to text on the quartz surface, if necessary.
2007-06-08 01:46:26 +01:00
Brian Ewins
55f1dbd0fb [quartz] ensure that line widths are scaled.
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.
2007-06-08 01:46:25 +01:00
Brian Ewins
b210b09e2d [quartz] implement CAIRO_EXTEND_REFLECT
Implement extend-reflect by tiling a larger 2x2 grid of reflected
images.
2007-06-08 01:46:24 +01:00
Brian Ewins
fa5dd548b0 [quartz] implement CAIRO_EXTEND_NONE
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..
2007-06-08 01:46:23 +01:00
Brian Ewins
147288864c [quartz] Refactor code to create a CGImageRef from a pattern
In order to implement CAIRO_EXTEND_NONE we will need to create
a CGImageRef without also creating a CGPattern. Separate the two
pieces of code.
2007-06-08 01:46:23 +01:00
Boris Zbarsky
fcdfda8365 [quartz] implementing release_source_image (#11059)
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
2007-05-24 23:48:01 +01:00