Commit graph

6119 commits

Author SHA1 Message Date
Chris Wilson
1ddf0b2a5c [surface] Reorder asserts to make no assumptions about error objects.
If the surface is in error, then we cannot assume anything about the
validity of its contents other than the error status (and reference
count). This is for the cases were the surface is replaced by a nil
surface, and in future where the error surface may be replaced by a tiny
error object.
2008-10-19 09:36:50 +01:00
Chris Wilson
644e78ca4e [svg] Lock the scaled_font whilst emitting glyphs.
We need to hold the scaled_font mutex whilst looking upon glyphs so lock
the font whilst iterating over the font subset.
2008-10-19 09:36:50 +01:00
Chris Wilson
4587e9e4f5 [scaled-font-subsets] Add locking to unscaled font.
During map_glyph() we are passed a locked scaled_font for which we are
asked to add a glyph from that font into the active subsets for the
surface. This means that we eventually call scaled_glyph_lookup() to load
the glyph. But first, we attempt to find an existing an existing sub_font
for glyph, creating a new sub_font as necessary (possibly using an
entirely different unhinted scaled font). So before accessing the glyph
cache we need to make sure that we are holding the appropriate mutexes.
2008-10-19 09:36:50 +01:00
Chris Wilson
d3a6651237 [xlib] Set return code after failing to allocate glyph surface.
Although we checked for an allocation error, we missed propagating the
status to the return error code.
2008-10-19 09:36:50 +01:00
Chris Wilson
bfc3a72cff [gstate] Propagate error from clip.
During clip transformation we query the clip extents which can trigger a
fatal error. Check and propagate.
2008-10-19 09:36:50 +01:00
Chris Wilson
7975cf3f2c [paginated] Free local reference to target on error path.
On the error path we must destroy the local reference to the target
surface.
2008-10-19 09:36:50 +01:00
Chris Wilson
4662204a2a [test-paginated] Fix double free of surface along error path.
The ownership of the surface is transferred to the paginated surface, so
we do not need to destroy it ourselves along the error path.
2008-10-19 09:36:49 +01:00
Chris Wilson
bf3202fcfd [xlib] Fix double free of Pixmap along error path.
If the paint fails then we attempt to free the Pixmap ourselves and via
the cairo_surface_destroy (as it also believes that it owns the Pixmap).
2008-10-19 09:36:49 +01:00
Chris Wilson
901f0b540c Review backend->create_similar()
Avoid masking fatal errors by enforcing any error to be returned via an
error surface, so that the NULL return only means UNSUPPORTED. A few
backends called their create_similar() directly, without correctly checking
for a potential NULL (for example, the directfb backend was a timebomb,
since it used NULL to indicate out-of-memory).
2008-10-19 09:36:49 +01:00
Chris Wilson
9529699028 [test/user-font-rescale] Check and propagate errors.
We need to check the error status on set_user_data() to be sure that the
data has been set and error otherwise.
2008-10-19 09:36:49 +01:00
Chris Wilson
683de2fea2 [test/user-font[-proxy]] Check for error from set_user_data().
Check in case we fail to attach our user_data.
2008-10-18 09:55:15 +01:00
Chris Wilson
1983929900 [test/bitmap] Leak on error path.
Free the FcPattern on error.
2008-10-18 09:55:15 +01:00
Chris Wilson
0409be426c [test/font-matrix-translation] Check for OOM
First check that querying the extents did not trigger NO_MEMORY.
2008-10-18 09:55:08 +01:00
Chris Wilson
21360bf674 [test/source-surface-big-scaled-down] Propagate error.
Propagate error to source.
2008-10-18 09:55:07 +01:00
Chris Wilson
794160c35b [test/surface-pattern] Propagate error.
Use cairo_get_target() to propagate error from secondary context.
2008-10-18 09:55:07 +01:00
Chris Wilson
0f48cce8d9 [test/source-clip-scale] Propagate error.
Use cairo_get_target() to propagate error from secondary context.
2008-10-18 09:55:07 +01:00
Chris Wilson
6cdbd132ce [test/source-clip] Propagate error.
Use cairo_get_target() to propagate error from the secondary context.
2008-10-18 09:55:07 +01:00
Chris Wilson
f86f233b3e [test/smask] Propagate error.
Use cairo_get_target() to propagate errors from the secondary context.
2008-10-18 09:55:07 +01:00
Chris Wilson
4490a6c363 [test/stroke-image] Propagate error
Use cairo_get_target() to propagate errors from the secondary context.
2008-10-18 09:55:07 +01:00
Chris Wilson
6e6d7e52a3 [test/mask] Propagate error from secondary context.
Reset the source every time so that the error is propagate from the
secondary context using cairo_get_target().
2008-10-18 09:55:07 +01:00
Chris Wilson
a56d4530d6 [test/smask-text] Propagate error.
Use cairo_get_target() to propagate error from the secondary context.
2008-10-18 09:55:07 +01:00
Chris Wilson
b1e884cd89 [test/smask-stroke] Propagate error.
Use cairo_get_target() to propagate the error from the secondary context.
2008-10-18 09:55:07 +01:00
Chris Wilson
546fbc2c0c [test/smask-paint] Propagate error.
Use cairo_get_target() to propagate errors from the secondary context.
2008-10-18 09:55:06 +01:00
Chris Wilson
8bd6913282 [test/smask-mask] Propagate error.
Use cairo_get_target() to propagate errors from the secondary contexts.
2008-10-18 09:55:06 +01:00
Chris Wilson
9c0fe6c61e [test/smask-image-mask] Propagate error.
Use cairo_get_target() to propagate any error status from the secondary
context.
2008-10-18 09:55:06 +01:00
Chris Wilson
373d6c76b6 [test/smask-fill] Propagate error status.
Use cairo_get_target() to propagate the error from the secondary context.
2008-10-18 09:55:06 +01:00
Chris Wilson
bb05beaab6 [test/show-glyphs-many] Check for NO_MEMORY
As we do a manual status check, we need to perform a full check.
2008-10-18 09:55:06 +01:00
Chris Wilson
c0a4ef76e1 [test/composite-integer-translate-over-repeat] Propagate error.
Use cairo_get_target() to propagate any errors from the secondary context.
2008-10-18 09:55:06 +01:00
Chris Wilson
4a9e0f0e5b [test/mask] Propagate error from secondary context.
Use cairo_get_target() to infect the primary context with any errors
raised whilst drawing the mask.
2008-10-18 09:55:06 +01:00
Chris Wilson
eaec1caa94 [test/ft-text-*] Check for errors from fontconfig.
If a match cannot be found, or if any other error occured, then fontconfig
will return NULL. Check and propagate.
2008-10-18 09:55:06 +01:00
Chris Wilson
336eddfdbb [test/get-clip] Check the status on the secondary context.
As we solely use a secondary context, we must manually report NO_MEMORY
errors whilst running under memfault.
2008-10-18 09:55:06 +01:00
Chris Wilson
d48f934051 [test/clip-operator] Propagate error from secondary context.
Use the cairo_get_target() to propagate any errors from the secondary
context.
2008-10-17 22:52:47 +01:00
Chris Wilson
d11014386f Add support for lockdep.
lockdep is a valgrind skin which performs pthread locking correctness
validation. In particular it allows one to write assert(HOLDS_LOCK(mutex))
which both documents the preconditions for a function and enforces them
when the program is run under lockdep.

As an aide to lockdep (as it works by intercepting the pthread functions),
all the mutexes should be initialised and destroyed using
pthread_mutex_init() and pthread_mutex_destroy() rather than using static
initializers and no-ops.
2008-10-17 22:52:47 +01:00
Chris Wilson
bccfdf7d93 [test] Add support for memfault.
Add the core support to cairo-test for running the test-suite under a
malloc fault injector. This commit contains the adjustments to
cairo_test_run() to repeat the test if it detects a failure due to fault
injection and complains if it detects unreported faults or memory leaks.
2008-10-17 22:52:47 +01:00
Chris Wilson
974fabfe05 [ft] Add more comments about FT_Face lifetime issues.
Currently we only have an example of how to call FT_Done after the last
reference to the FT cairo_font_face_t has been dropped, but do not
actually explain why this needs to be done. So add a couple of sentences
to clarify the likely lifetime of the FT_Face once exposed to cairo.
2008-10-17 22:52:47 +01:00
Chris Wilson
5fcfc7ebc9 [test/README] Document all fonts used.
Do a little leg-work to answer a query in a bug report and document the
results.
2008-10-17 10:38:55 +01:00
Chris Wilson
c1164a574d [type1] Add comment to warn about read() as macro.
In case we are ever tempted to simplify the function pointer, warn that it
may alias with a macro.
2008-10-16 17:19:00 +01:00
Adrian Johnson
ff9ee74b37 Revert unintended changes to test/fallback-resolution.c in the previous commit 2008-10-16 17:29:33 +10:30
Adrian Johnson
5911c6966d Use correct inverse ctm for stroke in meta surface replay
This fixes #9189 Dashed strokes too long in fallback images
2008-10-16 17:22:48 +10:30
Chris Wilson
6afcd82118 [test] Add a spline test.
Test the decomposition of 5 different types of spline curve. Useful test
for future experiments in improving the decomposition algorithm.

Note: the vector targets all need separate reference images due to their
lack of support for cairo_set_tolerance(). Also GS strokes the Bezier
curve differently using offset curves and opposed to transcribing the
outline of a pen.
2008-10-15 23:27:11 +01:00
Chris Wilson
91b0dc92c8 [build] Add -fno-common.
Generate a warning if two files define a global variable with the same
name, instead of silently merging them to reference the same location.
2008-10-15 23:12:22 +01:00
Jeff Muizelaar
b94b600b34 [quartz] Completely remove CAIRO_HAS_QUARTZ_IMAGE_SURFACE check
Instead of fixing the check in d36b02dc66, just
remove it. Conditionally compilation will keep cairo-quartz-image-surface.c
from being compiled in when it is not configured to be. Suggested by Behdad.
2008-10-15 13:41:03 -04:00
Jeff Muizelaar
d36b02dc66 [quartz] Rebalance 'CAIRO_HAS_QUARTZ_IMAGE_SURFACE' #ifdef
Fixes compilation by re-adding '#ifdef CAIRO_HAS_QUARTZ_IMAGE_SURFACE' which
was, I assume, unintentionally removed by
2cf4b3161c.
2008-10-15 12:45:11 -04:00
Jeff Muizelaar
83162360a4 Fix quratz_image typo in Makefile.sources. 2008-10-15 10:34:12 -04:00
Chris Wilson
877e77fa3e [glitz] Disable caching of solid surfaces.
glitz currently has no mechanism to release resources upon connection
closure (ala XCloseDisplay) and so will attempt invalid accesses when
evicting old surfaces from the solid pattern cache.
2008-10-15 12:20:00 +01:00
Chris Wilson
fc04a1e0db [boilerplate] Fixup compilation for gliitz.
Convert a few old references to cairo_boilerplate_surface_set_user_data.
2008-10-15 12:13:40 +01:00
Chris Wilson
e17f02add0 [type1] Protect against read macro
POSIX allows for any of its functions to be implemented as a macro,
inflicting damage upon innocent function pointers that happen to share
the same name.

face->stream->read() is one such example.

As it's outside of our control (being a FT_Face) we cannot simply rename
the data member, so we need to explicitly dereference it as a function
pointer in order to disambiguate it for the compiler.
2008-10-15 10:52:33 +01:00
Chris Wilson
bc872a5f5f [xlib] Handle 4,20,24,28 depth XImages
Bug 9102 cairo doesn't support 24 bits per pixel mode on X11
(https://bugs.freedesktop.org/show_bug.cgi?id=9102)
is a reminder that that we need to support many obscure XImage formats.
With Carl's and Behdad's work to support psuedocolor we have a mechanism
in place to handle any format that is not natively handled by pixman. The
only piece we were missing was extending the swapper to handle all-known
formats and putting in defensive checks that pixels were correctly aligned
in accordance with pixman's requirements.
2008-10-15 10:21:05 +01:00
Chris Wilson
1728fa3520 [svg] Add notes about why we shouldn't add DOCTYPE.
Emmanuel Pacaud did some research into adding DOCTYPE after we had a
complaint that our SVG output failed to be validated by batik. The
conclusion he came to was that the validation of SVG was incomplete and
misleading, i.e. our output might generate false negatives leading to more
confusion.
2008-10-15 09:23:01 +01:00
Chris Wilson
e9f5ee6efe [doc] Fix a few gtk-doc errors.
gtk-doc insists on a non-empty long description, even for trivial
functions that are fully described by their input arguments and return
value. Grrr.
2008-10-14 14:42:48 +01:00