Commit graph

90 commits

Author SHA1 Message Date
Chris Wilson
51193f1610 [pattern] Pass flags to _cairo_pattern_acquire_surface()
Allow the caller to choose whether or not various conversions take place.
The first flag is used to disable the expansion of reflected patterns into a
repeating surface.
2009-06-02 15:13:45 +01:00
Chris Wilson
c25992479a [xlib] Use minimal depth for similar clones.
Damian Frank noted
[http://lists.cairographics.org/archives/cairo/2009-May/017095.html]
a performance problem with an older XServer with an
unaccelerated composite - similar problems will be seen with non-XRender
servers which will trigger extraneous fallbacks. The problem he found was
that painting an ARGB32 image onto an RGB24 destination window (using
SOURCE) was going via the RENDER protocol and not core. He was able to
demonstrate that this could be worked around by declaring the pixel data as
an RGB24 image. The issue is that the image is uploaded into a temporary
pixmap of matching depth (i.e. 32 bit for ARGB32 and 24 bit for RGB23
data), however the core protocol can only blit between Drawables of
matching depth - so without the work-around the Drawables are mismatched
and we either need to use RENDER or fallback.

This patch adds a content mask to _cairo_surface_clone_similar() to
provide the extra bit of information to the backends for when it is
possible for them to drop channels from the clone. This is used by the
xlib backend to only create a 24 bit source when blitting to a Window.
2009-05-15 21:31:02 +01:00
Søren Sandmann
1cca5a1348 [region] Remove underscores from _cairo_region_* 2009-03-28 18:02:07 -04:00
Søren Sandmann Pedersen
ebd0e685ae [region] Consistently use rectangles in the API of regions
Usually, rectangles are more useful than boxes, so regions should only
expose rectangles in their public API.

Specifically,
  _cairo_region_num_boxes becomes _cairo_region_num_rectangles
  _cairo_region_get_box becomes _cairo_region_get_rectangle

Remove the cairo_box_int_t type
2009-03-28 18:01:19 -04:00
Søren Sandmann
f6daa664c1 Delete _cairo_region_get_boxes() in favor of _cairo_region_get_box()
The _cairo_region_get_boxes() interface was difficult to use and often
caused unnecessary memory allocation. With _cairo_region_get_box() it
is possible to access the boxes of a region without allocating a big
temporary array.
2009-02-15 18:57:31 -05:00
Chris Wilson
6b0c2c8ba6 [directfb] Don't access the scaled_font->glyphs cache directly
Not only does it no longer exist, but doing so bypassed the locking
mechanisms and sanity checks!

Spotted by Lance Hepler.
2009-02-02 09:14:15 +00:00
Jeff Muizelaar
391c602640 Merge branch '1.8' 2008-12-11 14:41:01 -05:00
M Joonas Pihlaja
4a9b274eeb [cairo-spans] Add a check/create_span_renderer backend methods.
A surface will have the chance to use span rendering at cairo_fill()
time by creating a renderer for a specific combination of
pattern/dst/op before the path is scan converted.  The protocol is to
first call check_span_renderer() to see if the surface wants to render
with spans and then later call create_span_renderer() to create the
renderer for real once the extents of the path are known.

No backends have an implementation yet.
2008-12-06 14:04:36 +02:00
Chris Wilson
e6963a5bfe Mark allocation failures as unlikely.
Use the gcc likelihood annotation to indicate that allocation failures are
extremely unlikely.
2008-11-29 11:20:34 +00:00
Chris Wilson
361962b7fb [directfb] Compile fix with debug enabled.
Fix a trivial compile failure reported here:
  Bug 18322 - bug in _cairo_directfb_surface_release_source_image function
  (http://bugs.freedesktop.org/show_bug.cgi?id=18322)
2008-11-21 18:29:54 +00:00
Chris Wilson
f15b1f26be [region] Use the caller supplied array for extracting boxes.
Allow the user to pass in a pre-allocated array and use it if the number
of boxes permits. This eliminates the frequent allocations during clipping
by toolkits.
2008-11-21 09:40:42 +00:00
Adrian Johnson
d682d275b9 Add an extents argument to the high level surface backend functions
Add a "cairo_rectangle_int_t *extents" argument to to the following
backend functions:
  paint
  mask,
  stroke
  fill
  show_glyphs
  show_text_glyphs

This will be used to pass the extents of each operation computed by
the analysis surface to the backend. This is required for implementing
EXTEND_PAD.
2008-11-02 20:12:22 +10:30
Chris Wilson
7944601864 [pattern] Avoid needless copying of patterns.
Only copy the pattern if we need to modify it, e.g. preserve a copy in a
snapshot or a soft-mask, or to modify the matrix. Otherwise we can
continue to use the original pattern and mark it as const in order to
generate compiler warnings if we do attempt to write to it.
2008-10-30 17:52:05 +00: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
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
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
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
871f683367 clone_similar(): s/device_offset/clone_offset/
A little bit of sleep and reflection suggested that the use of
device_offset_[xy] was confusing and clone_offset_[xy] more consistent
with the function naming.
2008-09-27 17:27:21 +01:00
Chris Wilson
5b97ee6525 Allow cloning sub-regions of similar surfaces.
Previously the rule for clone_similar() was that the returned surface
had exactly the same size as the original, but only the contents within
the region of interest needed to be copied. This caused failures for very
large images in the xlib-backend (see test/large-source).

The obvious solution to allow cloning only the region of interest seemed
to be to simply set the device offset on the cloned surface. However, this
fails as a) nothing respects the device offset on the surface at that
layer in the compositing stack and b) possibly returning references to the
original source surface provides further confusion by mixing in another
source of device offset.

The second method was to add extra out parameters so that the
device offset could be returned separately and, for example, mixed into
the pattern matrix. Not as elegant, a couple of extra warts to the
interface, but it works - one less XFAIL...
2008-09-27 02:20:42 +01:00
Vladimir Vukicevic
ac2781ec08 [dfb] fix crashes due to cached glyphs going away during operation 2008-08-09 22:10:10 -07:00
Vladimir Vukicevic
7fbda72137 [dfb] optimize DirectFB blits 2008-08-09 22:10:06 -07:00
Vladimir Vukicevic
a097bafd28 [dfb] correctly handle case of 0 boxes in clip region 2008-08-09 22:10:05 -07:00
Vladimir Vukicevic
a0cfd9962f [dfb] Propagate clip correctly to surface returned from acquire_dest_image
If the internal buffer is wrapped in an image surface in acquire_dest_image,
that image surface needs the current clip region propagated to it.  If not,
then the clip needs to be applied at release_dest_image time.
2008-08-09 22:10:04 -07:00
Vladimir Vukicevic
71f010bb52 [dfb] convert RUN_CLIPPED macro to function with helpers
This helps with debugging and prepares the way for some future
code cleanup.
2008-08-09 22:10:02 -07:00
Behdad Esfahbod
cf473f4a75 [cairo-xlib] Fix show_glyphs when failing to upload a glyph
Originally reported here:
http://lists.cairographics.org/archives/cairo/2008-May/014032.html
and analyized later in the thread.

Change (font and surface) backend show_glyphs() API to take a
int *remaining_glyphs argument.  It's used to communicate to the caller,
by way of setting remaining_glyphs and returning INT_STATUS_UNSUPPORTED,
that some of the glyphs were shown but not the others.  The xlib backend
now correctly uses this to handle failure to upload a glyph to the server.
So the large-font test passes now.

An alternative approach could be to add some public value for glyphs
indices that are not shown.  -1 perhaps (the xlib backend already uses
that value internally).  Then instead of remaining_glyphs, a backend
could simply set glyph indices of glyphs shown to that -1 value.
2008-05-23 20:03:49 -04:00
Claudio Ciccani
39d18ecbfd [cairo-directfb] Fixed bug in clone_similar() (src_x added twice). 2008-03-01 11:07:47 +01:00
Claudio Ciccani
ad0a2524ff [cairo-directfb] Optimize blend functions in fill_rectangles(), too. 2008-01-02 15:09:58 +01:00
Behdad Esfahbod
4595134598 [directfb] Fix header include order to include cairoint.h first 2007-12-18 16:00:21 -05:00
Benjamin Otte
627a8b4a2f [directfb] replace u32 with uint32_t
This fix makes it compile for me again
2007-12-17 12:42:14 +01:00
Claudio Ciccani
942e3d5308 [cairo-directfb] Support some environment variables
Added a couple of (boolean) env. vars affecting the backend:
CAIRO_DIRECTFB_NO_ACCEL, disables acceleration
CAIRO_DIRECTFB_ARGB_FONT, enables using ARGB fonts instead of A8
2007-12-11 15:50:05 +01:00