Commit graph

9512 commits

Author SHA1 Message Date
Andrea Canciani
2fd20e5c1e surface: Check image parameter in cairo_surface_unmap_image()
The image argument must be a cairo-image surface.
2011-07-27 09:44:26 +02:00
Andrea Canciani
3f9717347e win32: Constify
Silences some compiler warnings.
2011-07-27 09:44:25 +02:00
Andrea Canciani
9ef178ff35 win32: Fix compilation
a69335a84e broke compilaiton of win32
surfaces because of some typos.
2011-07-26 22:14:22 +02:00
Andrea Canciani
87016112c5 Fix surface backend structures
a69335a84e introduced some new members
in the backend structure, but quartz, qt and xlib-xcb were not
updated.
2011-07-26 22:03:31 +02:00
Andrea Canciani
ca53fed939 quartz: Silence const cast warnings
b132fae5e8 const-ified some arguments,
but missed others.
2011-07-26 22:03:07 +02:00
Chris Wilson
b492b69d4f wrapper: translate the clip by the device transform
A stepping stone, the translation was accidentally dropped when
changing the clipping to be performed first.

Fixes twin.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26 16:38:31 +01:00
Chris Wilson
91faf9c1cf composite: Pass unbounded extents to initialisation
For an unbounded surface we cannot assume (0, 0, surface_width,
surface_height) as that is wrong and causes the operation to appear
clipped.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26 16:00:43 +01:00
Chris Wilson
a69335a84e API: map-to-image and create-similar-image
A common requirement is the fast upload of pixel data. In order to
allocate the most appropriate image buffer, we need knowledge of the
destination. The most obvious example is that we could use a
shared-memory region for the image to avoid the transfer cost of
uploading the pixels to the X server. Similarly, gl, win32, quartz...

The other side of the equation is that for manual modification of a
remote surface, it would be more efficient if we can create a similar
image to reduce the transfer costs. This strategy is already followed
for the destination fallbacks and this merely exposes the same
capability for the application fallbacks.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26 14:55:58 +01:00
Chris Wilson
c6812c6a36 rectangle: speed up the is-intersecting test.
cut'n'paste before coffee.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26 12:07:42 +01:00
Chris Wilson
168b5a5348 wrapper: target to recording needs the inverse transform
Gah, I thought about this and noted that I need the inverse of the
normal transformation, yet failed to remember to actually use it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26 09:05:02 +01:00
Chris Wilson
c596483f85 record: Check the operation against the target device extents.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26 08:42:53 +01:00
Chris Wilson
8ba8534d62 record: Store the untransformed operation extents along with the command
This allows us to actually clip out the geometry before we record it, as
suggested by allowing the user to supply an extents... But it will be
advantageous in later patches for reducing the amount of work we need to
perform to replay.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26 08:02:59 +01:00
Chris Wilson
f5d602cb59 xcb: Make composite_opacity_boxes slightly less silly
Being called with no clip, might be unexpected, but it means to fill the
whole extents with the opacity. So do so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 19:45:31 +01:00
Chris Wilson
8dc9139fb2 recording: Combine the clip to the recording + target surface extents
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 18:10:43 +01:00
Chris Wilson
15d5014efd clip: Short-cut the common condition of intersecting with a single box
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 17:37:27 +01:00
Chris Wilson
52e3814824 clip: Skip processing of rectangle-intersection if it wholly subsumes the clip
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 17:31:39 +01:00
Chris Wilson
4c72c4df66 wrapper: Correct translation of clip for wrapper extents
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 16:27:07 +01:00
Chris Wilson
cc745f5c2f wrapper: show-text-glyphs can now operate on constant array of glyphs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 15:48:27 +01:00
Chris Wilson
415d5d8fce wrapper: Use the stack for small glyph allocations
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 15:45:57 +01:00
Chris Wilson
8102bd8681 wrapper: Factor out the common clip handling
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 15:33:21 +01:00
Chris Wilson
87e9c8a5ea recording: Move the glyph allocation into the wrapper after checking clip status
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 15:10:18 +01:00
Chris Wilson
59612847e3 xcb: set the right members of cairo_color_t for generating the opacity mask
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 15:08:03 +01:00
Chris Wilson
080f81bf5c image: Fix clip-intersect
Explicitly convert the clearing of the unbounded area.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 13:12:55 +01:00
Chris Wilson
e4b3f84d4c test: Add clip-intersect
Exercises a bug in the unbounded drawing of an empty polygon...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 13:05:24 +01:00
Chris Wilson
4d5c95f629 test: Exercise replaying basic painting paths
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 11:50:48 +01:00
Chris Wilson
2b19dd3fbd recording: Only look for a fill-stroke operation if the target supports one
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 11:50:48 +01:00
Chris Wilson
dc67d8e7f9 composite: Perform a quick is-clipped for glyphs
Computing the exact bbox of the glyphs and whether they are overlapped
is expensive. However, we can often check whether they are visible just
by looking at the maximal extents of the fonts along with the bbox of
the positions; much cheaper.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 11:50:48 +01:00
Chris Wilson
05bed4c574 scaled-font: Single glyph extent computations are worryingly frequent
But easy to optimise.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 10:42:14 +01:00
Chris Wilson
5ac9e3e281 freed-pool: Enlarge the freed cache
Clips end up recursing more than 4 levels and so we need a larger stash
to avoid mallocs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 10:42:14 +01:00
Chris Wilson
04ef07ee3b clip: Embed a single box to avoid a common allocation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24 10:42:14 +01:00
Chris Wilson
926287aeea surface-wrapper: Fix use of uninitialised variable
Introduced recently in a30a7402f7,

==32234== Conditional jump or move depends on uninitialised value(s)
==32234==    at 0x6BCA326: _cairo_surface_wrapper_needs_device_transform (cairo-surface-wrapper.c:549)
==32234==    by 0x6BCB47D: _cairo_surface_wrapper_set_inverse_transform (cairo-surface-wrapper.c:579)
==32234==    by 0x6BCB55A: _cairo_surface_wrapper_init (cairo-surface-wrapper.c:621)
==32234==    by 0x6BB87A6: _cairo_recording_surface_replay_internal (cairo-recording-surface.c:854)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 22:58:55 +01:00
Chris Wilson
7f77e2f36a trace: Create a new opcode for recording surface
During replay we want to handle recording surfaces specially, and not
redirect the creation of those to the target surface. This is similar to
the need to keep image surfaces as images during replay.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 22:50:25 +01:00
Chris Wilson
1578530557 region: Directly handle single rectangle creation in create_rectangles()
In order to avoid the copy and transformation of the single rectangle,
we can simply pass it to pixman and create the region from it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 20:02:35 +01:00
Chris Wilson
69e52c6707 tests: Another missing ref, this time clip-disjoint-hatching
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 15:51:49 +01:00
Chris Wilson
9b039a65a6 tests: Missing ref images for new recording-surface test
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 15:48:10 +01:00
Chris Wilson
7e42276ffc image: Apply mask-opacity to clip boxes
In the simple condition where the user is applying an opacity mask to a
misaligned rectangle, we can treat it as a series of simpler composites
by combining the opacity with the coverage of the box.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 15:33:14 +01:00
Chris Wilson
a30a7402f7 image: replay the recording surface directly onto the target
백현기 reported a use-case where he was recording an entire web-page
onto the recording surface, in order to facilitate panning. In this
scenario, where there may be lots of similar surfaces within the
recording we generate thousands of unused snapshot-images bloating
memory usage and impairing performance.

Under the right conditions we can replay directly onto the destination
which not only bypasses the snapshots but also skips the following
resampling.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 15:33:14 +01:00
Chris Wilson
bff8e22eb6 image: Fix partial clipping of text
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 15:33:14 +01:00
Chris Wilson
c2dada9722 test: Add a paint-with-alpha variant to test clip-boxes fast path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 15:33:14 +01:00
Chris Wilson
5de0232937 test: Extend recording-surface-pattern to include a SOURCE operator test
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 14:42:17 +01:00
Chris Wilson
abd8fcc833 test: Expand partial-clip-text
Test partial clipping along each edge.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 14:42:17 +01:00
Adrian Johnson
abf97c8874 Check glyph_index range in _index_to_glyph_name
A broken font such as the PDF file at
https://bugzilla.gnome.org/show_bug.cgi?id=638011 can mean there are
less glyph names in the array than there should be.
2011-07-22 21:53:33 +09:30
Andrea Canciani
aa646e47f3 Use new pixman formats
b132fae5e8 introduced the usage of two
new pixman formats. This requires pixman 0.22, but makes it possible
to fix some TODO's left behind in gl and vg.
2011-07-21 20:15:50 +02:00
Uli Schlachter
b60694cbc7 xcb: Work around wrong extent computation in the X server
This is basically the same fix as e6c3efdd65. However, this was lost in
b132fae5e8 and thus had to be fixed again.

Fixes: clip-fill-eo-unbounded clip-fill-nz-unbounded

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 19:39:25 +02:00
Uli Schlachter
e2150185fc xcb: Unset the deferred_clear flag on fallback
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 19:24:38 +02:00
Uli Schlachter
de686f1938 xcb: Handle deferred_clear in _get_image
Fixes: arc-infinite-loop clip-all clip-empty-group clip-fill-no-op
pattern-getters

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 19:24:38 +02:00
Uli Schlachter
adf026fffe xcb: Fix a NULL dereference
This fixes a crash in the hatchings test case.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 19:24:37 +02:00
Andrea Canciani
1aa077e129 xcb,xlib: Cleanup GC cache handling
Device mutexes guarantee the consistency between multiple threads,
hence GC cache does not rely anymore on atomic operations.

This makes it possible to avoid bit twiddling and to use a simple
array.
2011-07-21 19:16:42 +02:00
Chris Wilson
5eb8eacde0 xcb: Always send a clip region along with clipped glyphs
As we do not control the geometry used for the individual glyphs, we
must always send a clip-region so that X can trim the glyph
appropriately. However, in order to avoid sending unnecessary data we
only do so if the clip extents is less than the ink extents of the
glyphs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-21 18:07:17 +01:00
Uli Schlachter
93ab2171d0 xcb: Parse $CAIRO_DEBUG just like cairo-xlib does
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 16:51:26 +02:00