Commit graph

3764 commits

Author SHA1 Message Date
Chris Wilson
9d2189afbd [pattern] Do not recompute the inverse if setting an identical matrix.
More micro-optimisation.
2008-10-30 17:14:27 +00:00
Chris Wilson
2c277ddbea [matrix] Avoid error correction overhead for translation matrices.
We can only correct rounding errors between cairo and pixman matrices for
scaled matrices - so skip the inversion and point transformation overhead
for simple translation matrices.
2008-10-30 17:14:27 +00:00
Chris Wilson
57a1d932f3 [array] Rearrange user_data_fini() to optimize common case.
Micro-optimisation to avoid the _cairo_array_index() for the common case
of 0 elements.
2008-10-30 17:14:27 +00:00
Chris Wilson
2852127c72 [cairoint] Add a few cairo_pure.
Start marking up the prototypes with function attributes - first the
obvious pure functions.
2008-10-30 17:14:27 +00:00
Chris Wilson
cf072c7203 [sdl] Add new backend.
Add a new backend to allow easy interoperability with the Simple
DirectMedia Layer.
2008-10-30 17:04:53 +00:00
Chris Wilson
540f555840 [analysis] Only limit to mask extends if bounded by mask.
The extents of cairo_mask() is only limited to the mask if the operation
is bounded by the mask.
2008-10-30 16:19:54 +00:00
Chris Wilson
4b29988939 Review users of cairo_rectangle_int_t for incorrect unsigned promotion.
Adrian Johnson discovered cases where we mistakenly compared the result
of unsigned arithmetic where we need signed quantities. Look for similar
cases in the users of cairo_rectangle_int_t.
2008-10-30 16:19:38 +00:00
Chris Wilson
0e4156121f [rectangle] Fix unsigned promotion whilst computing intersect.
_cairo_rectangle_intersect() incorrectly allows unsigned promotion during
its arithmetic.
2008-10-30 16:19:26 +00:00
Chris Wilson
2464b8a0a9 [pattern] Allow the projected surface extents to be negative.
In order to handle projection of analysis surface with user-fonts we need
to accommodate patterns extending into negative coordinate space.
2008-10-30 16:19:11 +00:00
Chris Wilson
d5d29075bd [gstate] Allocate temporary variable for backend_to_user transform.
_cairo_gstate_backend_to_user_rectangle() requires that its input
arguments are non-NULL and describe the input rectangle to be transformed.
However, we were passing through output parameters from the public API
which were allowed to be NULL. So we need to allocate temporary variables
in which to compute the output rectangle, but only copy them as required.
2008-10-30 16:16:09 +00:00
Chris Wilson
42711a5586 [xlib] Fix _draw_image_surface() with opaque images.
If the image was opaque with no alpha channel, we filled the output alpha
with 0. Typically, the destination surface for dithering is an RGB window,
so this bug went unnoticed. However, test/xlib-expose-event is an example
where we generate an intermediate alpha-only pixmap for use as a stencil
and this was failing as the mask was left completely transparent. The
simple solution is to ensure that for opaque images, the output alpha is
set to the maximum permissible value.
2008-10-30 10:00:30 +00:00
Chris Wilson
c3940d342a [xlib] whitespace
Tweak the whitespace to lose some unnecessary line wrapping, casts and
blanks.
2008-10-30 10:00:30 +00:00
Carl Worth
a824d284be Remove the ability to select the internal font face with a name of "cairo".
It's not fair to steal this name from the namespace of family names.
There are definitely cairo.ttf files that exist out there, and people
may already be using these, (or may use them in the future), with
cairo_select_font_face and a family name of "cairo".

In place of this, we'll want to come up with some other new, and
documented API for selecting the internal font face.
2008-10-29 16:21:42 -07:00
Chris Wilson
1327ec232c [image] Remove invalid assert.
The assert can fail for an error surface.

TODO: Decide what values should be returned from getters for error
surfaces.
2008-10-28 10:00:38 +00:00
Chris Wilson
9481d999df [image] Check create_for_data() to ensure a valid minimum stride.
Double check that the user is not being silly by passing in a stride that
is too small for the width. evince/poppler is one such example...
2008-10-28 09:59:01 +00:00
Chris Wilson
22e2dac819 [stroke] Ensure we record the first face for a dashed path.
If the first face was outside the bounds then we skipped it, and so a
close would incorrectly connect to the first visible face.
2008-10-26 10:25:31 +00:00
Chris Wilson
64fb3290f0 [stroke] _cairo_stroker_line_to_dashed() whitespace
A couple of comment spelling mistakes and rearrange whitespace to more
closely match CODING_STYLE.
2008-10-26 10:25:26 +00:00
Chris Wilson
e6219f7116 [win32] Correct error paths in text_to_glyphs().
Carl spotted that 1db894 introduced an error into text_to_glyphs() such
that following an allocation error the code would attempt to thaw an
unfrozen glyph cache, leading to an attempt to unlock an unlocked mutex -
which causes a deadlock under win32.
2008-10-22 17:55:44 +01:00
Chris Wilson
954ebacb71 Map toy font face to implementation.
Quartz fonts and user fonts use an indirect font face when creating a
scaled font for the toy font face. This means that they insert a scaled
font into the font map that has a different font face to the one that is
initially searched upon. The result is that when we try to create an
identical scaled font, we fail to find the existing scaled font and
attempt to insert a duplicate into the hash table - which triggers an
assert.

In order to avoid creating duplicate fonts, we add a new method to the
font backends that allows cairo_scaled_font_create() to peek at the
font_face that will be used to actually implement the scaled font
constructor - thus we are able to use the correct font_face as part of the
hash key.
2008-10-22 16:38:12 +01:00
Adrian Johnson
5e4a1cb0b8 Don't add a notdef glyph to Type 3 font subsets
This allows user-fonts to use glyph 0 when embedding in PS/PDF.
According to ISO32000 Type 3 fonts do not require a notdef glyph.
2008-10-22 22:00:31 +10:30
Chris Wilson
170686d4b0 [cairoint] Remove the duplicate prototype.
In the previous commit I added comments and a duplicate prototype. Remove
the duplicate - but keep the comments.
2008-10-22 01:01:06 +01:00
Chris Wilson
1db8949f2b Ensure that the scaled font is frozen for the lifetime of the scaled glyph.
After discussing the scaled font locking with Behdad, it transpired that it
is not sufficient for a font to be locked for the lifetime of a scaled glyph,
but that the scaled font's glyph cache must be frozen for the glyph'
lifetime.  If the cache is not frozen, then there is a possibility that the
glyph may be evicted before the reference goes out of scope i.e. the glyph
becomes invalid whilst we are trying to use it.

Since the freezing of the cache is the stronger barrier, we remove the
locking/unlocking of the mutex from the backends and instead move the
mutex acquisition into the freeze/thaw routines. Then update the rule on
acquiring glyphs to enforce that the cache is frozen and review the usage
of freeze/thaw by all the backends to ensure that the cache is frozen for
the lifetime of the glyph.
2008-10-22 00:53:55 +01:00
Chris Wilson
29da47be60 [ps] Check for an empty font subset.
Return early before trying to emit an empty subset into the document -
avoids a potential use of an uninitialised status variable.
2008-10-21 10:42:41 +01:00
Chris Wilson
71e4f7e3a1 Add API documentation for NULL filenames and write_funcs.
Mention in the API docs that you can pass a NULL filename to
cairo_(pdf|ps|svg)_surface_create in order to construct a queryable
surface without generating any temporary files. Similarly when passing a
NULL write_func to cairo_pdf_surface_create_for_stream et al.
2008-10-20 23:54:57 +01:00
Chris Wilson
6cb2b29434 [mutex] s/HOLDS_MUTEX/MUTEX_IS_LOCKED/
Behdad prefers the latter to keep a clean namespace.
2008-10-20 23:32:44 +01:00
Chris Wilson
ae9d17c015 [directfb] Unbounded operators are unsupported.
Currently the emulation of Porter-Duff operators does not correctly
handle the unbounded operators.
2008-10-20 23:32:34 +01:00
Chris Wilson
1f35f31c4e [directfb] Fallback for SATURATE
We're unable to satisfactorily emulate SATURATE using the src/dst blend
modes, so fallback. (Might just be a bug in libdirectfb...)
2008-10-20 23:20:25 +01:00
Chris Wilson
c7951c4a36 [directfb] Perfom text fallback if emulating clip regions.
Fallback if we have a clip that is not a simple region.
2008-10-20 23:20:25 +01:00
Chris Wilson
98933fd4b8 [directfb] When blitting check if we need the un-premultiplied color.
When blitting whether we need to use the premultiplied color is dependent
upon the destination surface capabilities.
2008-10-20 23:20:24 +01:00
Chris Wilson
4af8aa5f4d [directfb] Apply clip to release_dest_image()
We need to respect the current clip when copying the fallback image back to
the target surface.
2008-10-20 23:20:24 +01:00
Chris Wilson
0ba5085ba0 [directfb] Fix OBO in clip.
DirectFB seems to use inclusive upper bounds.
2008-10-20 23:20:24 +01:00
Chris Wilson
2743e84171 [directfb] Force NEAREST.
The current version of DirectFB does not support any filters, so set
NEAREST on the source patterns so that we can fully optimize the pattern
inside core.
2008-10-20 23:20:24 +01:00
Chris Wilson
f1669d31c0 [directfb] Track the empty clip rectangle.
A region with no extents means everything should be clipped out, so we
need an extra flag to disambiguate when we have 0 clip rectangles.
2008-10-20 23:20:24 +01:00
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