Commit graph

9818 commits

Author SHA1 Message Date
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
Adrian Johnson
b11b89e8e0 pdf: check if smask is bilevel and encode as such 2011-08-05 22:09:57 +09:30
Adrian Johnson
16bc8d9361 image: check if A8 image is bilevel when analyzing transparency 2011-08-05 21:17:07 +09:30
Chris Wilson
dd73fe9262 test: Add world-map from the perf-suite
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>
2011-08-05 09:59:02 +01:00
Chris Wilson
1e8d56ceeb perf: Add stroke/fill variants to world-map
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-05 09:48:14 +01:00
Chris Wilson
5ab1eced5f bo-rectangular: handle in==out specifically for the single box case
In this case we do not need to copy anything, but may still need to
re-orientate the box.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-05 09:48:14 +01:00
Nis Martensen
0e135d9f5a Mark the new API as such
cairo_surface_create_similar_image, cairo_surface_map_to_image and
cairo_surface_unmap_image were added in
a69335a84e.
2011-08-05 08:47:52 +02:00
Uli Schlachter
95d6235bbe Clarify the API docs for the newest functions
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>
2011-08-04 21:18:13 +02:00
Uli Schlachter
971d42302c perf: Also build the code in perf/micro
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>
2011-08-04 21:10:09 +02:00
Uli Schlachter
78f7db1a7f xlib-xcb: Implement the new backend functions
This implements create_similar_image, map_to_image and unmap.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-04 21:10:09 +02:00
Uli Schlachter
51faa5a1c2 surface_unmap_image: Fix fallback
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>
2011-08-04 21:10:09 +02:00
Adrian Johnson
61ae9867ab ps: check if images are grayscale or monochrome and encode as such
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.
2011-08-04 21:55:31 +09:30
Adrian Johnson
372ded27c9 image: fix bug in analyze_color 2011-08-04 21:17:15 +09:30
Andrea Canciani
3fbfa1beed hash: Code cleanup
Simplify arrangements by keeping only table sizes, remove some useless
code and fix make check.
2011-08-03 12:31:41 +02:00
Andrea Canciani
aaa10fbf12 hash: Improve handling of dead entries
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
2011-08-03 12:31:41 +02:00
Andrea Canciani
374b26ff03 perf: Add hash table benchmark
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.
2011-08-03 12:31:41 +02:00
Uli Schlachter
7b5b29cc0f xcb: Handle deferred clear in _upload_image_inplace
Fixes: clip-device-offset, image-surface-source,
composite-integer-translate-source, move-to-show-surface,
source-surface-scale-paint, translate-show-surface, perhaps even more?

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-02 22:34:54 +02:00
Chris Wilson
d356deb182 test: Add a second ring to overlapping-dash-caps
Demonstrate a second artefact when using SQUARE.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-02 15:38:49 +01:00
Adrian Johnson
3f2126f092 pdf: check if images are grayscale or monochrome and encode as such
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.
2011-08-02 23:23:50 +09:30
Chris Wilson
953a4a2e55 test: Add an test case to exercise overlapping caps between dash segments
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-02 14:36:45 +01:00
Andrea Canciani
1e02ffd9a9 scaled-font: Make unscaled font utility functions static
They are only used within cairo-scaled-font.c
2011-08-01 19:22:51 +02:00
Andrea Canciani
daca1d999f scaled-font: Remove _cairo_ft_scaled_font_get_unscaled_font()
It is unused since 068df654da.
2011-08-01 19:21:48 +02:00
Andrea Canciani
400d055f3c hash: Compare hash values before calling keys_equal
If the hash value is different, the keys cannot be equal. Testing this
beforehand can avoid a few function calls and shares this optimization
across all cairo-hash uses.
2011-08-01 19:21:48 +02:00
Andrea Canciani
02665975d3 hash: Improve double hashing
Instead of artificially introducing collisions in the step value by
replacing 0 with 1 (which causes the value 1 to have twice the
frequency of any other value), the step value can simply be computed
as an uniformly distributed value in the range [1, rehash], extremes
included.

This is safe because any step value smaller than the hash modulus is
co-prime with it, hence induces an orbit which includes every integer
in [0, table_size - 1].
2011-08-01 19:21:31 +02:00
Chris Wilson
c5405f7324 perf: Save/restore gstate across runs
Reset the cairo_t to the initial state so that subsequent tests are not
affected by earlier tests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-01 12:59:06 +01:00
Chris Wilson
c4f4c57261 bo-rectangular: perform an incremental sort
Bucketing the rectangles together on their top-scanline and then sorting
within that scanline is significantly faster for dragon despite the extra
passes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-01 12:08:55 +01:00
Chris Wilson
fec80f1199 perf: Add a few more variations to dragon to exercise unaligned lines/spans
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-01 12:08:55 +01:00
Chris Wilson
4a8f638c9a tor: Suppress repeated spans
Under certain circumstances we will emit identical spans for when the
edge covers the entire pixel and then for the subsequent pixels. These
can be squashed into a single span.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-01 12:08:55 +01:00
Chris Wilson
c0407e84e9 test: Extend PDF blend tests to include an opacity mask
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-01 12:08:55 +01:00
Chris Wilson
3520aecfe5 image: the boxes are already pixel-aligned so skip the extra rounding step 2011-08-01 12:08:55 +01:00
Chris Wilson
d553754706 tor: Sort the initial edge correctly
Don't assume that the initial edge on the active list has the lower
position.
2011-08-01 12:08:55 +01:00
Chris Wilson
bca402a8e3 clip: Mark __cairo_clip_all as private and do not export
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-01 12:08:55 +01:00
Andrea Canciani
e04e368748 Remove useless checks for NULL before freeing
This patch has been generated by the following Coccinelle semantic patch:
// Remove useless checks for NULL before freeing
//
// free (NULL) is a no-op, so there is no need to avoid it

@@
expression E;
@@
+ free (E);
+ E = NULL;
- if (unlikely (E != NULL)) {
-   free(E);
(
-   E = NULL;
|
-   E = 0;
)
   ...
- }

@@
expression E;
@@
+ free (E);
- if (unlikely (E != NULL)) {
-   free (E);
- }
2011-07-31 16:46:36 +02:00
Andrea Canciani
8f8da19fd4 font-face: Cleanup backend-specific destruction code
The check for NULL and nil font faces is performed in the shared
code. There is no need to duplicate it (in fact, quartz-font and
ft-font don't do it).
2011-07-31 16:46:36 +02:00
Andrea Canciani
1f2dc2e06a pattern: Do not provide type field in cairo_pattern_union_t
The type field is accessible through the base.type field. This makes
it possible to change the layout of cairo_pattern_t and move the type
field without breaking cairo_pattern_union_t.
2011-07-31 16:46:36 +02:00
Andrea Canciani
b39d3d4b53 surface: Set errors through _cairo_surface_set_status()
The status should never be set directly. Instead, it should be set by
_cairo_surface_set_status().
2011-07-31 13:05:22 +02:00
Andrea Canciani
ed928c51fb Tighten error validation
CAIRO_STATUS_LAST_STATUS is not an error, it is just the number of
possible status values.
2011-07-31 13:05:22 +02:00
Andrea Canciani
90216cfde0 Update FSF address
I updated the Free Software Foundation address using the following script.

for i in $(git grep Temple | cut -d: -f1 )
do
  sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i"
done
2011-07-31 13:05:21 +02:00