Commit graph

314 commits

Author SHA1 Message Date
Chris Wilson
4713562eda trace: Remove the warning about the unstable format
We're stuck with the PostScript style for this generation now.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-25 10:50:21 +00:00
Chris Wilson
f5f303f10d script: Prefer polymorphorism for mesh path construction
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-25 10:48:50 +00:00
Chris Wilson
8844d50308 Convert cairo_mime_surface_t to cairo_raster_source_pattern_t
As discussed, overloading the cairo_surface_t semantics to include
sources (i.e. read-only surfaces) was duplicating the definition of
cairo_pattern_t. So rather than introduce a new surface type with
pattern semantics, start along the thorny road of extensible pattern
types.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-25 10:35:42 +00:00
Andrea Canciani
549b1f8d4b boilerplate: Remove unused thread id parameter
The thread id is not used anymore (it is always == 0), so it can be
removed.
2011-11-12 20:49:08 +01:00
Andrea Canciani
90b2fd34fb cairo-script: Don't ask for inlining of a cold-path function
Silences a lot of warnings:

inlining failed in call to 'scan_read.part.9': call is unlikely and
code size would grow
2011-11-09 14:17:10 +01:00
Chris Wilson
538fa0d6fb fill: Fix unantialiased rectilinear-fill-to-boxes
We were calling the antialias close function from the unantialiased
paths - a function that operates on a completely different structure to
the one passed in.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-30 15:58:14 +01:00
Chris Wilson
add9a4092b trace: Emit an stack operation to create a pattern from an undefined surface
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-27 14:56:55 +01:00
Andrea Canciani
f8e4657d8a Make cairo-missing a static library
It was meant to be static, but my autotools-fu was not good enough.
2011-09-18 09:01:07 -07:00
Chris Wilson
35f41d253f fdr,tee: Reorder master/slave invocation to capture death-upon-signals
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-16 13:48:09 +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
Andrea Canciani
6ad63946d4 cairo-missing: Fix build
The cairo-missing code contains multiple typos and uses
_cairo_*alloc*() functions without including cairo-malloc-private.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
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
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
545f30856a stroke: Convert the outlines into contour and then into a polygon
In step 1 of speeding up stroking, we introduce contours as a means for
tracking the connected edges around the stroke. By keeping track of
these chains, we can analyse the edges as we proceed and eliminate
redundant vertices speeding up rasterisation.

Coincidentally fixes line-width-tolerance (looks like a combination of
using spline tangent vectors and tolerance).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-15 10:31:47 +01:00
Chris Wilson
2220693a40 Introduce cairo_mime_surface_t
The mime surface is a user-callback surface designed for interfacing
cairo with an opaque data source. For instance, in a web browser, the
incoming page may be laid out and rendered to a recording surface before
all the image data has finished being downloaded. In this circumstance
we need to pass a place holder to cairo and to supply the image data
later upon demand.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-15 00:16:09 +01:00
Chris Wilson
2c885a2753 script: Missed break for creating unbounded recording surfaces.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-14 12:37:57 +01:00
Chris Wilson
9dc9f24884 script: leave the tail of the RGB24 data unmolested
We clear past the end of the row so that we don't trigger valgrind
warning leaving harmless uninitialised bits inside the input image.
However, for RGB24 the input rowlen is 3*width, whereas we write 4*width
of data, so we need to take account of that and ensure we clear beyond
the end of the written data, not the read data.

Fixes reading of RGB24 input.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-14 12:37:57 +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
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
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
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
Chris Wilson
b2ee7d9a21 trace: Emit the content type for image surfaces
Currently we only emit the format, but if you want to later convert
the images to a normal surface for replay it is handy to have the
content.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 17:14:42 +01:00
Andrea Canciani
89cb071d14 script: Initialize recording extents
The 2-arguments recording operator was passing a garbage pointer to
the surface creation function.

Spotted by the clang static analyzer.
2011-07-29 10:42:06 +02:00
Chris Wilson
a69335a84e API: map-to-image and create-similar-image
A common requirement is the fast upload of pixel data. In order to
allocate the most appropriate image buffer, we need knowledge of the
destination. The most obvious example is that we could use a
shared-memory region for the image to avoid the transfer cost of
uploading the pixels to the X server. Similarly, gl, win32, quartz...

The other side of the equation is that for manual modification of a
remote surface, it would be more efficient if we can create a similar
image to reduce the transfer costs. This strategy is already followed
for the destination fallbacks and this merely exposes the same
capability for the application fallbacks.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26 14:55:58 +01:00
Chris Wilson
7f77e2f36a trace: Create a new opcode for recording surface
During replay we want to handle recording surfaces specially, and not
redirect the creation of those to the target surface. This is similar to
the need to keep image surfaces as images during replay.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 22:50:25 +01:00
Uli Schlachter
0dc63f5bb4 cairo-trace: Fix mark-dirty with xcb backend
cairo-xcb's acquire_source_image implementation will attach the image it returns
as a snapshot to the xcb surface. cairo_surface_mark_dirty_rectangle asserts
that the surface doesn't have any snapshots attached. cairo-trace will emit the
surface to the trace when it was marked dirty by drawing it to an image surface.

The combination of these three things caused a failed assertion when cairo-trace
was used on something which uses xcb/Xlib and which uses mark_dirty.
I found this with firefox and xlib-xcb.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-17 17:53:23 +02:00
Uli Schlachter
cc3e4c6ec9 Handle CAIRO_STATUS_DEVICE_FINISHED in switches
Fixes all warnings that looked like this:

warning: enumeration value 'CAIRO_STATUS_DEVICE_FINISHED' not handled in switch

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-09 11:19:49 +02:00
Andrea Canciani
5291f7ccad script-interpreter: Build on win32
Restructure the Makefiles in .sources, .am and .win32 to enable
building cairo-script-interpreter on Win32.

Some minor changes are needed to compile on MSVC:
 - include stdint.h to define INT_MAX-like macros
 - redefine "inline"
 - avoid deprecated functions (snprintf, replaced by _snprintf)
 - define _USE_MATH_DEFINES so that math.h defines M_PI, M_SQRT2 and
   M_LN2
2011-06-24 14:13:09 +02:00
Andrea Canciani
3a504282ef build: Don't build cairo-sphinx when the tee surface is off
cairo-sphinx depends on cairo-tee, which is not always enabled.

Reported-by: James Cloos <cloos@jhcloos.com>
2011-06-16 15:11:24 +02:00
Chris Wilson
61fd10376f cairo-trace: Fix use of buf outside of scope
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37746
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-06 15:05:51 +01:00
Chris Wilson
e21b373c94 cairo-trace: Fix an obscure bug recording the fishtank
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-26 16:31:40 +01:00
Jesse Barnes
356c4ed9cc Expose 30bpp/10bpc support: CAIRO_FORMAT_RGB30
This is a common format used by framebuffers to drive 10bpc displays
and is often hardware accelerated by XRender with underlying support
from pixman's x2r10g10b10 format (which provides coercion paths for
fallbacks).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-01 09:00:14 +01:00
Andrea Canciani
ad458d816a trace: Always emit a function name for write-to-png-stream
By emitting an empty function name when it it impossible to perform
the lookup, we can get rid of the warning:

trace.c:3714: warning: unused variable ‘symbol’

Additionally, this makes the syntax (or, rather, the parameter count)
for write-to-png-stream the same on every configuration.
2011-03-18 17:54:54 +01:00
Chris Wilson
df1dd83880 trace: Fix hint_style/hint_metrics typo
Compiler warning saves the day!

trace.c: In function ‘_emit_font_options’:
trace.c:2973:20: warning: comparison between ‘cairo_hint_style_t’ and
‘enum _cairo_hint_metrics’

A genuine bug, thanks gcc!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-03-18 13:23:26 +00:00
Andrea Canciani
5f039f0f89 mesh: Rename cairo_pattern_mesh_* functions to cairo_mesh_pattern_*
This is consistent with the naming of most cairo types/functions
(example: cairo_foo_surface_*).

The substitution in the code has been performed using:

  sed -i 's/cairo_pattern_mesh_/cairo_mesh_pattern_/' <files>
2011-02-07 20:28:09 +01:00
Andrea Canciani
96426fdf01 script: Add support for mesh patterns
Extend CairoScript with operators based on the mesh pattern API.
2011-01-01 13:05:13 +01:00
Adrian Johnson
ed24deaa2e mesh: Add mesh pattern type and enum values
Add the mesh pattern type and an error status to be used to report an
incorrect construction of the pattern.

Update the backends to make them ready to handle the new pattern type,
even if it cannot be created yet.
2011-01-01 13:05:12 +01:00
Benjamin Otte
5a762edc28 build: Don't build cairo-fdr when the tee surface is off 2010-10-28 14:00:24 +02:00
Chris Wilson
8258532794 Reduce the cairo_device_type_t to only hold the used entries.
This should help clarify the documentation by not mentioning non-existent
devices and prevent any assumed coupling between surface-type values and
devices.
2010-09-06 13:11:22 +01:00
Benjamin Otte
3a8b8fcc2a gobject: Fix header defines 2010-09-01 21:14:40 +02:00
M Joonas Pihlaja
8fb91dc3f6 script: Fix script backend build.
The flight data recorders were missing an include
of cairo-tee.h ever since cairo-tee.h became an optional
backend.
2010-08-10 00:53:53 +03:00
Benjamin Otte
661f4859cd Add cairo-gobject library
This library is supposed to contain GType declarations for Cairo types.
It is also meant to support gobject-introspection binding creation.
2010-08-07 20:19:27 +02:00
M Joonas Pihlaja
1e7485f8e5 trace: Avoid stdbool.h C99ism.
There is no <stdbool.h> on old Solaris without invoking
c99 mode explicitly.
2010-07-12 00:50:13 +03:00
M Joonas Pihlaja
fca8977219 build: Rework pthread detection.
Use two levels of pthread support: a minimal level used to
build cairo itself, and a full level to build threaded apps
which want to use cairo.  The minimal level tries to use
pthread stubs from libc if possible, but falls back to the
full level if that's not possible.  We use CFLAGS=-D_REENTRANT
LIBS=-lpthread to find a real pthread library since that seems
to work on every unix-like test box we can get our hands on.
2010-07-11 21:40:26 +03:00
Chris Wilson
9b9952ab4f Convert mime data length to use unsigned long
What we want to use is size_t, but we don't want the implied POSIX
dependency. However, POSIX does say that size_t is an unsigned integer
that is no longer than a long, so it would appear safe to use an
unsigned long as a replacement. Safer at least than unsigned int.
2010-07-10 11:16:19 +01:00
Chris Wilson
2dc42af942 script: Update csi-exec to match new interface. 2010-05-27 17:53:30 +01:00
Benjamin Otte
e3b2212bc5 build: Fix pthread detection
Incorporate the pthread detection code from the autoconf archive. Should
fix build on obscure archs that pretend to be UNIXy - like Mac OS X
Tiger.

http://www.gnu.org/software/autoconf-archive/
http://www.gnu.org/software/autoconf-archive/ax_pthread.html
2010-05-13 15:17:27 +02:00