Commit graph

6381 commits

Author SHA1 Message Date
Adrian Johnson
0a10982f8c pdf: support RASTER_SOURCE patterns 2012-01-11 23:06:34 +10:30
Martin Robinson
6816f70da5 gl: Fix the offset of non-texture source surfaces 2011-12-16 17:10:03 +00:00
Pekka Paalanen
4c3276e94f egl: do not destroy dummy_surface if it does not exist
On deleting an EGL device, it is possible that
cairo_egl_context_t::dummy_surface is EGL_NO_SURFACE. In that case
calling eglDestroySurface() on it will lead to EGL_BAD_SURFACE error.

Check dummy_surface before destroying it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-16 16:30:12 +00:00
Martin Robinson
b845a191d5 gl/msaa: Scissor simple rectangular clips
Instead of using the stencil buffer to perform simple
rectangular clips, just scissor the clip rectangle.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
[ickle: fixed application to master]
2011-12-16 09:51:40 +00:00
Martin Robinson
bbe692372d gl/msaa: Ignore the antialiasing property of the clip.
If the clip suggests anti-aliasing and we don't support it,
draw the clip anyway. Currently disabling anti-aliasing does
not disable anti-aliasing on certain clips.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-15 19:29:17 +00:00
Martin Robinson
b98c8c1269 gl/msaa: If stenciling the clip fails, reset the color mask.
If the clip failed, not resetting the color mask leaves the GL context
in a state in which we cannot draw anything.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-15 19:22:17 +00:00
Chris Wilson
8f74159d92 gl: Disable the msaa compositor by default (for release testing)
One of the remaining issues with msaa is Cairo's insistence on
allocating a depth-stencil for every target. These cause massive
overallocation and prevents my machines from completing
cairo-perf-trace. So for the time being switch back to the old
fashioned span-based compositor.

To continue development of msaa, or indeed other compositors, we
introduce the CAIRO_GL_COMPOSITOR env variable to allow the default
compositor to be selected. Use CAIRO_GL_COMPOSITOR=msaa to continue to
use the msaa compositor for instance.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-15 19:12:00 +00:00
Chris Wilson
909f4a4a7f gl: Set the destination for swap buffers, required by EGL at least
EGL mandates that the current context be valid for a call to
swapbuffers, and does not just operate upon the drawable passed in. The
current code prevents this as a side effect of calling flush decouples
the current context (so that the state can be clobbered by the
application without impacting upon Cairo). So when we try to swap, EGL
complains.

We can get the desired behaviour by setting the surface upon the
context, thus calling MakeCurrent as necessary, and then flushing any
pending operations before swapping. This has the positive side-effect
of not clobbering our own state unnecessarily.

Reported-by: Pekka Paalanen <ppaalanen@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-12 13:57:10 +00:00
Uli Schlachter
8025fcc4d3 xcb: Add a special case for recording surface
An unbounded recording surface will complain loudly when you call
acquire_source_image on it and thus we need a special case which draws the
recording surface to a temporary surface and then proceeds with that.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-12-11 14:04:16 +01:00
Uli Schlachter
420110d12b xcb: Move the surface picture setup into its own function
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-12-11 13:41:39 +01:00
Uli Schlachter
fe04df11ed xcb: Silence compiler warnings about ignored return values
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-12-11 11:17:06 +01:00
Uli Schlachter
b6fcf0768c xcb: Silence a compiler warning for mixing type and internal type enums
cairo-xcb-surface-render.c:1134:35: warning: comparison between
'cairo_surface_type_t' and 'enum _cairo_internal_surface_type' [-Wenum-compare]

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-12-11 11:14:58 +01:00
Adrian Johnson
be288ce016 doc: fix typos 2011-12-10 00:40:54 +10:30
Adrian Johnson
c7ea92907a ps: simplify the EPS save and restore
userdict is not permitted in EPS files. Since the PS surface does not
leave extra operators or dictionaries on the stack the EPS prolog and
trailer can be reduced to:

save
50 dict begin

....

end
restore

The save/restore pair is required to remove fonts and restore the
graphics state. As "restore" does not restore the dictionary stack,
using a new current dictionary for the EPS file allows the cairo dict
entries to be cleaned up at the end the EPS.

Bug 43634
2011-12-10 00:39:29 +10:30
Chris Wilson
f446e57f35 gl: Track surface references through operands
In the case where we created a surface to handle an operand, it needs to
be freed when we release the operand. However, we also have to be
careful not to introduce reference cycles into ordinary surfaces, so
always remember to teardown the composite setup!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-09 09:20:23 +00:00
Chuanbo Weng
8d4425053d gl: fix bug in _cairo_gl_surface_embedded_operand_init()
The operand->texture.surface should be set to right value, not
NULL. Otherwise, when doing _cairo_gl_surface_operand_init(),
the texture.surface in operand struct will also be NULL, which
is incorrect. This fix regression suite in 43 test cases(such
as source-clip) in cairo/test/.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-09 09:17:28 +00:00
Uli Schlachter
2a60e8deec xcb: Fix invalid casts from cairo_content_t to cairo_format_t
This was introduced in a69335a84e when the second argument of
_cairo_xcb_surface_create_similar_image was changed from content to format.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-12-08 22:41:10 +01:00
Chris Wilson
d828c724c0 gl: Decouple the glyph upon eviction
In order to decouple the texture node from the scaled glyph cache, we
need to add a callback from the rtree for when the node is removed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-07 18:00:18 +00:00
Chris Wilson
98335b4390 doc: Add documentation for cairo_raster_source_pattern
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-07 13:33:47 +00:00
Chris Wilson
cff0097954 gl: Prevent leak of the white source used with glyph masks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-07 11:58:39 +00:00
Chris Wilson
5613b210ff gl: Defer stencil allocation until use
Allocating a stencil and a depth buffer for every destination surface is
simply too expensive and causes major resource issues. So defer the
allocation and attachment of a stencil buffer until just prior to first
use.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-07 10:22:25 +00:00
Keith Packard
950021f881 Clip rectangles are not necessarily YSorted
None of the cairo clipping computations guarantee that the resulting
list of rectangles are constructed in any particular order. Promising
that they are results in an X error (BadMatch) which generally causes
applications to crash.

I suspect this may well be implicated in many (many) bug reports about
applications which use cairo.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-06 18:06:28 +00:00
Chris Wilson
291efa76de polygon: Tweak the y-coordinates of the edge so that it is inside the clip
As we evaluate the line first using y-for-x to find the clipped
vertical range and then rasterise the line using x-for-y, we can incur
severe rounding errors that cause us to draw beyond the clipped region.
The first simple attempt at a fix is to tweak the clipped vertical range
such that the evaluated extents of the line are contained.

Reported-by: Taekyun Kim <tkq.kim@samsung.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-06 14:49:27 +00:00
Chris Wilson
19dd6e7e53 polygon: Assert that we add edges that are wholly contained by the clip
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-06 14:44:57 +00:00
Chris Wilson
6b472e12ae gl: Re-enable the CLEAR optimisation
It was temporarily disabled whilst the surface API was in flux.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-06 11:33:15 +00:00
Adrian Johnson
a8cbb00784 pdf: avoid using pdf patterns to paint/fill translucent linear/radial gradients 2011-12-06 20:47:14 +10:30
Adrian Johnson
79f430e7ad pdf: avoid using pdf patterns to paint/fill opaque linear/radial gradients
Patterns are slower and use more memory to print. For painting and
filling we can use the shading operator to draw gradients.
2011-12-06 20:46:49 +10:30
Adrian Johnson
dee48f0dca ps: allow embedding of cmyk jpeg images 2011-12-06 20:46:35 +10:30
Adrian Johnson
74c0a06105 pdf: allow embedding of cmyk jpeg images 2011-12-06 20:46:21 +10:30
Adrian Johnson
25e35b46bf ps: avoid padding images if the padding is not required to fill the extents 2011-12-06 20:45:31 +10:30
Adrian Johnson
c7ce1b68d5 pdf: don't use patterns with padded images
and avoid padding if the padding is not required to fill the extents.
2011-12-06 20:45:14 +10:30
Adrian Johnson
346b8fe398 type1-subset: remove unused variables 2011-12-06 20:44:50 +10:30
Adrian Johnson
ed7157d705 truetype-subset: remove unused variable 2011-12-06 20:44:22 +10:30
Uli Schlachter
3ebe0ca876 xlib-xcb: Implement surface_set_drawable
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-12-05 22:55:58 +01:00
Uli Schlachter
9ec5e9fee6 xcb: Fixup some internal state in set_{drawable,size}
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-12-05 22:48:56 +01:00
Chris Wilson
3dbb0f17a7 gl: Unbreak the glyph cache
Use the embedded operand on the surface instead of copying it across and
trying to then wrap the surface from it - as it would then unref the
glyph cache surface after the operation and so we would lose the glyphs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-05 18:32:58 +00:00
Chris Wilson
e68eb874e9 fallback: fix the offset for painting
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-05 17:17:26 +00:00
Chris Wilson
dd73add00c gl: Set the device offset on map-to-image
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-05 17:17:26 +00:00
Chris Wilson
f7daaa8fce gl: Propagate clip region
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-05 17:17:26 +00:00
Chris Wilson
3b1151f60d gl: Substitute the white source for the default pattern
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-05 17:17:26 +00:00
Chris Wilson
0ce8dad9a2 gl: Decouple glyphs on shutdown from the scaled font caches
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-05 17:17:26 +00:00
Chris Wilson
31c0726f68 gl: Embed the operand rather than a pattern into the glyph cache
Use the native encoding for patterns.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-05 17:17:26 +00:00
Chris Wilson
16038150b3 gl: Use the embedded operand to allow passing sources around
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-05 17:17:26 +00:00
Chris Wilson
65cd7d3beb gl: Propagate surface texture to embedded operand
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-05 17:17:26 +00:00
Chris Wilson
d7dcf9d28f gl: Check against user-provided invalid sizes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-05 17:17:26 +00:00
Chris Wilson
3edf369ead gl: Make the backend struct static
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-05 17:17:26 +00:00
Chris Wilson
934a3dcc6b doc: Drop the gtk-doc markup from _cairo_radial_pattern_focus_is_inside
Stop confusing gtk-doc with this private function.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-02 16:19:48 +00:00
Chris Wilson
aa5a9c46e1 doc: add CAIRO_DEVICE_TYPE_COGL
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-02 16:17:18 +00:00
Chris Wilson
4a0913eb52 doc: Add new antialias symbols
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-02 16:16:32 +00:00
Chris Wilson
d6440f2d66 script: Add documentation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-02 16:12:02 +00:00