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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
If the stroke is too large, the strokes around the box overlap and we
fail to generate the canonical form of the boxes. So if we detect that
the boxes overlap, feed them through the tessellator to reduce them to
canonical form.
Fixes line-width-overlap.
Based on a patch by Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Exercise the case of stroking a box with a pen wider than the box
itself, a variation on line-width-overlap suggested by Paulo Zanoni.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Rather than having the reference images individually listed in
test/Makefile.refs the whole directory can be included in the EXTRA_DIST
block.
This removes the need to have the check-ref-missing Makefile target.
The recording surface has no knowledge of the target surface when it
generates the scaled font and informs the client about the kerning and
metrics. This results in an unfortunate slight misalignment when
replaying the glyphs against the ideal case.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>