Commit graph

9655 commits

Author SHA1 Message Date
Chris Wilson
6d1c0e6d28 Fix pollution from skia commit
I forgot to proof-read the patch before pushing and forgot I had left in
some damage from trying to get skia to link using libtool.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 10:06:08 +01:00
Chris Wilson
1ccd269a3f skia: Update to use cairo_backend_t interface
Still hopelessly broken. Requires compiling cairo to use static linking
and then still requires manual linkage to workaround libtool. Lots of
functionality is still absent - we need to either find analogues to some
Cairo operations or implement fallbacks - but it is sufficient to
investigate how Skia functions in direct comparison with Cairo for
tessellation/rasterisation.

Caveat emptor.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 09:58:02 +01:00
Chris Wilson
e849e7c929 image: move surface definition to new header for subclassing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 09:54:28 +01:00
Chris Wilson
ee001b0b9f bo-rect: Micro-optimisation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 09:31:53 +01:00
Chris Wilson
2e545672ba perf/micro: diagonal lines
The ideal benchmark for spans?...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 09:30:26 +01:00
Chris Wilson
e9d41054f9 perf/micro: Test wide vs hairline strokes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 09:30:26 +01:00
Chris Wilson
ccbd7281b2 test/line-width: Add a non-antialiased variant
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 09:30:05 +01:00
Chris Wilson
be1ff2f45f xlib: Set the clip_region for glyphs
Broken (never set!) since the clipping overhaul. We could emulate the
xcb code to avoid setting it unnecessarily...

Fixes partial-clip-test.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-12 20:36:13 +01:00
Chris Wilson
e7fcbed63a bo: Perform an initial bucket sort on the start events
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-12 20:25:59 +01:00
Chris Wilson
64bcabfe4b tor: Micro-optimise
Inline sub-step edges and combine non-zero/even-odd paths by using a
winding_mask.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-12 20:25:59 +01:00
Chris Wilson
02da8c7efb default-context: Tidy push-group
Fix a couple of instances of the older style clipping code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-12 20:25:59 +01:00
Chris Wilson
a3d2d5b42b script: Remove reference to image-surface-private
That header doesn't exist yet.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-12 20:25:59 +01:00
Chris Wilson
e7bd4c93e3 util/show-traps: Cache the rendering of the traps+edges
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-12 20:25:59 +01:00
Chris Wilson
b8e8c4cf9a util/show-polygon: Show end-points
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-12 18:43:06 +01:00
Chris Wilson
99c129dd13 test: Add record-extend
Exercise the extend modes with a clipped paint, because once upon a time
we had a bug...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-10 14:53:07 +01:00
Chris Wilson
deb88cca13 recording: do not reduce required clips
When painting with an unbound source, we would miss that the clip
extents were smaller than the mask extents and remove the solitary clip
(believing we were bound by a tight mask). For painting this is
obviously wrong, and due to a combination of bugs that set the mask to
the bound extents and then the failure to spot when that mask was larger
than the clip.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-10 14:06:16 +01:00
Chris Wilson
69c1ec9f13 script: Compile fix
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-10 14:06:16 +01:00
Chris Wilson
b13266ba0f script: Include an operator to replay a recording surface to a file
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-10 14:06:15 +01:00
Chris Wilson
40fa6c867c trace: Pop the surface after write-to-png
It is convenient if the user can simply enable the use of the commented
write-to-png operation just by removing the preceding '%'. However, to
do so we need to make sure that the line is stack-neutral and so need to
pop the surface that we place onto the stack after writing the png.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-10 14:06:15 +01:00
Chris Wilson
34ce4680d1 fixed: Allow the implicit close of the last fill path to complete a fill-box
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-10 10:23:51 +01:00
Chris Wilson
f8a3038008 tor: update is-vertical along with min-height
Similar to the minimum height property, is-vertical can only change
after an insertion or deletion event. So we only need to update the
flags after one of those events, so simply update it along side
min-height.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-10 10:23:27 +01:00
Chris Wilson
d22cf3dfbe perf: add curve
Time how long it takes to stroke and fill a single Bezier curve.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 20:20:18 +01:00
Chris Wilson
aa6df71228 perf: add many-curves
Continuing the theme of stressing the tessellators, draw lots of Bezier
curves!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 19:47:49 +01:00
Chris Wilson
2ef3a50a84 tor: Fix mergesort to handle doubly-linked list
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 19:02:43 +01:00
Chris Wilson
b823d4d28f tor: trivial changes
Some trivial cleanups that escaped my noticed during a tired review.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 19:02:36 +01:00
Chris Wilson
17e34b6eab bo-rectangular: Correctly mergesort a doubly-linked list
Saves having to fixup the pointers afterwards by only having to update
them on the list boundaries during merge.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 17:59:08 +01:00
Chris Wilson
a4e4e2bdd7 bo-rectangular: Use a mergesort to speedup insertion
However, this is only useful for inserting multiple boxes within the
pixel, so we maintain the cached insert cursor as this speeds up the
general case (and aides this optimisation as well).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 17:08:02 +01:00
Chris Wilson
014e5e5ec1 bo-rectangular: Eliminate allocation for pqueue
Since we only allocate a pointer to the rectangle after it is started
and so decoupled from the start queue, we reuse the memory allocated for
the start queue for the stop binary heap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 16:06:50 +01:00
Chris Wilson
323e48f8ec fill: A horizontal/vertical line is also a degenerate fill box
Since we discard empty fill boxes whilst filling, we can also treat
horizontal/vertical lines as a filled box and so proceed with the
rectangular fast path in the presence of
  cairo_rectangle (x, y, w, h)
with w == 0 || h == 0.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 16:06:50 +01:00
Chris Wilson
786d4b2a2a perf: Add many-fills
A variant of many-strokes tries to answer the question of how much
overhead is there in stroking, i.e. if we fill an equivalent path to a
set of strokes, do we see an equivalence in performance?

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 16:06:50 +01:00
Chris Wilson
2d8c63671a build: Add a missing cairo-backend-private.h
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 16:06:50 +01:00
Uli Schlachter
7b97533221 map-to-image: Handle non-32bpp formats
Fixes: map-all-to-image, map-bit-to-image for image16

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-08 21:06:09 +02:00
Uli Schlachter
5a26018313 map_to_image: Verify the given extents
User shouldn't be able to use extents that are not completely inside of the
surface's extents.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-08 21:06:09 +02:00
Uli Schlachter
03cda5c0e5 xlib-xcb: Fix a double free in surface_unmap
cairo_surface_unmap_image() destroys the image that was passed to it. Since
xlib-xcb calls cairo_surface_unmap_image() again for the underlying xcb surface,
the surface was destroyed twice.

Work around this problem by incrementing the image's reference count via
cairo_surface_reference().

No idea why I didn't catch this problem when implementing these functions, I'm
sure I ran the relevant tests. :-(

lt-cairo-test-suite: cairo-surface.c:853: cairo_surface_destroy: Assertion
`((*&(&surface->ref_count)->ref_count) > 0)' failed.

Fixes: map-to-image-fill map-bit-to-image map-all-to-image

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-08 21:06:09 +02:00
Uli Schlachter
73e9307855 cairo.h: Document CAIRO_DEVICE_TYPE_INVALID
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-08 21:06:09 +02:00
Chris Wilson
2d79276c49 tor: Inline reverse insertion sort for handling intersections
The majority of intersections are with the nearest neighbour only, or
within a few neighbours (in a dense intersection of lines) so if walk
the active list backwards and find the new place to insert upon an
intersection it is faster than performing a mergesort afterwards.

Given enough intersections, the win is quite huge (15-20% on many-strokes).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-08 08:12:14 +01:00
Chris Wilson
221c117f5d tor: First perform a bucket sort before merge the sub-edges from the polygon
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-07 23:20:46 +01:00
Chris Wilson
f646cb07a9 perf: add the usual special cases to many-strokes
For completeness, also compare [aligned] horizontal and vertical
strokes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-07 12:27:39 +01:00
Chris Wilson
d953161f88 perf: Add many-strokes
An intersection variant to exercise the stroker with many, many lines. A
silly benchmark, but a popular one in the wild.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-07 12:14:11 +01:00
Chris Wilson
4236821d11 test: Add unclosed-strokes
Checks that coincident end-points are not converted to joins. It briefly
passed through my mind that was a good thing...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-07 09:02:46 +01:00
Chris Wilson
37e1a1b3ed test: Add a1-sample
Ensures that only a box that covers the centre pixel is filled with
antialiasing disabled.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-07 09:02:46 +01:00
Chris Wilson
307cb2a973 util: Add show-polygons
Another variant of the utility apps that understand the output of
_cairo_debug_print_polygon().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-07 09:02:46 +01:00
Chris Wilson
61c0f67ee0 test: Add joins-retrace
The complexity in this shape is that the stroke is reversed upon
itself and retraces the same path in the opposite direction.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-06 11:12:23 +01:00
Chris Wilson
93c9d4cefb test: Add an loopy I-bar stroker test
A second relatively simple closed concave shape, all the better for
debugging with.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-06 10:29:08 +01:00
Chris Wilson
b280114c5e test: Add join-star, another stroker exercise
A simple convex shape, useful for debugging.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-06 09:30:54 +01:00
Andrea Canciani
588e5a24fa clipper: Fix crashes
The end of the clip path list is marked with NULL, so we should stop
iterating paths when we reach it.

The assertion was meant to check if paths had the same content, not if
they have the same address.

Fixes clip-fill-rule and clip-twice in cairo-quartz.
2011-08-05 19:44:33 +02:00
Chris Wilson
9ef003c5fc clipper: Don't emit an empty clip-path for no clip boxes
If there are no clip boxes, we do not need to emit an empty clip which
only confuses the users of the surface-clipper.

Spotted by Andrea Canciani and cairo-quartz

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-05 18:23:21 +01:00
Chris Wilson
3424e91ec7 test: Add a couple of tests to exercise stroking of short tail segments
Are the reference images correct? Discuss.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-05 17:27:59 +01:00
Adrian Johnson
8a6d7643f0 subsets: use show_text_glyphs supplied utf8 to determine latin character
PS files printed from PDF do not have a cmap in the subsetted
fonts. If the unicode mapping has ben supplied by _show_text_glyphs we
should use this instead of the reverse lookup to determine if the
glyph is a latin chartacter.
2011-08-06 00:24:55 +09:30
Adrian Johnson
1a4714b61f ps: use show_text_glyphs
to ensure that when the PS is converted to PDF the text can be extracted.
2011-08-06 00:23:14 +09:30