Commit graph

4240 commits

Author SHA1 Message Date
Chris Wilson
6fdb7f129c Simplify return value from cairo_path_fixed_get_current_point().
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.
2007-10-30 10:43:55 +00:00
Chris Wilson
4a2ab87e1a [cairo-surface] Add the usual guards to _cairo_surface_set_font_options().
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.
2007-10-29 12:04:33 +00:00
Chris Wilson
bb6d36561c [test/get-path-extents] Add link to bug report.
Add a link to the original bug report for the broken extents with arcs.
[http://bugs.freedesktop.org/show_bug.cgi?id=7245]
2007-10-27 17:29:54 +01:00
Carl Worth
a69d473130 Fix typo in _cairo_gstate_fini
Obrigado a Luiz Americo Pereira Camara <luizmed@oi.com.br>
2007-10-26 22:58:57 -07:00
Chris Wilson
0c02b998f9 [cairo-gstate] Allow angle==0 whilst rotating.
Cut'n'paste error whilst copying the NaN check from
_cairo_gstate_scale() flagged the no rotation case as an error.
2007-10-26 18:07:31 +01:00
Chris Wilson
ce44cd6523 [cairo-gstate] Add a missing _cairo_error() markup.
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.
2007-10-25 01:02:03 +01:00
Chris Wilson
4ce785e6a9 [cairo-gstate] Add NaN check to rotate.
Check the user input to _cairo_gstate_rotate() for invalid numbers.
2007-10-25 01:00:55 +01:00
Chris Wilson
6295a296b0 [cairo-gstate] Check scale sx * sy != 0.
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.
2007-10-25 01:00:30 +01:00
Chris Wilson
483ebe866d [cairo-test] Remove executable flag from source files.
chmod a-x test/cairo-test.[ch]
2007-10-24 19:33:22 +01:00
Chris Wilson
1651359ffb [cairo-perf-diff-files] Only use a valid initializer for min_test.
Do not assume that the tests[0] is a valid test, but instead scan for
the first test that has a name (i.e. is not a terminator).
2007-10-24 19:33:19 +01:00
Chris Wilson
38c779e7d6 [cairo-perf-diff-files] Check for terminator before comparing tests.
Only the name of the terminating test is set so check that the current
test is not the terminator before comparing.
2007-10-23 13:03:40 +01:00
Chris Wilson
e3248a2184 [cairo-matrix] Check user input for invalid numbers.
Supplement the guards for scale==0 with checks that the user does not
attempt to translate or scale by invalid numbers.
2007-10-22 17:16:50 +01:00
Adrian Johnson
8888afe9a4 PDF: Fix meta surface patterns with EXTEND_REFLECT 2007-10-22 23:05:25 +09:30
Adrian Johnson
f073a83251 win32-printing: fix error in comment 2007-10-22 00:02:23 +09:30
Adrian Johnson
fb2bf3e250 win32-printing: remove unused code 2007-10-21 23:50:57 +09:30
Adrian Johnson
b854d1e1b5 win32-printing: fix typo in comment 2007-10-21 23:50:28 +09:30
Adrian Johnson
2d68c46b77 win32-printing: fix dash-caps-joins test failure 2007-10-21 23:49:58 +09:30
Adrian Johnson
5fa6225045 win32-printing: Add test boilerplate
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.
2007-10-21 23:49:33 +09:30
Adrian Johnson
e63b5e5201 win32-printing: Use the surface ctm in show_glyphs
show_glyphs needs to scale the font by the current CTM.
2007-10-21 23:47:35 +09:30
Adrian Johnson
ac9831ea55 win32-printing: fix stroke rounding problems
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.
2007-10-21 23:46:52 +09:30
Adrian Johnson
89fe7b2ff0 win32-printing: fix rounding problems when using pattern matrix
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.
2007-10-21 23:45:40 +09:30
Adrian Johnson
af01d9b8fa win32-printing: add meta surface pattern support 2007-10-21 23:43:27 +09:30
Adrian Johnson
dae1b352c6 update cairo-sections.txt 2007-10-21 23:42:54 +09:30
Adrian Johnson
c8da2a7ded win32-printing: check if images are opaque
Don't use fallback for argb32 images with all alpha == 255.
2007-10-21 23:42:22 +09:30
Adrian Johnson
9eb5747755 win32-printing: Add missing struct initializers 2007-10-21 23:41:31 +09:30
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
b6b9cef713 do not ignore errors when creating styles.
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.
2007-10-20 13:52:08 +01:00
Brian Ewins
4885a12c68 do not ignore ATSUI errors.
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.
2007-10-20 13:52:08 +01:00
Brian Ewins
b498c928be do not ignore errors in glyph paths
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.
2007-10-20 13:52:08 +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
Brian Ewins
7072959e3d Fix to support new similar tests.
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.
2007-10-20 13:52:08 +01:00
Chris Wilson
ae2535e4cb [cairo-perf] Run performance tests over similar surfaces as well.
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.
2007-10-20 00:32:00 +01:00
Chris Wilson
081507a09e [cairo-test] Repeat tests for similar surfaces.
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.
2007-10-20 00:15:34 +01:00
Chris Wilson
3211d810d3 [cairo-xlib] Check source for XRender support.
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.
2007-10-19 23:33:22 +01:00
Chris Wilson
5c08226a0f [cairo-clip] Avoid work when all clipped out.
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.
2007-10-19 23:33:04 +01:00
Chris Wilson
c70c2cf6d6 [Makefile.am] Fix ${top_srcdir}/libtool
libtool exists in the top level build directory, but in a couple of
places we refer to the top level source directory.
2007-10-19 23:31:36 +01:00
Behdad Esfahbod
76e3b3cdc3 [cairo-xlib] Release glyph surfaces if we made them to be generated
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.
2007-10-19 15:02:03 -04:00
Chris Wilson
8ae7782737 [cairo-xlib-surface] Match content to xrender_format using the channel masks.
_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.
2007-10-18 20:09:54 +01:00
Chris Wilson
b7d8763c58 [check-plt] Use -W flag to readelf.
Pass -W to readelf so that the output (in particular the function name)
is not clipped to fit within 80 characters.
2007-10-18 20:09:54 +01:00
Chris Wilson
01eb169773 [test/.gitignore] Add *.exe.so
Ignore these winegcc output files.
2007-10-18 20:09:54 +01:00
Chris Wilson
c64335a9a8 [cairo-scaled-font-subsets] Simplify boolean return code.
_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.
2007-10-18 19:21:35 +01:00