Commit graph

3731 commits

Author SHA1 Message Date
Chris Wilson
ebe3048f9b [directfb] Cap the maximum surface size to use for the font cache.
Fallback if we need to create a cache larger than the maximum usable
surface.
2008-10-20 23:20:23 +01:00
Chris Wilson
6f35c2d13e [directfb] Only use the pure BLIT for integer translations.
If we have non-integer translation on a source pattern then we need to use
STRECTHBLIT (the core takes care to optimize NEAREST patterns to integer
translations so that this will only be used when interpolation is
required).
2008-10-20 23:20:23 +01:00
Chris Wilson
55bb7087b0 [directfb] Tweak _categorize_operation().
Explicitly list the extend modes that are supported/unsupported and
immediately check for an unsupported operation.
2008-10-20 23:20:23 +01:00
Chris Wilson
edb65213ec [directfb] Support ROI cloning.
Only clone the ROI in order to efficiently handle large sources.
2008-10-20 23:20:23 +01:00
Chris Wilson
4006e49ac1 [directfb] Rename backend structure.
Use _cairo_directfb_surface_backend for consistency with other backends.
2008-10-20 23:20:23 +01:00
Chris Wilson
7e31ddbb08 [directfb] Whitespace.
Trim lots of trailing whitespace and fix up according to CODING_STYLE.
2008-10-20 23:20:23 +01:00
Chris Wilson
d49563280b [directfb] Simplify return from _directfb_get_operator().
Used only as a predicate, so simply return a boolean.
2008-10-20 23:20:22 +01:00
Chris Wilson
b17d0ded8c [directfb] Use the solid pattern cache.
The dfb backend recreated a solid color surface for every colour,
completely bypassing the solid pattern cache.
2008-10-20 23:20:22 +01:00
Behdad Esfahbod
83d2552e4c Remove CAIRO_BEGIN_DECLS uses that ickle introduced while merging 2008-10-20 17:59:41 -04:00
Chris Wilson
eab37f76b0 [directfb] Return an error surface on create() failure.
Do not return NULL but an NO_MEMORY error surface if we fail to allocate
the surface during creation.
2008-10-19 22:12:18 +01:00
Chris Wilson
6a02f53dd1 [directfb] Simplifiy ADD_TRI
Simplify the ADD_TRI macro to make the code more readable.
2008-10-19 14:21:15 +01:00
Chris Wilson
aba457fe64 [directfb] Add missing error status
We jumped to the ERROR path without setting an error status - assume
NO_MEMORY.
2008-10-19 14:03:24 +01:00
Chris Wilson
610451e4a7 [directfb] Correct fixed-to-double conversion.
The trapezoid calculations had not been updated after the 16.16->24.8
switch. Use _cairo_fixed_to_double() rather than open-coding.
2008-10-19 12:45:45 +01:00
Chris Wilson
801df1b87a [directfb] Fix error propagation from surface_create()
Do not mask fatal errors, but correctly propagate the error status.
2008-10-19 12:32:30 +01:00
Chris Wilson
476d17fa78 [directfb] Compile fix.
Fixup compilation after 901f0b.
2008-10-19 11:35:27 +01:00
Chris Wilson
d72969289d [image] Remove unused variable.
Cleanup the compiler warning for the unused status after code shuffling.
2008-10-19 09:47:33 +01:00
Chris Wilson
41c8eefc6d [output-stream] Protect against NULL write_func.
Allow the user to specify a NULL write_func for the output stream so that
a dummy surface can be created, for example, for querying target font
options or font extents.

Currently we do not perform any sanity checks at the user entry point and
will generate a mysterious SEGV during cairo_surface_finish() - which may
not immediately be obvious that it is due to a NULL write_func.
2008-10-19 09:36:53 +01:00
Chris Wilson
84e4a825ff [output-stream] Accept a NULL filename
Principally to support creating a dummy vector surface (i.e.
cairo_ps_surface_create (NULL, 1, 1)) that can be used to determine font
extents (or target font options) before opening an output file, but also
because we currently fail to do any sanity checking at the entry point.
2008-10-19 09:36:53 +01:00
Chris Wilson
52ea38f97b [meta] Acquire scaled_font mutex for glyph_path().
The caller of _cairo_scaled_font_glyph_path() is expected to be holding
the scaled_font->mutex.
2008-10-19 09:36:52 +01:00
Chris Wilson
299ea0580a [user-font] Review locks under error conditions.
Simplify the error handling by only relinquishing the global
scaled_font_map mutex if we successfully insert the placeholder font. The
result is that on the error path, there are no changes to global state and
thus we can entirely skip the user-font initialisation and
re-registration.
2008-10-19 09:36:52 +01:00
Chris Wilson
c76a8481f3 [analysis] Check for error surfaces.
If the target surface is an error surface, ensure that we return the
appropriate error surface. Likewise, avoid writing to error surfaces.
2008-10-19 09:36:52 +01:00
Chris Wilson
5b28b0b903 [ps] Destroy type3 surface on error.
After an error, ensure that the local type3 surface is destroyed.
2008-10-19 09:36:52 +01:00
Chris Wilson
6b17c6da47 [type3] Acquire scaled_font mutex whilst looking up glyphs.
When looking up the glyph in the shared scaled_font glyph cache, the
caller is required to have taken the scaled_font->mutex.
2008-10-19 09:36:51 +01:00
Chris Wilson
f56cf93181 [user-font] Check for error objects.
Check that the user has not passed in an inert error object before any
attempts to write to it and return the default values.
2008-10-19 09:36:51 +01:00
Chris Wilson
1f9f9d936b [pdf] Acquire scaled_font mutex for show_text_glyphs().
We need to be holding the scaled font mutex over a call to draw text
glyphs from within an smask group.
2008-10-19 09:36:51 +01:00
Chris Wilson
12fb8c9b7c [type1] Acquire scaled_font mutex.
In order to perform glyph lookups we need to be holding the mutex for the
scaled_font.
2008-10-19 09:36:51 +01:00
Chris Wilson
ca5f868a73 [scaled-font] Zero font extents for an error surface.
Do not attempt to read from the error object, but just return zero
extents.
2008-10-19 09:36:51 +01:00
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
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
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
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
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
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
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
Chris Wilson
0d3e152d2f [check-doc-syntax.sh] Allow quoting.
func_regexp was incorrectly complaining that cairo_pure was a function without
parenthesis. The simplest solution appeared to be allow quoting of
'cairo_pure'.
2008-10-14 13:44:47 +01:00
Chris Wilson
02a7ca80f9 [pattern] Correctly optimize away fractional translations.
As is so often the case, reading the commit log gives you fresh insight in
the problem - often called confessional debugging...

We can simplify the problem by ignoring attr->[xy]_offset, for the time
being, and focus on computing the correct matrix. This is comparatively
simple as all we need to do is perform the appropriate rounding on the
translation vector.
2008-10-14 11:08:43 +01:00