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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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.
As we use this a performance benchmark, it behooves us to check that we
are rendering it correctly.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Recently cairo_surface_create_similar_image(), cairo_surface_map_to_image() and
cairo_surface_unmap_image() were introduced. However, the documentation was
slightly misleading and recommended a wrong usage.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This fixes weird and occasional build failures when updating the source, e.g.:
cairo-perf-micro.o:(.rodata+0xb0): undefined reference to `hash_table'
Signed-off-by: Uli Schlachter <psychon@znc.in>
The fallback code assumed that the caller mapped the complete surface to an
image. If only parts of a surface were mapped, the code didn't correctly
translate and clip its operations.
Fixes map-bit-to-image for xlib-xcb and improves the result for recording.
Thanks to Chris Wilson for some simplifications.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Printing PDFs with large monochrome or grayscale images would result
in the images being blown up to 24-bit color images. Some printers are
very slow to print huge color images.
When there are no free entries to terminate a search, checking that a
key is not in the table requires probing every entry in the table,
i.e. it degenerates in an O(n) operation.
Rehashing when the number of free entries is less than 25% makes the
expected lookup time O(1).
The hash-table micro benchmark become 4-6x faster.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=17399
A benchmark to test the speed of hash tables when inserting and
removing a huge number of elements.
Although originally hash tables were assumed not to get many
deletions, in practice they are now being used as caches in multiple
places. This means that they often have a fixed number of live
elements and an element is evicted whenever a new element is inserted
(this happens explicitly for cairo_cache_t objects, but also, for
example, in scaled_font_map + holdovers). This access pattern is very
inefficient with the current implementation.
Printing PDFs with large monochrome or grayscale images would result
in the images being blown up to 24-bit color images. Some printers are
very slow to print huge color images.