Commit graph

153 commits

Author SHA1 Message Date
Chris Wilson
2587b9dfd3 ft: Export FreeType synthesis options
Currently you can only specify that a cairo_ft_font_face_t should
synthesize a font (to make a bold variant) through an FcPattern. That is
direct consumers of the public cairo-ft API have no control over the
synthesize options.

Rectify this by creating some public API to allow control over the
synthesis flags, and include the ability to construct an oblique as
well an embolden font.

Based on a patch by Deokjin Kim <deokjin81.kim@samsung.com>.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-29 12:04:54 +00:00
Robert Bragg
571a27b4fc backends: Adds a new Cogl based backend
This adds a new GPU accelerated backend for Cairo based on the Cogl 3D
graphics API.

This backend aims to support Cairo in a way that translates as naturally
as possible to using a GPU, it does not strive to compete with the
anti-aliasing quality of the image backend if it can't be done
efficiently using the GPU - raw performance isn't the only metric of
concern, so is power usage.

As an overview of how the backend works:
- fills are handled by tessellating paths into triangles
- the backend has an extra fill_rectangle drawing operation so we have
  a fast-path for drawing rectangles which are so common.
- strokes are also tessellated into triangles.
- stroke and fill tessellations are cached to avoid the cpu overhead
  of tessellation and cost of upload given that its common for apps to
  re-draw the same path multiple times. The tessellations can survive
  translations and rotations increasing the probability that they can be
  re-used.
- sources and masks are handled using multi-texturing.
- clipping is handled with a scissor and the stencil buffer which
  we're careful to only update when they really change.
- linear gradients are rendered to a 1d texture using a triangle
  strip + interpolating color attributes. All cairo extend modes
  are handled by corresponding texture sampler wrap modes without
  needing programmable fragment processing.
- antialiasing should be handled using Cogl's multisampling API

XXX: This is a work in progress!!
TODO:
- handle at least basic radial gradients (No need to handle full
  pdf semantics, since css, svg and canvas only allow radial gradients
  defined as one circle + a point that must lie within the first
  circle.) - currently we fall back to pixman for radial gradients.
- support glyph rendering with a decent glyph cache design. The
  current plan is a per scaled-font growable cache texture + a
  scratch cache for one-shot/short-lived glyphs.
- decide how to handle npot textures when lacking hardware support.
  Current plan is to add a transparent border to npot textures and use
  CLAMP_TO_EDGE for the default EXTEND_NONE semantics. For anything else
  we can allocate a shadow npot texture and scale the original to fit
  that so we can map extend modes to texture sampler modes.
2011-10-11 09:05:45 +01:00
Uli Schlachter
7ba28ff563 cairo-xcb: Require libxcb 1.6
Since commit 968eb30bba, we use xcb_discard_reply(). This function was
added in libxcb 1.6.

"Fixes": https://bugs.freedesktop.org/show_bug.cgi?id=40925

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-16 17:45:27 +02:00
Adrian Johnson
dc2ed6dca2 Refresh some pdf/ps ref images 2011-09-13 22:29:56 +09:30
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
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
Chris Wilson
2f020c4ade obsever: include the operation timings
Seeing the relative amounts of time spent in each operation and the
slowest one of each, gives further insight into the peculiarities of a
trace. And hopefully point out areas of improvement.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-18 14:10:20 +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
62e48b01b4 script: enable by default
I'm willing to make this a supported backend as I find it to be an
invaluable debugging tool...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-14 21:01:29 +01:00
Chris Wilson
eee66899cd Introduce cairo_surface_observer_t for performance analysis
Another logging passthrough surface that records the style of operations
performed trying to categorise what is slow/fast/important.

In combination with perf/cairo-analyse-trace it is very useful for
understanding what a trace does. The next steps for this tool would be
to identify the slow operations that the trace does. Baby steps.

This should be generally useful in similar situations outside of perf/
and should be extensible to become an online performance probe.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-14 20:54:53 +01:00
Chris Wilson
6d1c0e6d28 Fix pollution from skia commit
I forgot to proof-read the patch before pushing and forgot I had left in
some damage from trying to get skia to link using libtool.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 10:06:08 +01:00
Chris Wilson
1ccd269a3f skia: Update to use cairo_backend_t interface
Still hopelessly broken. Requires compiling cairo to use static linking
and then still requires manual linkage to workaround libtool. Lots of
functionality is still absent - we need to either find analogues to some
Cairo operations or implement fallbacks - but it is sufficient to
investigate how Skia functions in direct comparison with Cairo for
tessellation/rasterisation.

Caveat emptor.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 09:58:02 +01:00
Andrea Canciani
aa646e47f3 Use new pixman formats
b132fae5e8 introduced the usage of two
new pixman formats. This requires pixman 0.22, but makes it possible
to fix some TODO's left behind in gl and vg.
2011-07-21 20:15:50 +02:00
Chris Wilson
507b8abcf6 Excise xcb-drm
The experiment was at best a pyrrhic victory. Whilst it did show that
you could successfully subvert cairo_xcb_surface_t and provide the
rendering locally faster (than the xlib driver at that time), any
performance benefits were lost in the synchronisation overheads and
server-side buffer allocation.

Once cairo-gl is mature, we need to look at how we can overcome these to
improve client-side rendering

In the meantime, cairo-xcb is no longer my playground for
experimentation and is shaping up to become a stable backend...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-14 12:46:26 +01:00
Chris Wilson
5d9da3decf Excise DRM-Xr
I've since incorporated (nearly) all the features from cairo-drm into
xf86-video-intel, making this experiment defunct.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-14 12:35:19 +01:00
Andrea Canciani
463a8b67a3 perf: Fix build on win32
The performance tools build system for Win32 hasn't been maintained
for some time.  The makefiles are now structured as in other
directories (Makefile.sources used by both Makefile.am and
Makefile.win32) and some additional code hides os-specific parts.
2011-06-24 14:13:09 +02:00
Andrea Canciani
45665c0d48 Remove if's from Makefile.sources
make on win32 complains that:

make[1]: Entering directory `/home/ranma42/Code/fdo/cairo/src'
../src/Makefile.sources:220: *** missing separator.  Stop.

Makefile.sources should not contain if's, which are aoutomake-only
conditionals.  The correct way to conditionally include files is to
enable/disable them using C preprocessor macros.
2011-06-14 15:25:08 +02:00
Alexandros Frantzis
c2b4bc6dea gl: Fall back to dlsym() if *GetProcAddress() fails
In strictly conforming EGL implementations, eglGetProcAddress() can be used
only to get extension functions, but some of the functions we want belong to
core GL(ES). If the *GetProcAddress function provided by the context fails,
try to get the address of the wanted GL function using standard system
facilities (eg dlsym() in *nix systems).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:36:03 +01:00
Alexandros Frantzis
f84653422a gl: Add GLESv2 backend to build system
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:34:17 +01:00
Andrea Canciani
d866bb0405 xlib: Fix compilation when gradient functions are not available
It is not correct to rely on the version defined in render.h. The
Xrender.h header is independent and might not define some functions
available in RENDER 0.10.

Their availability must be detected at configure time and the stubs
must be defined only if the functions are not available.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=31906
2011-02-14 11:07:02 +01:00
Uli Schlachter
9e7ce0c352 xcb: Automatically enable the backend if the libs are available
It looks like the cairo-xcb backend is in a good shape and hopefully will be a
supported backend for cairo 1.12.0. Let's see if this causes lots of new bugs to
be uncovered. :-)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-26 17:54:13 +01:00
Pino Toscano
0e199ccc57 LD_PRELOAD is supported on Hurd
LD_PRELOAD is supported on Hurd. Adding Hurd to the list of supported
systems makes cairo-trace available on them as well.

See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=608492
2011-01-25 14:36:01 +01:00
Andrea Canciani
72a9d49a53 Bump pixman requirements to 0.20.2 for radial gradients
Pixman has PDF-like radial gradients since 0.20.0, but the
implementation of the tangent circles case was not correct. This has
been fixed in 0.20.2, along with some invalid operations fixes.
2011-01-19 15:04:49 +01:00
Alexandros Frantzis
2a632b1f54 gl: Remove GLEW from the build system and the source tree 2010-12-15 15:32:20 +00:00
Erik Zeek
6dda9c4465 Fix build on gentoo
The problem is probably caused by a change in the behavior of autoconf
(2.67).

See http://bugs.gentoo.org/336329
2010-11-05 09:14:41 +01:00
Joerg Sonnenberger
2b3d9b3a3a LD_PRELOAD is supported on DragonFly. 2010-10-12 22:08:49 +02:00
Tomáš Chvátal
0f070bd5ff Fix posix calls in configure.ac test code.
Fixes https://bugs.gentoo.org/show_bug.cgi?id=336779

Signed-off-by: Tomáš Chvátal <scarabeus@gentoo.org>
2010-09-11 21:59:17 +01:00
Chris Wilson
a48eccbf77 configure: Fix typo "(requires both --enable-xcb)" 2010-09-07 13:58:29 +01:00
Chris Wilson
8127f1f5d5 Bump pixman requirements to 0.18.4 for assorted fixes. 2010-09-06 13:11:22 +01:00
Benjamin Otte
54a651564c build: Work around caching not reevaluating uncached variables
This is a somewhat crude hack to ensure that GOBJECT_CFLAGS/LIBS are
properly cached.
2010-09-01 18:47:16 +02:00
Benjamin Otte
28ba78a971 gobject: Fix pkgconfig file variable
I confused % and $. I blame it on spec files.
2010-09-01 18:46:46 +02:00
Maarten Bosmans
6eab5ee10c build: prefer libpng14 over older versions
Also move libpng to the front of the list, so that the default
version of the system is first checked.
2010-08-29 08:12:12 +03:00
Benjamin Otte
df8f964234 build: Fudge the build system some more so it handles extra libs
Add NONPKGCONFIG_EXTRA_LIBS that are only put into the generated pc file
but not used when linking. This is now used to add -lcairo-gobject to
the cairo-gobject.pc file.
2010-08-10 01:24:30 +02:00
Benjamin Otte
01325ad767 gobject: Include the extra library in the pkgconfig file 2010-08-10 00:11:59 +02:00
Benjamin Otte
e31b56e020 configure: Fix gobject handling
1) Explicitly depend on glib, too.
2) Don't link gobject into libcairo proper (thanks Joonas for noticing).
2010-08-08 16:09:13 +02:00
Andrea Canciani
f71a618bd2 Fix configuration if gobject is absent
Autodetect gobject and only use it if present.
Its absence is not to be considered a failure since it's not required.
2010-08-07 21:32:09 +02: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
Benjamin Otte
142df6f963 configure: Disable xml backend by default
We don't want to enable it by default when nobody uses it.
2010-07-30 22:27:28 +02:00
Benjamin Otte
9f33f8453b configure: Disable tee backend by default
We don't want to enable it by default when nobody uses it.
2010-07-30 22:27:27 +02: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
Benjamin Otte
bf117e4ea7 build: fix glew include
Currently wether internal glew is built is dependant on wether the
tarball in use was built with internal glew or not. And that's not how
it should be.
2010-07-09 18:43:38 +02:00
Benjamin Otte
f7fc8569a7 build: Fix C++ issues with automake
This is an attempt to fix the broken situation we've been in where
automake links libcairo.la with c++ because it might potentially maybe
include C++ files.

Those potential files only exist in Chris' throwaway backends (skia, qt)
and the BeOS backend, so for 99.99% of cases, these backends are not
needed and linking with c++ is overkill. Also, no one wants to have
libcairo.so link to libstdc++.

This patch fixes that in mutliple steps:
1) Add build infrastructure to distinguish between C and C++ backends.
   This is done by allowing to specify backend_sources as well as
   backend_cxx_sources variables in Makefile.sources.
2) Optionally build a libcairo_cxx.la noinst library
   This intermediate library is built for C++ backends only and therefor
   linked using c++. It is then linked into the final libcairo.la. This
   does not require c++, so the linking of libcairo.la is done with cc.

This also works around various weirdnesses that the current build system
exposes, where it assumes cisms when in fact using c++ semantics, like
not detecting c++ properly or:
https://bugzilla.redhat.com/show_bug.cgi?id=606523
2010-07-09 12:38:37 +02:00
Benjamin Otte
9de25a0297 configure: remove dolt
libtool should be fast by now
2010-07-05 18:38:33 +02:00
Benjamin Otte
eb63284fc3 configure: Use automake silent rules
This replaces shave usage.
If silent rules are not available, don't use them.
2010-07-05 18:29:58 +02:00
Benjamin Otte
68bbb6b4a0 configure: remove shave 2010-07-05 00:35:39 +02:00
Chris Wilson
e2220a1f3a configure: Try an alternate name for system glew. 2010-06-15 11:45:54 +01:00
Chris Wilson
25ec0c1e9b build: Enable system GLEW on non-UNIX platforms 2010-06-15 10:59:01 +01:00
Zoxc
505a0456d2 gl: Added WGL context and surface. 2010-06-14 12:46:26 +01:00
Chris Wilson
14d6c3e054 configure: Include PTHREAD_CFLAGS in CAIRO_LDFLAGS
Required for successful linking of our programs. I am not sure what the
impact this has upon other users of Cairo yet, I think we need to export
the PTHREAD_CFLAGS via cairo.pc as well.
2010-05-16 10:07:07 +01:00