Commit graph

6397 commits

Author SHA1 Message Date
Adrian Johnson
d95172858b ps: avoid using ps patterns to paint/fill gradients
Patterns are slower and use more memory to print. For painting and
filling we can use the shading operator to draw gradients.
2012-02-01 22:31:07 +10:30
Adrian Johnson
46ca65895f ps: support RASTER_SOURCE patterns 2012-01-31 23:53:45 +10:30
Adrian Johnson
0f40cdea1b api: add cairo_surface_supports_mime_type
to allow querying if a surface supports a particular mime type.
2012-01-19 19:09:10 +10:30
Chris Wilson
a7c9c75ffa xlib: Improve choice of bits-per-pixel for depth
The only reliable method would be to query the xserver for the
matching bpp for a particular depth. In the absence of such information,
simply chose the next higher power-of-two(depth).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-17 12:40:11 +00:00
Andrea Canciani
a2f419b546 rectangle: Implement _cairo_rectangle_contains_rectangle()
And reuse it.
2012-01-15 18:25:57 +01:00
Andrea Canciani
2808bf5b95 pattern: Infinite color-only sources are always opaque
No matter what the sampling extents are, infinite color-only sources
are opaque.
2012-01-15 18:25:52 +01:00
Andrea Canciani
11493eea9b raster-source: Do not return value in void function
Both MSVC and Sun Studio Compiler complain about void values being
returned.

Fixes:
cairo-raster-source-pattern.c(93) : warning C4098:
'_cairo_raster_source_pattern_release' : 'void' function returning a
value
2012-01-15 16:49:08 +01:00
Andrea Canciani
c1c9424a3d quartz: Do not export private functions
Private functions must be marked cairo_private to avoid exporting
them.
2012-01-15 16:23:14 +01:00
Andrea Canciani
7058e8c181 quartz: Make glyph antialiasing consistent with quartz-font
CAIRO_ANTIALIAS_{FAST,GOOD,BEST} were introduced and used in
cairo-quartz-font.c by commit 70cd3b473d.

Fixes the warnings:

cairo-quartz-surface.c: In function '_cairo_quartz_cg_glyphs':
cairo-quartz-surface.c:1976: warning: enumeration value 'CAIRO_ANTIALIAS_FAST' not handled in switch
cairo-quartz-surface.c:1976: warning: enumeration value 'CAIRO_ANTIALIAS_GOOD' not handled in switch
cairo-quartz-surface.c:1976: warning: enumeration value 'CAIRO_ANTIALIAS_BEST' not handled in switch
2012-01-15 16:23:14 +01:00
Andrea Canciani
29145f4e48 quartz: Fix building with QUARTZ_DEBUG
Multiple code refactorings broke the debugging code.
2012-01-15 16:23:14 +01:00
Adrian Johnson
88d589aa47 ps: handle different x/y fallback resolution in Fallback Image comment 2012-01-15 21:29:15 +10:30
Uli Schlachter
9a199fd403 xcb: Use int instead of uint16_t for rowstride
Fixes negative-stride-image

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-01-12 20:31:16 +01:00
Chris Wilson
738be215da xlib: Fix typo in 5045155de6, lack of closing ';'
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-11 12:45:41 +00:00
Chris Wilson
dc80e8328c subsurface: Add guards for creating similar surface
If the target backend doesn't provide the entry points, just return NULL
(unsupported).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-11 12:43:44 +00:00
Chris Wilson
9e4fb906b8 xcb: Add dimension guards to create-similar-image
Just create a image wrapper for a 0x0 surface, and do not try to create
an image surface that is larger than the maximum X coordinate.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-11 12:43:44 +00:00
Chris Wilson
5045155de6 xlib: Do not upload inplace if the image does not match the surface format
Currently we perform the conversion using XPutPixel which is hideously
slow and so it is faster to create a new surface that matches the
format correctly, upload and allow X to perform the conversion. In other
words disable the "fast" path for format mismatches.

Based on a patch by Ginn Chen <ginn.chen@oracle.com>

Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=716462
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-11 12:43:43 +00:00
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