Commit graph

9072 commits

Author SHA1 Message Date
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
Andrea Canciani
19b840a904 Keep makefiles in alphabetical order
Recording surfaces were at first called meta surfaces. When the name
was changed, makefiles were not updated to keep alphabetical order.
2011-01-01 13:05:12 +01:00
Andrea Canciani
8f598dd69d quartz: Use native PDF blend modes
Quartz supports PDF blend modes since 10.4 and exposes Porter-Duff
compositing operators through the public API since 10.5.
2011-01-01 12:54:32 +01:00
Andrea Canciani
fabbc16253 quartz: Don't dynamically load unused functions
Remove an unused variable.
2011-01-01 12:54:32 +01:00
Andrea Canciani
1bc7d948c7 quartz: Clean up dynamically loaded functions
README indicates MacOSX 10.4 as a requirement for quartz and we are
directly using some functions that have been added to the public
CoreGraphics API in 10.4.

rop 10.3-specific workarounds and link to 10.4 API functions instead
of loading them at runtime.
2011-01-01 12:54:15 +01:00
Uli Schlachter
7f68461e0b Detach snapshots after flushing in cairo_surface_finish()
Flushing a surface can attach snapshots to it, thus we have to detach
the snapshots after the flush, to make sure they aren't leaked.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-29 17:44:07 +01:00
Uli Schlachter
59ac884c60 Verify that surfaces leak no snapshots
Finished surfaces should own no snapshots, because finished surfaces
can't be used as sources, thus their snapshots would never be used.

When free'ing the surface in cairo_surface_destroy(), it should have
no snapshots, or they will be leaked.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-29 17:16:51 +01:00
Chris Wilson
a4ae7d59be gl: Enable PLT symbol hiding for dispatch entries
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-12-25 09:50:34 +00:00
Uli Schlachter
109fcb3950 XCB: Stop taking the xcb socket
This makes the xcb backend use the auto-generated xcb API instead of
hand-writing each request. This should also improve parallelism with non-cairo
threads that use the same xcb connection.

Big thanks to Andrea Canciani for taking a look at this and finding lots of good
improvements (especially finding xcb_send_request was great).

cairo-perf-trace and cairo-perf-diff-files between master
(6732dbf299) and this change:

 $ ./cairo-perf-diff-files ../master_perf ../xcb_no_socket_perf
old: master_perf
new: xcb_no_socket_perf
Speedups
========
  xcb-rgba                  evolution-0    23558.86 (23558.86 0.00%) -> 19338.78 (19338.78 0.00%):  1.22x speedup
▎
  xcb-rgba          poppler-bug-12266-0     98.43 (98.43 0.00%) ->  82.36 (82.36 0.00%):  1.20x speedup
▎
  xcb-rgba         gnome-terminal-vim-0    5518.08 (5518.08 0.00%) -> 4905.92 (4905.92 0.00%):  1.12x speedup
▏
  xcb-rgba    gnome-terminal-20090601-0    45648.46 (45648.46 0.00%) -> 41231.25 (41231.25 0.00%):  1.11x speedup
▏
  xcb-rgba         evolution-20090607-0    71643.69 (71643.69 0.00%) -> 66314.95 (66314.95 0.00%):  1.08x speedup
▏
  xcb-rgba                    poppler-0    3501.69 (3501.69 0.00%) -> 3322.26 (3322.26 0.00%):  1.05x speedup

Slowdowns
=========
  xcb-rgba       gnome-system-monitor-0    7500.01 (7500.01 0.00%) -> 7923.70 (7923.70 0.00%):  1.06x slowdown

  xcb-rgba        swfdec-youtube-full-0    26409.89 (26409.89 0.00%) -> 28430.76 (28430.76 0.00%):  1.08x slowdown
▏
  xcb-rgba gnome-system-monitor-20090821-0    34801.61 (34801.61 0.00%) -> 37891.14 (37891.14 0.00%):  1.09x slowdown

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-25 09:50:34 +00:00
Uli Schlachter
cf0a4ed862 xcb: Remove a wrong optimization
Clear surfaces with an alpha channel are already replaced with a
transparent color in gstate, so this code was never hit.

Clear surfaces without an alpha channel, can be replaced with solid
black only if the surface pattern has an extend other than
CAIRO_EXTEND_NONE.

Fixes the clear-source test for xcb.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Andrea Canciani <ranma42@gmail.com>
2010-12-18 15:50:29 +01:00
Uli Schlachter
e6c3efdd65 xcb: Work around wrong extent computation in the X server
The X server calculates the bounding box for traps and then allocates
a temporary picture for this. When the X server calculates different
values than cairo got in extents->bounded, unbounded operators will
have wrong results. The X server only ever calculates bounds that are
larger than the correct values.

Fix this by explicitly clipping the drawing to the expected bounds.

Fixes clip-fill-{eo,nz}-unbounded and clip-stroke-unbounded.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Andrea Canciani <ranma42@gmail.com>
2010-12-18 15:48:53 +01:00
Andrea Canciani
4e3eb5e8ed gl: Fix #include's to pass 'make check'
'make check' complains that:
Checking that private header files #include "some cairo header" first (or none)
cairo-gl-dispatch-private.h:#include <stddef.h>
Checking that source files #include "cairoint.h" first (or none)
cairo-gl-dispatch.c:#include "cairo-gl-private.h"
cairo-gl-info.c:#include "cairo-gl-private.h"
2010-12-17 19:41:57 +01:00
Uli Schlachter
10e58a4a16 Avoid some unneeded 'is_clear = FALSE'
When a drawing operator doesn't actually have any effect, we don't have to set
the surface's is_clear flag to FALSE.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-15 15:38:36 +00:00
Alexandros Frantzis
2a632b1f54 gl: Remove GLEW from the build system and the source tree 2010-12-15 15:32:20 +00:00
Alexandros Frantzis
7cf9893546 gl: Replace GLEW by using the facilities provided by cairo-gl-info 2010-12-15 15:32:20 +00:00
Alexandros Frantzis
6373db8441 gl: Remove GL 1.x ARB shader implementation
Shaders for GL 1.x ARB are served by the same implementation as GL 2.x and therefore
a dedicated ARB implementation is not needed any more.
2010-12-15 15:32:20 +00:00
Alexandros Frantzis
a6facced8d gl: Use the GL core 2.0 shader implementation for both GL 1.x ARB and GL 2.x
The GL core 2.0 shader implementation can be used by both GL 1.x and 2.x
thanks to the dispatch table.
2010-12-15 15:32:20 +00:00
Alexandros Frantzis
cf518b29e0 gl: Use the dispatch table for calling ARB/EXT functions
Use the dispatch table for calling GL functions that can have multiple name
variants. Also, always use the core variant names for GL constants.
2010-12-15 15:32:20 +00:00
Alexandros Frantzis
ed862d3f7b gl: Add definitions for the core variant names of used GL constants
This allows us to use the core variant of the needed GL constants regardless of the
GL header version that is being used for compilation.
2010-12-15 15:32:20 +00:00
Alexandros Frantzis
e0ab932c61 gl: Embed the GL dispatch table in the cairo-gl context and initialize it. 2010-12-15 15:32:20 +00:00
Alexandros Frantzis
357c2f46a7 gl: Add infrastructure for calling GL functions using a dispatch table
Some GL functions can be called using different names depending on the
GL version and available extensions (ARB, EXT). The dispatch table
abstracts these differences and provides a uniform API for dealing with
these functions.
2010-12-15 15:32:20 +00:00
Alexandros Frantzis
cd7c0df2bb gl: Add functions to query GL version and extensions 2010-12-15 15:32:19 +00:00
Chris Wilson
07abd21a03 test/arc-infinite-loop: Random return value fun. 2010-12-15 15:32:19 +00:00
Andrea Canciani
65040d3e3f test: Add bug-extents
Add a test for the computation of approximate extents used by most
backends to esimate the region affected by drawing operations.

Based on:
http://lists.cairographics.org/archives/cairo/2010-December/021331.html
2010-12-14 22:18:27 +01:00
Chris Wilson
f10b3105d3 scaled-font: assert that we hold the scaled-font mutex when looking up glyphs
Holding the mutex over glyph lookup not only prevents multi-threaded
races between insertion and deletion that spell disaster for memory
integrity, but also implies that the glyph cache is frozen.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-12-13 16:30:15 +00:00
Andrea Canciani
5eadc286d8 path: Silence warnings
gcc complains that:

cairo-path-fixed.c:400: warning: inlining failed in call to
  '_cairo_path_fixed_drop_line_to': call is unlikely and code size
  would grow
2010-12-13 11:09:20 +01:00
Andrea Canciani
c05135a348 test: Update ref images
The recent (and not-so-recent) changes in gradient code changed the
results of some tests involving gradients.

radial-gradient-* tests are marked XFAIL for pdf because poppler is
not sampling the color function with a sufficient frequency, but they
look correct in Adobe Reader.
2010-12-13 10:05:42 +01:00
Andrea Canciani
3cbe82fe58 ps,pdf: Deal with empty domain gradients.
If all the stops of the gradient have the same offset and the
pattern's extend mode is EXTEND_PAD, then we cannot use the stops'
domain as the interpolation parameter range because this would produce
a gradient with the same start and end objects.  Such ranges tickle
bad behaviour in rasterisers.

We replace the color function with an appropriate step function
defined on [0 1].

Fixes radial-gradient-one-stop for pdf and ps3.

Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
2010-12-13 10:05:11 +01:00
Andrea Canciani
36e58aea51 ps: Unify gradient emitters and support all extend modes.
To draw repeated gradients in ps, which only supports none and pad
extended gradients, we need an appropriate reparametrization of the
gradients that will cover the whole clip region without needing
repeats.

This commit adds support for the drawing of reflect/repeat-extended
radial gradients through native ps patterns, using pad-extension and
no fallbacks.

Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
2010-12-13 10:05:03 +01:00
Andrea Canciani
20ef062511 pdf: Unify gradient emitters and support all extend modes.
To draw repeated gradients in pdf, which only supports none and pad
extended gradients, we need an appropriate reparametrization of the
gradients that will cover the whole clip region without needing
repeats.

This commit adds support for the drawing of reflect/repeat-extended
radial gradients through native pdf patterns using pad-extension and
no fallbacks.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=28870

Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
2010-12-13 09:46:09 +01:00
Andrea Canciani
ca7f141dd7 quartz: Unify gradient construction and fix radial gradients.
Share code between linear and radial gradients, using
_cairo_gradient_pattern_box_to_parameter() instead of open coding the
parameter range computation.

As a side effect this fixes parameter range computation for radial
gradients, because the previous code assumed that the focal point was
inside the circles.

Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
2010-12-13 09:46:09 +01:00
Andrea Canciani
341e5b3246 pattern: Add a function to interpolate gradient objects.
This will be a common function used by the quartz, ps, and pdf
backends when rewriting EXTEND_REFLECT/REPEAT gradients in terms
of EXTEND_PAD gradients.

Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
2010-12-13 09:46:09 +01:00
Andrea Canciani
08cb6db520 pattern: Use pattern parameter range when analysing all gradients.
This patch adds support for analysing the transparency of a
radial gradient within some area of interest.  Before the code
would ignore the extents for radial gradients.  Linear gradients
now use _cairo_linear_pattern_box_to_parameter() allowing us
to remove the superfluous _extents_to_linear_parameter().

Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
2010-12-13 09:46:09 +01:00
Andrea Canciani
790837ac68 pattern: Compute a covering parameter range of a gradient for a box.
This makes it possible to compute the interpolation range needed to
correctly draw a gradient so that it covers an area of interest.

Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
2010-12-13 09:46:09 +01:00
Andrea Canciani
d1e9bdf7f1 ps: Avoid unneeded fallbacks for gradients with opaque stops.
_cairo_pattern_is_opaque() returns false for none-extended linear
gradients and for radial gradients, but fallback is only needed if
they have non-opaque stops.
This can be tested using _cairo_pattern_alpha_range(), which only
analyses the part of the pattern which is drawn.

Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
2010-12-13 09:46:09 +01:00
Andrea Canciani
ec4c085624 ps, pdf, pattern: Implement _cairo_pattern_alpha_range to analyse patterns.
Both the ps and pdf backends are open coding analyses of the
range of pattern alphas.  This patch factors out a new function
_cairo_pattern_alpha_range() to do that for them.

Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
2010-12-13 09:46:09 +01:00
Andrea Canciani
6579bf728f pattern: Improve extents computation of radial gradients.
Use the tests for degeneracy and new radial gradient definition
when computing pattern extents.  Degenerate gradients are optimised
away by cairo-gstate into solid or clear patterns, and
the radial gradients semantics have changed to match PDF semantics.

Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
2010-12-13 09:46:08 +01:00
Andrea Canciani
86695aced9 pattern: Specialise signatures of pattern specific functions
Change the signature of type-specific functions to make them only
accept the correct pattern type instead of the abstract cairo_pattern_t.

Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
2010-12-13 09:46:08 +01:00
Andrea Canciani
ac9ed746b0 ps: Use switch instead of multiple if's
This ensures that the compiler is able to automatically point out any
unhandled pattern type.

Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
2010-12-13 09:46:08 +01:00
Andrea Canciani
e6ab2e6821 pdf: Use switch instead of multiple if's
This ensures that the compiler is able to automatically point out any
unhandled pattern type.

Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
2010-12-13 09:46:08 +01:00
Andrea Canciani
790d6140e7 test: Update reference images list
Some reference images were added or removed in
f85af7fe8d,
e2dcbfd895 and
670eb260eb, but Makefile.am was not
updated accordingly.
2010-12-13 09:43:13 +01:00
Andrea Canciani
85a489f0f2 polygon: Merge _cairo_polygon_init and _cairo_polygon_limit
_cairo_polygon_limit() had to be called immediately after
_cairo_polygon_init() (or never at all).

Merging the two calls is a simple way to enforce this rule.
2010-12-10 11:04:48 +01:00
Andrea Canciani
75f34b595a fill: Simplify path to polygon conversion
Using _cairo_path_fixed_interpret_flat() greatly simplifies the path
to polygon conversion (because it already converts curve_to's to
line_to's).

This commit also removes the optimization which merges two consecutive
lines if they have the same slope, because it's unlikely (since it
should already happen during path construction), it doesn't provide
better performance (at least not measurable with the currently
available cairo-traces) and bloats the code.
2010-12-10 11:04:47 +01:00
Andrea Canciani
df453b7aca path: Remove support for inverse direction interpretation
The previous commit guarantees that paths are always interpreted in
the forward direction, so the code allowing both directions is not
needed anymore.
2010-12-10 11:04:47 +01:00
Andrea Canciani
a8ae8759f5 path: Always interpret in forward direction
Path are always interpreted in forward direction, so the ability of
interpreting in the opposite direction (which is very unlikely to be
useful at all) can be removed.
2010-12-10 10:58:51 +01:00
Andrea Canciani
83605de995 path: Cleanup unused current_point
The code keeps track of the current point but doesn't use it.

Remove it to clean up.
2010-12-10 10:49:37 +01:00
Andrea Canciani
f317a31b3f surface: Remove _cairo_surface_*_extents
They have been replaced by cairo_composite_rect_t functions.
2010-12-10 10:34:47 +01:00
Andrea Canciani
0ae9b54741 pdf: Use composite rectangles in fill_stroke
All other pdf drawing functions have been updated to use
cairo_composite_rectangles_t to compute the extents affected by the
operation in 3a5d71c431, but fill_stroke
was not changed.

This removes the last usage of the old _cairo_surface_*_extents()
functions.
2010-12-10 10:34:47 +01:00
Andrea Canciani
71e6520fa6 surface: Remove _cairo_surface_fill_rectangle
It is not used anymore.
2010-12-10 10:34:47 +01:00
Andrea Canciani
17fef8c437 test: Add arc-infinite-loop
The handling of angles above 2pi in cairo_arc is not very solid and is
basically untested.

This test should ensure that huge inputs don't hang cairo.
2010-12-09 17:33:12 +01:00