Commit graph

10314 commits

Author SHA1 Message Date
Chris Wilson
2061cd81f2 Replace the ad-hoc surface unwrappers with a function pointer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-09 13:01:17 +00:00
Chris Wilson
7c34997a3b gl: Just flush the context upon operand destroy
Replace the assertion that the context is flushed when we destroy the
operation and jfdi. Easiest way to resolve it rather than untangle just
why we end up there with an unflushed context.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-09 11:30:34 +00:00
Martin Robinson
8c3b86787a gl: Fix gl-source-surface test
When painting a GL surface pattern from one context to a
a surface of another context, be careful to manage the
multiple contexts so that they do not stomp on each other.

[ickle: Preserve fast path for GL subsurfaces]
2012-02-04 21:07:05 +00:00
Adrian Johnson
b52296a435 ps: fix extend-pad-border test failure 2012-02-04 16:25:09 +10:30
Adrian Johnson
477bcd89d7 ps: ensure shading domain is [ 0 1 ]
Printing to a printer with an Adobe PostScript 3 interpreter fails
with rangecheck when the shading domain is not [ 0 1 ]. Workaround
this by using a type 3 function to map from [ 0 1] to the required
domain.
2012-02-02 23:02:48 +10:30
Adrian Johnson
a004fe8529 ps: add missing 'Q' to end of page 2012-02-02 20:50:04 +10:30
Chris Wilson
c6c02f5194 xlib: Only reduce a readback of an uninitialised source for pixmaps
For a foreign drawable, we have to assume to that is dirty upon creation
or otherwise we fail to read back the correct pixel data when copying to
an image.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-02 02:08:19 +00:00
Chris Wilson
24445f9468 xlib: Set IncludeInferiors when acquiring the source image
If we need to fallback and perform a copy first to a pixmap for a
partially unviewable Window, we need to copy its inferiors as well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-02 01:46:56 +00:00
Chris Wilson
b454db4b13 xlib: Set IncludeInferiors when using CopyArea
cairo-xlib semantics state that we copy the contents of a Window's
children when we use a Window as a source in a cairo operation. This
requires that we set the IncludeInferiors SubwindowMode on the GC.
However, we can only set one SubwindowMode for an operation and our
semantics are that drawing performed by cairo onto a Window are clipped
by its children (the ClipByChildren SubwindowMode). Therefore if we have
to copy between two Window, we can not use CopyArea. Furthermore, we
cannot tell if an external Drawable is a Window or a Pixmap, therefore
we treat all foriegn Drawables as Window.

Failure here means falling back to a render path, where we can
independently control the subwindow mode on the source and destination,
or to a GetImage/PutImage if the xserver does not support render.

Reported-by: Benjamin Otte <otte@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-02 01:14:16 +00:00
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
Andrea Canciani
2bb441fd11 test: Add stride-12-image
Add a test to check that all the backends can handle images with a
stride that is not width * 4.
2012-01-15 14:29:25 +01:00
Adrian Johnson
88d589aa47 ps: handle different x/y fallback resolution in Fallback Image comment 2012-01-15 21:29:15 +10:30
Adrian Johnson
284cba1f37 test: add push/pop group to fallback test 2012-01-15 21:18:43 +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
Andrea Canciani
45d9659665 test: Add negative-stride-image
Add a test to check that all the backends can handle images with
negative stride.
2012-01-12 11:53: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
Chris Wilson
20a1676c28 test: Add arc-direction
A simple example of how to draw arcs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-11 12:43:43 +00:00
Chris Wilson
42ad7a2385 perf/chart: Make the columns transculent so that the label behind is visible
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-11 12:43:43 +00:00
Chris Wilson
23ca558a05 perf/chart: Show values next to the column if too small to fit inside
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-11 12:43:43 +00:00
Chris Wilson
56a835eb9d perf/chart: Tweak labels on right not to fall off the edge
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
Adrian Johnson
fefc273c53 test: add fallback
to get a fallback resolution test included in index.html
2012-01-08 21:12:17 +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
Andrea Canciani
5ce6e02793 test: Use fork() on MacOS X
MacOS X 10.7 (and maybe some previous versions, too) can fork()
processes which use CoreGraphics. This makes it possible for
cairo-test-suite to withstand a test crash without killing the whole
suite.

The old behavior is still available using the '-f' (foreground)
option.
2011-12-15 13:04:02 -08: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