Commit graph

6008 commits

Author SHA1 Message Date
Chris Wilson
2342e4da4f image: extend support of direct replay for paginated surfaces
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 18:39:27 +01:00
Chris Wilson
6448022a05 xcb: Convert the box back to integer coordinates for uploading the image
Silly bug of the day.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 16:29:10 +01:00
Chris Wilson
0660f62fe5 gl: Rectilinear fast path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 15:40:47 +01:00
Chris Wilson
c2150b3441 gl: Rectangular fast path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 15:06:20 +01:00
Adrian Johnson
7fbe430e2a ps: remove unnecessary flush
that was preventing string of glyphs from separate calls to
cairo_show_glyphs() being merged.
2011-07-29 21:51:04 +09:30
Chris Wilson
488c94220d ps: Apply the clip reduction techniques from pdf
If the clip wholly covers the operation, we do not need to set one, and
if the current clip similarly covers the operation we do not to unset
it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 13:12:48 +01:00
Chris Wilson
ccf67c7d74 pdf: Don't remove the current clip if redundant
If the surface already has a clip set and that clip does not interfere
with the operation then we can leave it set.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 13:06:49 +01:00
Chris Wilson
6ed0c6224b pdf: Remove redundant clip regions
If the extents of the operation is wholly contained within the clip
region, then we can safely not invoke any clipping.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 13:03:59 +01:00
Chris Wilson
29a302cc4b clipper: Also need to guard against the incoming clip being NULL
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 12:57:31 +01:00
Chris Wilson
fb9ed9bb0d clip: Fix clip-equal to handle one or the other being NULL/all-clipped
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 12:36:21 +01:00
Chris Wilson
7c6e1b8db8 xcb: Short-circuit multiplying the alpha mask by 1.0
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 12:36:21 +01:00
Chris Wilson
4032c86127 fallback: Prevent recursion when combining with the clip
We need to special case the handling of unaligned clip regions in order
to prevent the treatment of those as a general path requiring a
clip+mask...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 12:36:21 +01:00
Andrea Canciani
2787ef4e73 pattern: Complete the list of possible pattern errors
A mesh pattern is put in CAIRO_STATUS_INVALID_MESH_CONSTRUCTION when
an invalid patch construction operation is performed.

A mesh pattern is put in CAIRO_STATUS_INVALID_INDEX when an operation
is performed with an out-of-bound index.

Any pattern is put in CAIRO_STATUS_INVALID_MATRIX when its matrix is
set to a singular matrix.
2011-07-29 13:17:17 +02:00
Chris Wilson
c1b0e73578 record: Only reduce fill+stroke if the clip doesn't change between the commands
Pointed out by Adrian Johnson.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 12:07:09 +01:00
Andrea Canciani
6ec24760b3 device: Flush on a finished device is a no-op
In order to have a behavior which is coherent with that of surfaces,
flushing a finished devices should be a no-op and should not affect
the status of the device.
2011-07-29 13:01:59 +02:00
Chris Wilson
74a86a76a9 clipper: Detect a incremental change in the general clip-path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 11:58:07 +01:00
Chris Wilson
aac9b26176 clip: Fix cairo_clip_equal()
In haste, I completely removed the implementation...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 11:44:21 +01:00
Chris Wilson
ecafad7149 record: Assume recording surface targets are clear
The replay of the recording surface will not function correctly unless
the target surface region is already clear. So assume that is and
optimise away the initial clear.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 11:44:21 +01:00
Andrea Canciani
81efbc1847 quartz: Silence some clang warnings
Clang static analysis relies on the Core Foundation naming convention
for the object ownership tracking.

Functions that return an object whose ownership is given to the
caller, should contain "Create" or "Copy" in their name.
2011-07-29 12:07:06 +02:00
Andrea Canciani
93c8b1090b cff-subset: Do not use garbage values
The code incorrectly initialized the fields of the data structure,
which are about to be overwritten, instead of the temporary variables
which are used to compute them.
2011-07-29 11:56:40 +02:00
Andrea Canciani
ad3ef3a8fb Silence Clang static analyzer reports
Clang static analysis triggers some reports in non-buggy code.

Silence them trying to follow better coding practices.
2011-07-29 11:54:56 +02:00
Andrea Canciani
15b6b2832b directfb: Unbreak compilation
The recent changes to the clip code caused build failure in directfb.
2011-07-29 10:51:19 +02:00
Uli Schlachter
e06a3b9761 xcb: Handle fallback in map_to_image
Fixes (for xcb-fallback): map-all-to-image map-bit-to-image map-to-image-fill

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-29 10:29:47 +02:00
Uli Schlachter
27702768bf xcb: _get_image only works without fallback
This turns the test suite-failures for map-all-to-image map-bit-to-image
map-to-image-fill with xcb-fallback into failed assertions.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-29 10:18:55 +02:00
Uli Schlachter
1beab6cca4 xcb: Handle deferred clear in map_to_image
Fixes: map-all-to-image map-bit-to-image map-to-image-fill

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-29 10:10:42 +02:00
Uli Schlachter
8f8149a207 xcb: Error on 0x0 source surfaces
Recording surfaces can be unbounded which causes
_cairo_surface_acquire_source_image to return a 0x0 image surface for them.
Since X11 doesn't like anything with a size of 0x0, we should reject such source
images. Users might still try to mess with 0x0 surfaces, so we will eventually
need a better idea for handling this.

Instead of failing the assertion that was added in the previous commit, this
commit makes cairo-xcb return an error.

This makes the recording-* tests fail instead of crash.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-29 09:23:15 +02:00
Uli Schlachter
5d72e59982 xcb: Assert that pixmap sizes are positive
Currently, all the recording-* tests fail with an X11 error. This commit turns
those errors into failed assertions. Now someone just has to figure out why this
happens in the first place...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-29 09:23:15 +02:00
Chris Wilson
ec74912eee record: Recording surfaces need an explicit clear
As a recording surface will be replayed onto a destination target, it is
unknown at the time of creation as to whether or not the target is
clear. So we need to make sure to record any initial clear in order
to replay that clear onto the destination. (If the destination is clear
anyway it will be suppressed.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-28 17:21:33 +01:00
Chris Wilson
65e13cd201 record: We can only skip the clear so long as we know the destination is clear
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-28 17:16:25 +01:00
Andrea Canciani
d7abdab931 polygon: Fix generic case of edge clipping
The edge clipper is more complicated than it should be and contains a
subtle bug: when an edge is almost horizontal, it is always considered
as having a positive slope.

Explain what should be done and do it in a simpler way.

Fixes horizontal-clip.
2011-07-28 18:11:27 +02:00
Andrea Canciani
6aa6b7daa8 polygon: Simplify code for edge clipping
Add some comments about what's going on and clean up the branches by
sharing common computations.
2011-07-28 18:11:27 +02:00
Matt Peterson
aad2c3dd0f gl: Use cairo_rectangle_int_t 2011-07-28 16:52:16 +01:00
Chris Wilson
96abd9b887 record: And remember to offset the index of unbounded playback
When we don't generate the set of visible indices, we need to iterate
over all the currently active commands and so need to offset the
iterator to the start of those commands.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-28 16:42:41 +01:00
Chris Wilson
fe34d7041a record: Use a bbtree to reduce is-visible checking overheads
By using a bounding-box rtree, we are able to reject invisible branches
of the tree and so find the visible leafs with fewer intersection
checks. Overhead reduction is strongly dependent upon the ability to
spatially partition the geometry and so performance correlates with
small tiles and small operations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-28 14:10:13 +01:00
Uli Schlachter
44140e3dd6 Make _cairo_xcb_surface_get_extents no_warn
This function never fails. However, since it's used to implement a operation for
cairo_surface_backend_t, the return value can't be void. This commit instead
uses cairo_private_no_warn to get rid of the warnings.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-27 19:54:30 +02:00
Uli Schlachter
8877ca23f5 xcb: Check that the extents are inside our surface
The previous commit fixed a bug in cairo-xlib found by a similar assert, so this
seems to be a good idea to have.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-27 19:52:58 +02:00
Uli Schlachter
73e8384ac8 xlib: Fix a typo
This was introduced in a69335a84e.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=39581

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-27 18:41:26 +02:00
Chris Wilson
cac96c8083 polygon: Fix clipping of edges outside of their range
Uli Schlachter analysed the error behind the polygon reduction and
discovered that it was due to the clipping of a line which intersects
the clip box (p1, p2) but is range limited by (top, bottom) to be inside
the clip box.

Fixes hatching

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-27 17:32:42 +01:00
Chris Wilson
030de5144d polygon: Don't skip clipped horizontal edges
As Andrea Canciani pointed out even if it is horizontal within the clip
box, it may still have vertical extents outside of the clip box for
which we need to project onto the clip boundary  in order to maintain
the correct polygon winding.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-27 17:32:41 +01:00
Andrea Canciani
fc98fd9db5 win32: Fix typos in documentation
The documentation of the win32 surface backend contained a typo,
pointed out by Andrej Mitrovic in
http://lists.cairographics.org/archives/cairo/2011-July/022084.html

Another imprecision was found reviewing the public API documentation.
2011-07-27 09:44:26 +02:00
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