Commit graph

6182 commits

Author SHA1 Message Date
Adrian Johnson
497258a4cf ft: fix warning 2011-09-12 22:01:09 +09:30
Adrian Johnson
b0d9b4ce53 pdf: add status check 2011-09-12 21:53:59 +09:30
Chris Wilson
65a954d5ba test-surfaces: compilation fixes
Update to the last minute changes in the traps compositor API.

And so it begins.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-12 11:39:59 +01:00
Chris Wilson
af9fbd176b Introduce a new compositor architecture
Having spent the last dev cycle looking at how we could specialize the
compositors for various backends, we once again look for the
commonalities in order to reduce the duplication. In part this is
motivated by the idea that spans is a good interface for both the
existent GL backend and pixman, and so they deserve a dedicated
compositor. xcb/xlib target an identical rendering system and so they
should be using the same compositor, and it should be possible to run
that same compositor locally against pixman to generate reference tests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

P.S. This brings massive upheaval (read breakage) I've tried delaying in
order to fix as many things as possible but now this one patch does far,
far, far too much. Apologies in advance for breaking your favourite
backend, but trust me in that the end result will be much better. :)
2011-09-12 08:29:48 +01:00
Adrian Johnson
0540bf384a ps: improve formatting of fallback image comment 2011-09-11 00:45:09 +09:30
Adrian Johnson
2d887d99c7 ps: use reusable stream for mesh pattern data
File data used by a shading pattern must reusable since the pattern
may read the file multiple times. As currentfile is not reusable, use
the /ReusableStreamDecode to make it reusable.
2011-09-11 00:45:09 +09:30
Adrian Johnson
166be70cb8 pdf: latin text must use character codes in the toUnicode CMap, not glyph indices 2011-09-09 22:30:49 +09:30
Adrian Johnson
80fc566eaf cff: strip subset tag when reading font name
so we don't end up with two subset tags in the font name when cairo
appends its own subset tag.
2011-09-08 19:29:16 +09:30
Adrian Johnson
7dca94fbc4 pdf: use interpolate in image smask 2011-09-06 23:50:46 +09:30
Adrian Johnson
d47e05f8c2 ps/pdf: fix the polarity of stencil masks 2011-09-06 23:41:12 +09:30
Adrian Johnson
a7ed3dd914 ps: support stencil masks
When the mask is an A1 image (or can be reduced to A1) use the imagemask operator.
2011-09-06 23:21:35 +09:30
Adrian Johnson
c34d6adfcc pdf: use _emit_smask() instead of _emit_imagemask to emit stencil mask
Now that _emit_smask() can generate A1 masks, the _emit_imagemask()
code can be removed and emit_smask() used instead. An additional
benefit is stencil masks can be generated from ARGB32 and A8 images as
well as A1 providing that the analysis of the transparency shows that
the image is opaque or has bilevel alpha.
2011-09-06 21:36:54 +09:30
Adrian Johnson
d6d3825b51 ps: each row of 1-bit image data needs to begin on a byte boundary 2011-09-05 22:31:53 +09:30
Adrian Johnson
3614892d8d pdf: each row of 1-bit image data needs to begin on a byte boundary 2011-09-05 22:30:15 +09:30
Adrian Johnson
42fecf37dc pdf: use ink extents in content stream XObjects 2011-09-05 21:36:43 +09:30
Adrian Johnson
d1f146b54f pdf: use ink extents for pattern bbox 2011-09-05 21:22:12 +09:30
Adrian Johnson
37a22669d8 pdf: use ink extents for smask bbox
There are some inkscape bugs reporting very slow rendering of inkscape
generated PDFs (inkscape uses cairo for PDF output). These bugs are
caused by cairo specifying a page sized bounding box in XObjects and
Patterns. PDF renderers usually use the BBox as the image size when
compositing. As PDFs generated from SVG tends to use a lot of XObjects
and Patterns this can lead to very long rendering times.

These three patches tighten up all the BBoxes in PDF output.
2011-09-05 21:18:36 +09:30
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
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
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
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
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
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
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
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
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
Chris Wilson
236cb8aa22 xlib: Fix typo in snapshotting.
We want to only copy up to the maximum height, not width...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-20 12:01:09 +01:00
Chris Wilson
0efdc8d27e observer: record all operations and their timings
The immediate use of this is to print out the slowest operation of each
type in a replayable manner. A continuing demonstration of how we may
analyse traces...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-20 11:51:50 +01:00
Uli Schlachter
5d92ce3a18 xcb-shm: Fix a logic error while allocating mem
The "continue;" in the old code never worked, because it first checked the loop
condition. Since "FALSE" (hopefully) never evaluates to true, the loop was still
left.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-18 16:34:44 +02:00