Make sure that we always detach the ShmSegments upon dispose, or else we
can trivially leak lots of memory when using serial Display connections.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
If we try to use a non-existent path, FT_New_Face returns an error.
Instead, just use fontconfig to generate a fallback pattern.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
As we access a global error variable, we need to hold a mutex against
simultaneous checking of multiple Displays. This should already be true
as we hold our display mutex to serialize initialisation, so just add an
assertion. As the client may mix use of cairo in one thread with X from
another, we need to hold the Display lock and serialise whilst
manipulating the low-level state of the Display.
Suggested-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reduce the number of copies required for uploading large image data.
Ultimately we want the client to allocate the similar-image itself to
acheive zero copy, this is just an intermediate step for legacy clients.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
We want to avoid unnecessary readback and so only want to use the
ShmPixmap when uploading the complete surface.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Having extracted the code for use by the SHM allocator for xlib, remove
the now redundant copy from xcb.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
With optional compile time support for pixman glyphs, our hard pixman
requirement is then just 0.22.0 for the radial fixes (iirc).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
46d79228 did indeed silence the compilation warning, but did so by never
creating an ARGB32 format, as PictStandardARGB32 is defined to 0. Fix
this by using PictStandardNUM as our canary value instead.
This fixes GEdit and Chromium for me, both of which were only rendering
backgrounds and text in their GTK+ sections.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
As the easiest approach to making another snapshot that only depends
upon a stable pixman, make the new dependency a compile time option.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
In order to generate the correct left-hand border color, we need to
fudge the offsets of the color stops if multiple stops are defined at 0.
The reason is that pixman will generate our color ramp by using the
right-most color stop for the pixel centre, but in order to provide the
sample colour outside of the gradient we need pixel 0 to be have the
left-most color.
Reported by Henry Song.
If the gradient contains a step function, we need an infinitely sharp
texture to emulate the correct output. Failing that, lets just use as
large a texture as can be reasonably handled by the hardware
cairo-xlib-display.c: In function '_cairo_xlib_display_get_xrender_format':
cairo-xlib-display.c:519:21: warning: 'pict_format' may be used
uninitialized in this function [-Wmaybe-uninitialized]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
cairo-gl-glyphs.c: In function '_cairo_gl_composite_glyphs_with_clip':
cairo-gl-glyphs.c:442:9: warning: unused variable 'i' [-Wunused-variable]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Mesa changed the name of the extension it invented, so check for the
real name and the old name before falling back to pbuffers which are not
supported by most EGL implementations.
References: https://bugs.freedesktop.org/show_bug.cgi?id=53361
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
If the source and destination are on difference devices (GL contexts) we
can not simply texture from one to the other, and must either import the
source into the destination context (which has not yet been done) or
fallback through an image copy.
This patch is based on the work by Henry Song, but moving the check from
the common compositor layer down into the GL backend. This should have
the same effect...
Fixes gl-surface-source
Suggested-by: Henry Song <henry.song@samsung.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Recording surfaces should be replayed with the transform matrix used
in the pattern, otherwise the image surface will be transformed,
introducing artifacts.
Fixes record{1414x,2x}-paint-alpha-{,solid-clip,clip},
record2x-{self-intersecting,text-transform} and record90-paint-alpha.
_cairo_clip_intersect_clip_path_transformed() completely ignored the
transformation matrix instead of transforming all the clip paths with
it.
This caused bugs when replaying recording surfaces.
Fixes record{2x,1414x,90}-paint-alpha-clip-mask.
The xcb private header uses the ASSERT_NOT_REACHED macro.
This macro is defined in cairoint.h, which needs to be included.
Fixes:
CHECK cairo-xcb-private.h
In file included from headers-standalone-tmp.c:1:
./cairo-xcb-private.h: In function ‘_cairo_xcb_connection_shm_put_image’:
./cairo-xcb-private.h:636: error: ‘ASSERT_NOT_REACHED’ undeclared (first use in this function)
./cairo-xcb-private.h:636: error: (Each undeclared identifier is reported only once
./cairo-xcb-private.h:636: error: for each function it appears in.)
So check for the appropriate surface type at the start and return
UNSUPPORTED if we cannot handle it directly. We will then fallback to
pushing the image instead.
Together with the previous patch, fixes 8 fails in cairo-test-suite.
When the source surface type is gl-window, we should return unsupported
and then create a new texture surface for it. Based on the code of
Henry's tree.
In _cairo_gl_surface_map_to_image(), the image surface data has been
filled by glReadPixels, so is_clear flag should be set to FALSE.
Otherwise mapped image surface does not get drawn as it is presumed
clear and so returns true from nothing_to_do().
We must destroy glyph cache surface in device_finish instead of in
device_destroy because in device_destroy device status is
DEVICE_FINISHED and the operation is invalid.
A few test cases purposely create fractional surface sizes which can not
be natively supported by the raster backends such as GL. For these
backends we need to consistent in creating a surface that is large
enough to contain the test, so we need to use ceil() rather than
implicit truncation to integers.
A consequence of the misalignment between the Window size and the
surface size (where one was using ceil and the other not) is that the
first row of the cairo surface would not be visible on the output.
Based on a patch by Chuanbo Wen to fix 5 test cases, such as
group-unaligned.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>