Commit graph

6324 commits

Author SHA1 Message Date
Chris Wilson
8844d50308 Convert cairo_mime_surface_t to cairo_raster_source_pattern_t
As discussed, overloading the cairo_surface_t semantics to include
sources (i.e. read-only surfaces) was duplicating the definition of
cairo_pattern_t. So rather than introduce a new surface type with
pattern semantics, start along the thorny road of extensible pattern
types.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-25 10:35:42 +00:00
Chris Wilson
2c4f6bbfbc gl: Prevent the traps compositor from exploding
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-24 10:16:22 +00:00
Chris Wilson
5e4a0bd892 gl: Embed a operand into the surface for pass-through
The traps compositor expects to be able to pass either in a surface or a
source to its composite functions, so make it so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-24 10:16:22 +00:00
Chris Wilson
4cf001244a gl: Avoid cleaning up an uninitialised composite upon UNSUPPORTED
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-24 10:16:22 +00:00
Chris Wilson
5edb3a29b9 gl: Fallback for complex subsurfaces
In the process we need to supply the sampled area and operation extents
into the operands.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-24 10:16:22 +00:00
Chris Wilson
12b8f94161 gl: Correctly offset sub-image uploads
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-24 10:16:22 +00:00
Chris Wilson
e280e67b86 gl: Update glyphs to use cairo_gl_source_t
It was being passed into the function but then interpreted as a
cairo_pattern_t. Fix it!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-23 21:20:21 +00:00
Martin Robinson
d99ebe9862 gl: Properly prepare the source when compositing glyphs with a mask.
After the architecture rewrite, glyph compositing via a mask was
disabled. This change reinstates that.
2011-11-23 20:49:37 +00:00
Martin Robinson
33c59030b5 gl: Fix offset for non-texture surface patterns
Instead of drawing only a portion of the image into the intermediate
texture, draw the entire image and adjust the translation matrix to
compensate.
2011-11-23 20:49:30 +00:00
Martin Robinson
c94c3eede0 gl/msaa: Fix scissor bounds
Scissor bounds should depend on both the height and y coordinate
of the bounding box. Also remove _cairo_gl_y_flip() since we were
the last caller.
2011-11-23 20:49:16 +00:00
Andrea Canciani
e3ec127e39 subsurface: Fix 'make check'
2fb4a0e119 made the
_cairo_surface_subsurface_set_snapshot available with default
visibility.

'make check' correctly points out that it should be marked as private.
2011-11-23 20:17:56 +01:00
Chris Wilson
6a2b754ec9 xlib: Eliminate redundant copies of subsurfaces
If the sample is wholly contained within the subsurface of the original,
we can simply use the original with an offset; thereby only copying the
data if we are sampling outside the subsurface bounds.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-23 18:40:02 +00:00
Chris Wilson
49d3a6a95e xlib: Cache the subsurface Picture
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-23 17:36:16 +00:00
Chris Wilson
763d98071e surface: Bump reference count around finish
In order to handle reference cycles during finish (through snapshots) we
need to bump the reference on the surface first.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-23 17:35:39 +00:00
Chris Wilson
2fb4a0e119 subsurface: Support caching for cloned subsurfaces
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-23 17:35:30 +00:00
Chris Wilson
894d8c8bf7 xlib: Handle subsurfaces correctly
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-23 15:40:15 +00:00
Chris Wilson
e217677ce6 xlib: ADD only reduces to SOURCE for alpha-only targets
Fixes operator.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-23 14:57:35 +00:00
Chris Wilson
44a868b552 subsurface: And remove the dead code for releasing complex source
Following the previous commit, we only allocate a simple image when
acquiring the source so we only need to unreference it upon release.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-23 14:28:27 +00:00
Chris Wilson
1fe16f75b1 image: Remove dubious "optimisations" for acquired source images
By this point we have already paid the penalty for acquiring the source
image, so kiss.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-23 14:19:22 +00:00
Chris Wilson
c52129feb4 subsurface: Simplify acquire_source_image
Remove all of the special casing and simply extract the source. The time
for special casing is to avoid calling the generic acquire in the first
place, so kiss.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-23 14:19:22 +00:00
Chris Wilson
73dc2c4e27 image: Only unwrap a subsurface if the sample is fully contained
In order to handle out-of-bounds sampling of a subsurface target we need
to first avoid incorrectly unwrapping it.

Fixes crash in subsurface-outside-target

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-23 14:14:39 +00:00
Murray Cumming
8d989d2b2d cairo_surface_observer_mode_t: Remove trailing comma.
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-11-21 20:53:51 +01:00
Chris Wilson
56746110fe polygon-intersection: Finish any edges upon intersection
In order to keep the bookkeeping in order, and so prevent a later
assert, we need to clear any edges when swapping the active edge order
upon an intersection event. The active edges are then reconstructed.

Fixes evince http://www.horizonhobby.com/pdf/BLH3500-Manual_EN.pdf

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-21 16:57:42 +00:00
Andrea Canciani
adb5eb6f69 xcb: Fix typo 2011-11-18 12:23:02 +01:00
Chris Wilson
2283ab9698 xcb: Handle SHM exhaustion gracefully
Avoid the assertion failure of creating an error surface for an internal
status by handling the expected UNSUPPORTED condition.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-18 10:01:55 +00:00
Chris Wilson
c8dca5dad6 Revert "xcb: Fix xcb-huge-image-shm"
This reverts commit 3a94f4c709.

We need to fallback to pushing large images over the wire if we exhaust
the SHM space.
2011-11-18 09:59:34 +00:00
Uli Schlachter
3a94f4c709 xcb: Fix xcb-huge-image-shm
The test failed with the following message:

cairo-surface.c:2265: _cairo_surface_create_in_error: Assertion `status <
CAIRO_STATUS_LAST_STATUS' failed.

_cairo_xcb_surface_create_shm_image() passed the error from
_cairo_xcb_connection_allocate_shm_info() to _create_in_error().

Fix this by never returning CAIRO_INT_STATUS_UNSUPPORTED from
_allocate_shm_info(). All other error cases in that function return
CAIRO_STATUS_NO_MEMORY, too.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-11-15 19:46:46 +01:00
Uli Schlachter
edc238b40f xcb: Fix some invalid casts
cairo-xcb was deciding which type to cast a surface to based on its "type"
member. This is wrong, it should use "backend->type".

This bug was hit via xlib-xcb. This was painting a subsurface of a xlib-xcb
surface to an xcb surface. Because surface->type said "xlib", the code was
trying to check if the xcb surface had a fallback. However, this was done on the
subsurface. The end result was dereferencing a pointer to 0x28.

This was noticed while looking into
https://bugs.freedesktop.org/show_bug.cgi?id=42889

No test for this bug since I didn't manage to come up with one.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-11-15 19:19:44 +01:00
Andrea Canciani
de6a1e68fe Remove useless checks for NULL before freeing
This patch has been generated by the following Coccinelle semantic patch:

// Remove useless checks for NULL before freeing
//
// free (NULL) is a no-op, so there is no need to avoid it

@@
expression E;
@@
+ free (E);
+ E = NULL;
- if (unlikely (E != NULL)) {
-   free(E);
(
-   E = NULL;
|
-   E = 0;
)
   ...
- }

@@
expression E;
@@
+ free (E);
- if (unlikely (E != NULL)) {
-   free (E);
- }
2011-11-12 20:49:08 +01:00
Andrea Canciani
d883775f69 xml: Fix backend structure
The xml backend structure was being initialized with the wrong
functions, resulting in multiple "initialization from incompatible
pointer type" warnings.
2011-11-09 13:49:45 +01:00
Andrea Canciani
26d5bb0ecc default-context: Fix 'make check'
'make check' reports:

Checking that .libs/libcairo.so has the same symbol list as cairo.def
1a2,3
> _cairo_default_context_fini
> _cairo_default_context_init

Checking .libs/libcairo.so for local PLT entries
0011a274  00025f07 R_386_JUMP_SLOT        00026350   _cairo_default_context_fini
0011a494  00027607 R_386_JUMP_SLOT        00026480   _cairo_default_context_init

Marking these functions as cairo_private fixes the problem.
2011-11-09 13:34:53 +01:00
Andrea Canciani
f5c00042b0 cogl: Fix 'make check'
'make check' reports:

./cairo-cogl-context.c: * cairo_path_fixed_t in user coordinates that we can use to create a
./cairo-cogl-context.c: * We use this hash to lookup a cairo_cogl_path_meta_t struct which
./cairo-cogl-context.c: * need to use the cairo_path_fixed_t api to describe a rectangle in terms of
./cairo-cogl-context.c: * passed the current cairo_t context we don't have a good way
Error: some type names in the docs are not prefixed by hash sign,
neither are the only token in the doc line followed by colon.
Fix this by searching for the following regexp in the above files:
    '^[^:]*:[/ ][*]\( .*[^#']\| \|^\)\<cairo[0-9a-z_]*_t\>\($\|[^:]$\|[^:].\)'

./cairo-cogl-context.c: * cairo_path_fixed_t in user coordinates that we can use to create a
./cairo-cogl-context.c: * We use this hash to lookup a cairo_cogl_path_meta_t struct which
./cairo-cogl-context.c: * need to use the cairo_path_fixed_t api to describe a rectangle in terms of
./cairo-cogl-context.c: * passed the current cairo_t context we don't have a good way
Error: some function names in the docs are not followed by parentheses.
Fix this by searching for the following regexp in the above files:
    '^[^:]*:[/ ][*]\(\|[  ].*\)\([^#']\|^\)\<\(cairo_[][<>/0-9a-z_]*\>[^][<>(]\)'

Checking that source files #include "cairoint.h" first (or none)
cairo-cogl-context.c:#include "cairo-cogl-context-private.h"

These are fixed trivially by this patch.
2011-11-09 12:34:16 +01:00
Andrea Canciani
7688da2245 vg: Fix build
Add the missing includes, fix a typo and some changes in the
signatures of the backend functions.

The dest acquisition functions can be removed as they are not used
anymore in the new compositor architecture (this will probably cause
failures when fallbacks are tried because of unsupported operations).
2011-11-09 12:25:03 +01:00
Andrea Canciani
54c8a08f3e quartz-image: Fix build
Add missing headers and fix some minor things (typos, missing
arguments, changed function name).

Map and unmap now rely on the generic path.
2011-11-09 11:27:28 +01:00
Andrea Canciani
f9aa85f5fe stroke: Fix typos
The condition was comparing out with itself (always resulting in a
true result) instead of out and in.

Pointed out by Clang as "idempotent operation".
2011-11-02 13:13:32 +01:00
Chris Wilson
c64ec4e49c gl: Initialize spans on the context
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-02 11:00:40 +00:00
Chris Wilson
2a453ee7df Merge branch 'master' of git://cairographics.org/git/cairo 2011-10-27 19:00:58 +01:00
Carlos Garcia Campos
8ddecc08a5 xlib: Check pixman format before trying to create an image surface for it 2011-10-27 18:13:29 +02:00
Andrea Canciani
5c31566678 rectangle: Fix warning
In 545f3085.. the cairo_spline_add_point_func_t type was modified to
accept the tangent in the point, but cairo-rectangle.c was not updated
accordingly.

Fixes:

cairo-rectangle.c: In function '_cairo_box_add_curve_to':
cairo-rectangle.c:297:11: warning: passing argument 1 of
'_cairo_spline_bound' from incompatible pointer type
2011-10-26 15:10:59 +02:00
Ehsan Akhgari
26c9994393 Avoid defining inline when compling C++ on MSVC.
Cairo fails to build with VC11 because it tries to #define inline,
which is a keyword in C++. VC11's xkeycheck.h catches this with an #error.
https://bugzilla.mozilla.org/show_bug.cgi?id=694797
2011-10-17 10:48:50 -04:00
Martin Robinson
3813066f13 gl/msaa: Fix glScissor bounds
When scissoring the compositing extents for windows, flip
the y coordinate as windows use a projection matrix that
does the same.
2011-10-15 09:05:19 +01:00
Chris Wilson
cc3f06a58a Merge branch 'master' of git://cairographics.org/git/cairo 2011-10-15 08:59:35 +01:00
Chris Wilson
ba855a12e8 xlib-xp 2011-10-14 16:01:27 +01:00
Chris Wilson
10ebda8698 xlib: Reduce the composite traps operator for when the dest is clear
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-14 13:23:02 +01:00
Chris Wilson
a8c3a22f2d gl/msaa: Markup the new symbols as private for PLT hiding
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-14 13:20:09 +01:00
Taekyun Kim
e8dd13c8fa image: Maximum number of spans can be upto (extents->width + 1)
The range of span's x coordinate is between xmin and xmax. So we
have to allocate the span array with size of xmax - xmin + 1.
2011-10-14 13:20:09 +01:00
Martin Robinson
c25027f2a1 gl/msaa: Support for solid color strokes.
Add support for basic solid color strokes using the fixed path
stroke shaper. Currently components of the stroke overlap, but
that will be handled in the following patch.
2011-10-13 14:42:23 +01:00
Martin Robinson
32aa361c5e gl/msaa: Add clipping support
Adds basic clipping to the OpenGL MSAA compositor via the
depth and stencil buffers. Stenciling and depth bits are
stored in a renderbuffer.

Note that we only attach renderbuffers to surfaces created by ourselves
and not for foreign drawables (e.g. X Windows).
2011-10-13 14:42:23 +01:00
Martin Robinson
13d9d07ccd gl/msaa: Implement basic solid color fill
Introduce the very basic functionality of an MSAA compositor
for OpenGL. For this first patch only solid fills are supported.
2011-10-13 14:42:15 +01:00
Martin Robinson
9f85eb52d8 gl/msaa: Introduce an MSAA compositor for OpenGL
The MSAA compositor will composite OpenGL primitives directly and
anti-alias via the GPU.
2011-10-13 14:42:09 +01:00