Commit graph

9775 commits

Author SHA1 Message Date
Andrea Canciani
ed84cb522c wideint: Fix build on suncc
"static cairo_private" means nothing and suncc complains loudly about
it. The visibility of _cairo_double_to_uint64() and
_cairo_uint64_to_double() should just be "static".
2011-09-04 16:23:37 -07:00
Andrea Canciani
01729606fb malloc: Fix build on suncc
cairo-malloc-private.h depends on malloc() and realloc() being
declared, hence it should include stdlib.h.
2011-09-04 16:23:37 -07:00
Andrea Canciani
761ef7ae8b cairo-missing: Fix and cleanup ssize_t type definition
The definition of ssize_t is needed in cairo-missing.h and can be
dropped from files which include it.
2011-09-04 16:23:37 -07:00
Andrea Canciani
60e04ff49e observer: Fix build on suncc
Returning a void value is an error on suncc and causes a warning on msvc:
cairo-surface-observer.c(1273) : warning C4098:
'_cairo_surface_observer_release_source_image' : 'void' function
returning a value
2011-09-04 16:23:36 -07:00
Jesse van den Kieboom
b0aec95c8e quartz: Rename declaration of _cairo_quartz_create_cgimage
The function was renamed in 81efbc1847
but the prototype was not updated.

Silences the warning:
cairo-quartz-surface.c:165: warning: no previous prototype for 'CairoQuartzCreateCGImage'

Along with 0c620080af, fixes
https://bugs.freedesktop.org/show_bug.cgi?id=40082
2011-09-03 09:15:48 -07:00
Uli Schlachter
968eb30bba xcb: Steal from the pending list for GetImage
Before using some piece of SHM again, we must be sure that the X11 server is no
longer working with it. For this, we send a GetInputFocus when we are done with
the SHM locally and will only use the memory again when the reply comes in.

However, if we are allocating the memory for SHM GetImage, then we can re-use
memory earlier, because the server processes requests in order. So it will only
start writing to the memory after it is done with earlier requests for this
memory. So instead of using GetInputFocus for synchronisation, the SHM GetImage
request will automatically do this for us.

Thanks to Chris Wilson for this idea.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-02 15:21:20 +02:00
Uli Schlachter
ea52556531 xcb: Fix fixup_unbounded_with_mask
This code was casting a pixman_box32_t* to cairo_box_t*. However, a box uses
fixed point numbers while the pixman box uses integers which means the result
was off by factor 256.

The fix is to replace the use of _cairo_boxes_limit() with
_cairo_boxes_init_with_clip(). However, this means this function no needs to be
passed a clip instead of a clip region which causes some minor changes to
_composite_boxes().

This improves the result for tighten-bounds again. Out of the tested
combinations, 10 are fixed by this. This bug was hit by code similar to this
(Repeating here since that test has so many different cases):

cairo_set_operator (cr, CAIRO_OPERATOR_IN);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_rectangle (cr, 0, 0, SIZE, SIZE);
cairo_rectangle (cr, 0, 0, SIZE, SIZE);
cairo_rectangle (cr, SIZE / 4, SIZE / 4, SIZE / 2, SIZE / 2);
cairo_clip_preserve (cr);
cairo_fill (cr);

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-02 15:12:25 +02:00
Uli Schlachter
ed7f992c13 xcb: Skip drawing if bounded extents are empty
This only wraps the whole code block in an if which checks if the bounded
extents are empty. No other changes are done in here.

This fixes the failed assertion from the tighten-bounds test.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-02 15:12:25 +02:00
Andrea Canciani
1bcc27985f perf: Fix win32 build
Microsoft C Compiler complains about:

hash-table.c(44) : error C2466: cannot allocate an array of constant
size 0

Adding an unused element makes it happy.
2011-09-02 12:52:47 +02:00
Andrea Canciani
b1a1dfcdcf win32: Fix linking
round() is not available on win32 and causes the linking to fail with:

cairo-surface-observer.obj : error LNK2019: unresolved external symbol
round referenced in function percent
2011-09-02 12:45:49 +02:00
Andrea Canciani
04a7bad923 surface: Fix make check
cairo_surface_map_to_image() and cairo_surface_unmap_image() are
called by cairo-surface-observer but they are not slim_hidden:

Checking .libs/libcairo.so for local PLT entries
00000000002e27a8  0000019d00000007 R_X86_64_JUMP_SLOT
     000000000005df30 cairo_surface_unmap_image + 0
00000000002e2b90  0000026100000007 R_X86_64_JUMP_SLOT
     000000000005f5c0 cairo_surface_map_to_image + 0
2011-09-02 12:45:49 +02:00
Andrea Canciani
14fab8f84a script: Fix make check
make check fails because cairo-script-private.h cannot be compiled
standalone:

./cairo-script-private.h:45:1: error: unknown type name ‘cairo_private’
...

./cairo-script-private.h:48:40: error: unknown type name ‘cairo_output_stream_t’
2011-09-02 12:45:49 +02:00
Andrea Canciani
297aa4d4a0 perf: Fix readme
The README in perf/ was not updated when cairo-perf.c was renamed to
cairo-perf-micro.c
2011-09-02 12:45:49 +02:00
Andrea Canciani
dcd3e2cde1 perf: Get rid of cairo_perf_ticks_per_second()
The cairo_time_from_s() and cairo_time_to_s() functions should be used
instead.
2011-09-02 12:45:49 +02:00
Andrea Canciani
9172e2aec0 perf: Drop cairo_perf_ticks_t in favor of cairo_time_t
cairo_time_t offers a superset of the functions provided by
cairo_perf_ticks_t.
2011-09-02 12:45:49 +02:00
Andrea Canciani
2855ff4666 perf: Reuse cairo-time
Instead of redefining time getters, use the generic one provided by
_cairo_time_*.
2011-09-02 12:45:49 +02:00
Andrea Canciani
6d6bfbd641 Introduce the cairo-missing library
The cairo-missing library provides the functions which are needed in
order to correctly compile cairo (or its utilities) and which were not
found during configuration.

Fixes the build on MacOS X Lion, which failed because of collisons
between the cairo internal getline and strndup and those in libc:

cairo-analyse-trace.c:282: error: static declaration of ‘getline’ follows non-static declaration
/usr/include/stdio.h:449: error: previous declaration of ‘getline’ was here
cairo-analyse-trace.c:307: error: static declaration of ‘strndup’ follows non-static declaration
...
2011-09-02 12:27:13 +02:00
Andrea Canciani
0101a54579 time: Add cairo_time_t type
Add the cairo_time_t type (currently based on cairo_uint64_t) and use
it in cairo-observer and in the perf suite.

Fixes the build on MacOS X (for the src/ subdir) and Win32, whch
failed because they don't provide clock_gettime:

cairo-surface-observer.c:629: error: implicit declaration of function 'clock_gettime'
cairo-surface-observer.c:629: warning: nested extern declaration of 'clock_gettime'
cairo-surface-observer.c:629: error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
...
2011-09-02 12:27:13 +02:00
Andrea Canciani
e7204a3631 win32: Fix compilation
cairo-image-surface-private.h is needed in order to access
cairo_image_surface_t fields.

Fixes multiple build errors:

error C2037: left of '...' specifies undefined struct/union
'_cairo_image_surface'
2011-09-02 12:00:29 +02:00
Andrea Canciani
0c620080af quartz: Fix compilation
cairo-image-surface-private.h is needed in order to access
cairo_image_surface_t fields.

Fixes multiple build errors: dereferencing pointer to incomplete type
2011-09-02 12:00:29 +02:00
Andrea Canciani
6fd174b423 perf: Silence gcc warning
Silence:

dragon.c: In function 'do_dragon_solid':
dragon.c:167: warning: unused variable 'r'
2011-09-02 12:00:29 +02:00
Uli Schlachter
d66d9cd777 xcb: Fix fallback for *_shm_put_image
This function shouldn't ever be called is xcb-shm is disabled. However, it is
still defined to avoid lots of #ifdefs.

Additionally, this removes the only use of uint64_t from cairo-xcb.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-30 22:19:33 +02:00
Uli Schlachter
5f45f696d0 xcb: Add an assert for the tighten-bounds test
This code casts the result of _cairo_xcb_surface_create_similar() to
cairo_xcb_surface_t*. However, the tighten-bounds test makes this run with
bounded extents of size 0x0 and thus _cairo_xcb_surface_create_similar() falls
back to an image surface. Ugly.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-30 22:10:34 +02:00
Uli Schlachter
70118ee119 test: Add tighten-bounds
In the spirit of the new big-{little,empty}-{box,triangle} tests, this test
combines various paths. However, these paths are not only filled but also used
for clipping, resulting in 120 different combinations.

No backend currently succeeds the test. The reference image is a gimp-ination of
the image and test-fallback results and thus certainly wrong. Feel free to fix.

Additionally, this makes the xcb backend die with an ugly failed assert.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-30 22:03:33 +02:00
Chris Wilson
7df7964333 observer: Add missing return codes
Upon detecting the user error, supply an error code!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-30 15:17:41 +01:00
Chris Wilson
70cd3b473d api: Extend cairo_antialias_t to include performace/quality hints
The existing API only described the method to be used for performing
rasterisation and unlike other API provided no opportunity for the user
to give a hint as to how to trade off performance against speed. So in
order to no be overly prescriptive, we extend the NONE/GRAY/SUBPIXEL
methods with FAST/GOOD/BEST hints and leave the backend to decide how
best to achieve those goals.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-30 15:17:38 +01:00
Chris Wilson
6b1daace57 perf: Print a summary of each operation for a trace (using '-s')
In order for this to be effective on small system we also need to
disable the recording of the long traces which exhaust all memory...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-30 13:28:47 +01:00
Chris Wilson
7ae2708fc8 test: Add big-empty-triangle
One last variant to make sure we handle the case of the disappearing
unbounded triangle.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-29 15:58:28 +01:00
Chris Wilson
f71cfe84fe test: Add big-empty-box
Another variant on big-little-box, to make sure we trim the extents
before doing the empty unbounded fixup.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-29 15:58:20 +01:00
Chris Wilson
249c89c313 test: Add big-little-triangle
A variant on big-little-triangle to exercise the non-rectangular paths.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-29 15:58:09 +01:00
Adrian Johnson
2927d13ab2 pdf: use a new clipper object in recording_subsurface 2011-08-29 21:31:09 +09:30
Adrian Johnson
c317e215fb ps/pdf: use a new clipper object when emitting a recording surface 2011-08-29 21:27:23 +09:30
Krzysztof Kosiński
8d91de4926 test: Add test case from bug-40410
Exercises a case where we failed to fill a rectangle...
2011-08-26 23:04:01 +01:00
Chris Wilson
09d8fc926f test: Add clip-mixed-antialias
The wonders one sees when looking at webpages. Who knew people would be
so inventive with clips?

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-26 10:41:59 +01:00
Adrian Johnson
bd44455131 font-subsets: fix wrong string length 2011-08-24 20:35:10 +09:30
Behdad Esfahbod
c13249c63a [ft] Minor 2011-08-23 15:51:05 +02:00
Chris Wilson
6cdad1931a observe: Provide the sum of the elapsed time of the individual operations
We can use the elapsed time of the indiividual operations to profile the
synchronous throughput of a trace and eliminate all replay overhead. At
the cost of running the trace synchronously of course.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-23 14:41:10 +01:00
Adrian Johnson
ba1060fbbc cff-subset: fix decoding of real numbers 2011-08-23 00:32:51 +09:30
Adrian Johnson
cdb00dec42 cff-subset: don't easily give up parsing a charstring if we already have the width
The 2 byte operators can be ignored of we don't need or have already found
the width.
2011-08-21 20:12:42 +09:30
Adrian Johnson
23dfd92b29 cff-subset: fallback when parsing the charstrings in bare cff fonts fails
We need to parse all used charstrings in bare CFF fonts to extract the widths.
2011-08-21 18:27:07 +09:30
Chris Wilson
c3e990ea7d observer: correct classification of aligned paths
We were misclassifying rectilinear paths as aligned strokes, which is
bogus until we analyse the offset path.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-20 16:34:38 +01:00
Chris Wilson
bb3d06a5dc test: Add shape-general-concave
A discussion that we've been having is the use of contours in filling,
and for optimizing for convex contours in particular. A devious mind
quickly generates a shape using a convex "contour" whose hull is larger
than its area. This is due to the self-intersection of the "contour"
which if properly excised causes the contour to be classed as concave.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-20 16:14:13 +01:00
Chris Wilson
2134306eaf test: Extend rotate-image-surface-paint
Apply two common clipping methods just to add a little bit of further
complication.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-20 14:11:30 +01:00
Chris Wilson
9f6820210d test: Extend record-extend to exercise similar surface sources
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-20 13:09:41 +01:00
Chris Wilson
f8f25f52ec test: Add record-mesh
Test capture and replay of mesh patterns.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-20 13:09:41 +01:00
Chris Wilson
4226bfd695 test: Add big-little-box
This exercises the bug

  https://bugzilla.mozilla.org/show_bug.cgi?id=668921

which is caused by a failure to tighten the extents after tessellating
the path and the unbounded fixup is skipped as it is believed the path
covers the whole area.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-20 13:09:40 +01:00
Chris Wilson
2eeae45cc7 test: Add checkerboard
Simply tests the rendering of the checkerboard commonly used as a
background in the test suite.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-20 13:09:40 +01:00
Chris Wilson
4d6c62514c observer: bypass surface mid-layer and call into recording surface directly
As we want to record the exact command pass to us, we want to bypass any
further optimisations that the surface mid-layer might perform before
passing the operation to the recording surface.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-20 13:02:00 +01:00
Chris Wilson
f49dae8013 observer: copy glyphs around call into backend
As the backend is allowed to modify the glyph array, we need to copy it
for recoding.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-20 13:01:01 +01:00
Chris Wilson
cb243acee5 recording: optionally disable optimise away clears
The observer wants to get an accurate recording of all operations,
including clears.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-20 12:48:25 +01:00