Commit graph

9963 commits

Author SHA1 Message Date
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
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
Chris Wilson
7df2c113b1 ft: Add missing break to enable BGR subpixel rendering
Reported-by: Ingo Ruhnke <grumbel@gmx.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40456
Original-patch-by: Simon Elmir <nerd65536+freedesktop@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-13 13:06:31 +01:00
Uli Schlachter
9208df1630 test: Add text-antialias-subpixel-{,v}{bgr,rgb}
There were no tests for any subpixel order but rgb, so let's write something for
all four possibilities.

This is mostly copy&paste from test/text-antialias.c (and
text-antialias-subpixel-rgb does the same thing as text-antialias-subpixel).

Test for: https://bugs.freedesktop.org/show_bug.cgi?id=40456

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-13 13:40:20 +02:00
Chris Wilson
282cfff156 recording-surface: Initialize optimize-clears before use in snapshotting
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-12 17:12:09 +01:00
Chris Wilson
f84f6ecaa4 gstate: Prevent leak of old clip when creating a group with translation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-12 17:09:12 +01:00
Chris Wilson
8f34fa033e spans: Refresh polygon limits after trimming the composite extents
Trimming the composite extents may result in the clip being
reconstructed, but we the polygon continued to hold a reference into the
freed clip's array of boxes. So if we intend to reuse the polygon limits
after performing the clip we need to refresh them.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-12 17:04:16 +01:00
Chris Wilson
d576319e13 recording-surface: Optimize away anything below an opaque fill
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-12 16:33:45 +01:00
Chris Wilson
8f5736b8b1 recording-surface: Free the contents of the command array when clearing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-12 16:19:58 +01:00
Chris Wilson
9c63168b5f clip: Replace the original clip when transforming
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-12 16:19:33 +01:00
Chris Wilson
17173f9613 clip: Free the freed clip pool on reset
To keep valgrind happy.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-12 16:01:42 +01:00
Chris Wilson
a7d0470357 surface-clipper: Fix path leak due to typo
When finishing the path, it is better to call fini() rather than init()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-12 15:56:36 +01:00
Chris Wilson
ea50ca6883 test: Add clip-polygons
To exercise the recent bug found in handling empty clip surfaces.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-12 15:10:34 +01:00
Chris Wilson
b2aa687de6 spans: Propagate internal status when retrieving the clip surface
Including the information that there is nothing to do due to being
all-clipped-out.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-12 14:50:41 +01:00
Chris Wilson
5d1a17f354 mono: Silence valgrind by placing a sentinel value in the sorted buckets
If the edges finish before we complete the last scanline, we will
attempt to skip over the remaining lines using min_height of the
sentinel edge (MAX_INT). This causes us to read beyond the end of the
array of insertion buckets, unless we place a sentinel value in there to
break the loop.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-12 14:26:08 +01:00
Chris Wilson
88a1b83177 observer: Fix typo and handle the condition of no script device
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-11 13:49:36 +01:00
Chris Wilson
c8bfa8c088 xcb: Re-enable glyph rendering
I lost the '&& 0' I put in to disable the glyph rendering until I had
the glyph cache integration working again.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-11 12:44:25 +01:00
Chris Wilson
a09f70586d gl: Remove unused alpha argument from operand_emit
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-11 11:58:10 +01:00
Chris Wilson
4f5d42f6e5 gl: Spans start after the mask, not coincident!
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-11 11:39:28 +01:00
Chris Wilson
4163391322 gl: Include use-coverage in shader hash
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-11 11:39:27 +01:00
Robert Bragg
571a27b4fc backends: Adds a new Cogl based backend
This adds a new GPU accelerated backend for Cairo based on the Cogl 3D
graphics API.

This backend aims to support Cairo in a way that translates as naturally
as possible to using a GPU, it does not strive to compete with the
anti-aliasing quality of the image backend if it can't be done
efficiently using the GPU - raw performance isn't the only metric of
concern, so is power usage.

As an overview of how the backend works:
- fills are handled by tessellating paths into triangles
- the backend has an extra fill_rectangle drawing operation so we have
  a fast-path for drawing rectangles which are so common.
- strokes are also tessellated into triangles.
- stroke and fill tessellations are cached to avoid the cpu overhead
  of tessellation and cost of upload given that its common for apps to
  re-draw the same path multiple times. The tessellations can survive
  translations and rotations increasing the probability that they can be
  re-used.
- sources and masks are handled using multi-texturing.
- clipping is handled with a scissor and the stencil buffer which
  we're careful to only update when they really change.
- linear gradients are rendered to a 1d texture using a triangle
  strip + interpolating color attributes. All cairo extend modes
  are handled by corresponding texture sampler wrap modes without
  needing programmable fragment processing.
- antialiasing should be handled using Cogl's multisampling API

XXX: This is a work in progress!!
TODO:
- handle at least basic radial gradients (No need to handle full
  pdf semantics, since css, svg and canvas only allow radial gradients
  defined as one circle + a point that must lie within the first
  circle.) - currently we fall back to pixman for radial gradients.
- support glyph rendering with a decent glyph cache design. The
  current plan is a per scaled-font growable cache texture + a
  scratch cache for one-shot/short-lived glyphs.
- decide how to handle npot textures when lacking hardware support.
  Current plan is to add a transparent border to npot textures and use
  CLAMP_TO_EDGE for the default EXTEND_NONE semantics. For anything else
  we can allocate a shadow npot texture and scale the original to fit
  that so we can map extend modes to texture sampler modes.
2011-10-11 09:05:45 +01:00
Chris Wilson
5783bbfc75 debug-traps 2011-10-11 09:05:44 +01:00
Chris Wilson
2cb4eb53fe perf 2011-10-11 09:05:44 +01:00
Chris Wilson
3d51ec8a79 botor: Remove a couple of inlines to cleanup -Winline
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-10 15:22:37 +01:00
Chris Wilson
34f507a919 gl: Need to increment reference count when copying operands
Or else watch everything die with use-after-free of the cached
gradients.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-09 19:54:15 +01:00
Chris Wilson
a6c27b500b gl: Basic fixes to get cairo-gl running again
Let there be textures!

Unbreak the setup of surface operands after my lazy convertion to the
new compositor interface. This is still only the first step, but it gets
the essentials up and running again, enough to keep me happy whilst
sitting in the airport.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-09 19:54:15 +01:00
Chris Wilson
22c485017d gl: Declare coverage input for fragment shaders.
The most minor of oversights which prevented compilation of any spans
based compositors.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-09 19:54:15 +01:00
Uli Schlachter
d825f6a263 clip_intersect_boxes: Fix memleak
There were two code path were we already had called
_cairo_boxes_init_for_array() on a local variable, but we tried to return
without going through _cairo_boxes_fini().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-09 09:39:25 +02:00
Uli Schlachter
dca4e6c2dd clip: Fix clip-double-free
If the call to _cairo_clip_set_all_clipped() right after this is hit,
clip->boxes was freed twice.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-09 09:37:03 +02:00
Uli Schlachter
4092e90be5 test: Add clip-double-free
This test tries to exercise a double free bug in the clipping code.

My webkit-based browser recently crashed a lot. Here is the reason why.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-09 09:33:37 +02:00
Uli Schlachter
a419d00fbe flush: Detach mime data
Drawing directly to a surface has to be surrounded with cairo_surface_flush()
and cairo_surface_mark_dirty().

However, if the surface has mime data associated, this would hit the following
assert:

lt-cairo-test-suite: cairo-surface.c:1381: cairo_surface_mark_dirty_rectangle:
Assertion `! _cairo_surface_has_mime_data (surface)' failed.

This is now fixed by detaching all mime data in cairo_surface_flush().

Buzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41409

Fixes: create-from-png, create-from-png-stream

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-09 09:22:26 +02:00
Uli Schlachter
b9e5cd9572 create-from-png*: Test mark_dirty with mime data
This currently hits the following assertion:

lt-cairo-test-suite: cairo-surface.c:1381: cairo_surface_mark_dirty_rectangle:
Assertion `! _cairo_surface_has_mime_data (surface)' failed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41409

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-09 09:21:13 +02:00
Adrian Johnson
61fdaaf7e5 cff: fallback if seac style endchar is found
Bug 41548
2011-10-09 15:25:42 +10:30
Adrian Johnson
e2dca74edf cff: in CID fonts the CID is the glyph index
Need to use charset to map CID to GID.

Bug 41548
2011-10-09 14:58:13 +10:30
Uli Schlachter
5f3fd8c09c xlib: Fix compilation with --disable-xlib-xrender
The boilerplate code tries to set PolyModePrecise on the xlib device. However,
because xrender is disabled, cairo-xlib-xrender.h wasn't included and didn't
include the needed xrender headers for this define.

This define is copied from cairo-xlib-xrender-private.h

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-08 10:48:26 +02:00
Uli Schlachter
960ae5ab2e Make the new mime-surface-api succeed
When removing mime data, _cairo_user_data_array_set_data () is called with a
NULL argument. This leaves behind an entry with key == NULL in the user data
array. Skip those entries instead of dereferencing NULL.

(The NULL entry in the array let's us avoid moving data around and/or doing a
memory allocation later, so I guess it might be a good idea to keep that)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-04 21:00:23 +02:00
Uli Schlachter
38ce0850b8 test: Add mime-surface-api
This test checks if setting and unsetting mime data works correctly. E.g. this
verifies that we get the same pointer back which we passed in (=no copy made).

This test currently crashes in its last call to cairo_surface_get_mime_data().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-04 21:00:23 +02:00
Andrea Canciani
8664df767c quartz: Fix the 32-bits build on MacOSX 10.7
FMGetATSFontRefFromFont() is not public on Lion nor on 64-bits
Frameworks, but it seems to be available in the dynamic libs, hence we
can dlsym() it just like other private functions.

Works around the error:
cairo-quartz-font.c: In function 'cairo_quartz_font_face_create_for_atsu_font_id':
cairo-quartz-font.c:830: error: implicit declaration of function 'FMGetATSFontRefFromFont'

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=39493
2011-10-01 09:24:08 -07:00
Chris Wilson
80fff70e6c test: Add clip-rectilinear
Exercise the clipping code with a rectilinear path (rather than a set of
boxes as per usual).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-30 16:31:06 +01:00
Chris Wilson
538fa0d6fb fill: Fix unantialiased rectilinear-fill-to-boxes
We were calling the antialias close function from the unantialiased
paths - a function that operates on a completely different structure to
the one passed in.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-30 15:58:14 +01:00