In commit f46ba56d5b the static context
stash was replaced by a dynamic freed pool, which needs to be cleared
upon resets.
Fixes:
cairo.c:181: warning: ‘context_pool’ defined but not used
Reported-by: Uli Schlachter <psychon@znc.in>
Conditional compilation was needed to avoid warnings:
cairo-clip.c:51: warning: ‘clip_path_pool’ defined but not used
cairo.c:181: warning: ‘context_pool’ defined but not used
They can be avoided by making sure that _freed_pool_reset(ptr)
actually consumes its argument. This has the pleasant side-effect that
forgetting to properly reset a freed-pool now results in a warning if
atomic ops are disabled/not available.
Xlib boilerplate includes cairo-xlib-surface-private.h, so that it can cast the
xlib cairo_surface_t to cairo_xlib_surface_t and then mess with some internals
of that struct.
However, xlib-xcb doesn't use that struct and thus this results in random memory
corruption. "Luckily", all the fields that this messes with don't corrupt any
fields in cairo_xlib_xcb_surface_t, but instead this writes past the end of the
buffer that was returned from malloc.
This commit just adds an #if to disable this code section since I have no idea
what a proper fix would be. This means that the xlib-fallback backend doesn't
actually test any fallbacks with xlib-xcb, however it never did so anyway.
If you have any idea how to fix xlib-fallback with xlib-xcb, please speak up.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Instead, this now uses the surface wrapper functions for this job.
These functions make sure that e.g. snapshots are detached and that is_clear is
reset correctly.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Also, this now sets surface->xcb to NULL after the dereference. Segfaults are
way more prominent anyway. :-)
All the backend callbacks shouldn't need any checks since the public entry point
already checks for finished surfaces. Only the public functions in xlib-xcb need
to do checks for finished surfaces.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Since commit f1d313e0, the 'force' argument to _copy_to_picture() isn't used
anymore. Said commit should have removed it. Whoops.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This function called directly into the xcb's surface flush function. This means
that snapshots for that surface weren't detached since that's normally done in
cairo_surface_flush() before calling into the backend.
Fix this by using surface_flush() instead of calling into the backend directly.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=31931
Signed-off-by: Uli Schlachter <psychon@znc.in>
If the X11 server doesn't have the RENDER extension, the xcb backend falls back
to the image backend in some cases (e.g. create_similar). xlib-xcb didn't handle
this properly which means it used the result like a xcb surface.
Found while debugging https://bugs.freedesktop.org/show_bug.cgi?id=31931,
firefox died from a BadDrawable error when it tried to use the (bogous) result
from cairo_xlib_surface_get_drawable().
Signed-off-by: Uli Schlachter <psychon@znc.in>
The functions cairo_xlib_surface_set_size and cairo_xlib_surface_set_drawable
didn't set the expected error when called with a finished surface.
Signed-off-by: Uli Schlachter <psychon@znc.in>
There are debug functions for setting the precision on a xlib device, so
xlib-xcb must redirect that to the xcb backend, too. However this means that
these public functions now are also called internally, thus we have to make them
go through the slim_hidden_* macros.
This commit fixes the following error from "make check":
Checking .libs/libcairo.so for local PLT entries
00000000002bb6d8 000001e300000007 R_X86_64_JUMP_SLOT 000000000006d8a0 cairo_xcb_device_debug_set_precision + 0
00000000002bb750 0000025e00000007 R_X86_64_JUMP_SLOT 000000000006d8b0 cairo_xcb_device_debug_get_precision + 0
FAIL: check-plt.sh
Signed-off-by: Uli Schlachter <psychon@znc.in>
In order to defer the pixel conversion till as late in the pipeline as
possible, we want to try and preserve the pixman image format whilst
uploading the pixel data. To do this, we want to create an XRender
surface with a matching PictFormat to the source image. Then we need to
make sure we take the quick path through _draw_image_surface for none
and direct conversions.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reuse the freed-pool system to reduce allocation pressure of context
creation/destruction.
As a side effect, this removes the use of ffs() on Win32, cleaning up
some MSVC-specific code and fixing a mingw-related build issue.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=30277
ce3806510f changed the format of
Makefile.refs, breaking the check-ref-missing target.
Ignoring any line not containing a .png file fixes check-ref-missing
and makes it more robust.
Generates the lexicographical Makefile.refs based on the *.ref.png and
*.xfail.png checked into git.
This might be nice to automate as a Makefile target. But for now play
safe and do the updates manually.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
The test-antialias-* tests perform the same operation with just a
different antialias flag. Sharing the code ensures that they are kept
in sync and permits adding new flags combinations easily.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=14268
The old code considered every even "word" as a key and every odd
"word" as a value when parsing a test log file.
All of the keys end with ':', so restrict with this requirement.
The extents of the boxes were being computed by taking into account
just the first box instead of all of them.
Based on a patch by James Cloos.
Fixes clip-disjoint, clip-stroke-unbounded, clip-fill-nz-unbounded,
clip-fill-eo-unbounded, clip-fill, clip-stroke, trap-clip.
See https://bugs.freedesktop.org/show_bug.cgi?id=38641
Reviewed-by: James Cloos <cloos@jhcloos.com>
Tested-by: James Cloos <cloos@jhcloos.com>
On linux it is impossible to check the missing references because of
argument length constraints:
make: execvp: /bin/bash: Argument list too long
Using a temporary file instead of variable expansion makes it possible
to work around this.
Makefile.refs is now required to be in lexicographical order, which
avoids ordering problems and the risk of duplicated entries (like
clipped-surface.ref.png).
In 63bdae27a8, new fields were added to cairo_xcb_connection_t and
cairo_xcb_surface_t. The same change was done in the xlib backend.
However, in the xlib backend these new fields were properly initialized. This
was forgotten in the xcb backend.
Hopefully-Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=38482
Signed-off-by: Uli Schlachter <psychon@znc.in>
This adds checks for negative sizes in cairo_surface_create_similar() and for
non-positive sizes in all public surface-creation functions in the xcb and xlib
backends.
X11 doesn't allow 0 as width/height, so if anyone claims to have a drawable of
that size, he can't be right. However, cairo allows such sizes which is why
create_similar doesn't reject 0.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The performance tools build system for Win32 hasn't been maintained
for some time. The makefiles are now structured as in other
directories (Makefile.sources used by both Makefile.am and
Makefile.win32) and some additional code hides os-specific parts.
Restructure the Makefiles in .sources, .am and .win32 to enable
building cairo-script-interpreter on Win32.
Some minor changes are needed to compile on MSVC:
- include stdint.h to define INT_MAX-like macros
- redefine "inline"
- avoid deprecated functions (snprintf, replaced by _snprintf)
- define _USE_MATH_DEFINES so that math.h defines M_PI, M_SQRT2 and
M_LN2
cairo-perf-trace uses cairo-hash.c, which calls _cairo_error.
Instead of redefining it in cairo-perf-trace.c it can be abstracted in
a separate source which is directly included in the build of
cairo-perf-trace.
This avoids visibility issues when compiling cairo-perf-trace with a
statically linked cairo library on architectures which do not support
hidden visibility (example: win32).
The window description flag macros are prefixed with DWDESC_.
The issue was not noticed because DWDESC_CAPS and DSDESC_CAPS have the
same value.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=37049
Test targets now explicitly depend on the cairo library and build it
appropriately.
Phony targets depend on inform, so that they print a warning if the
environment is not set up appropriately.
All of the build depends on cairo-features.h. By having a target to
generate it that can be run from anywhere, it is possible to delegate
the dependency handling to 'make'.
The hashtable is guaranteed to only contain font faces which are
currently referenced, hence there is no need to remove any font face
when it is reset (just like for toy-font).
This makes the function simpler and fixes the assertion
Assertion failed: predicate != NULL, file cairo-hash.c, line 373
hit by multiple tests (the first one being "clear").
See https://bugs.freedesktop.org/show_bug.cgi?id=38049
If the hashtable cointains a font matching the font being created,
only reuse it if it is not in an error status. Otherwise, remove it
from teh hashtable and create a new one.
On Win32 INT_MIN/MAX macros are defined in stdint.h, which makes MSVC
complain about the following redefinitions:
...\stdint.h(73) : warning C4005: 'INT16_MIN' : macro redefinition
...\boilerplate\cairo-boilerplate.h(64) : see previous definition of 'INT16_MIN'
...\stdint.h(77) : warning C4005: 'INT16_MAX' : macro redefinition
...\cairo-boilerplate.h(67) : see previous definition of 'INT16_MAX'
...\stdint.h(80) : warning C4005: 'UINT16_MAX' : macro redefinition
...\boilerplate\cairo-boilerplate.h(70) : see previous definition of 'UINT16_MAX'
Since 03be41151d, it is safe to use
cairo_font_face_reference () to increment the reference count of a
font taken from the hashtable, because no mutex is being locked twice.
Since 92d7b1eee9 the flush vfunction
should return a cairo_status_t.
Silences the warning:
cairo-script-surface.c: At top level:
cairo-script-surface.c:3528:5: warning: initialization from
incompatible pointer type [enabled by default]
cairo-script-surface.c:3528:5: warning: (near initialization for
'_cairo_script_device_backend.flush') [enabled by default]
63bdae27a8 introduced a new public API
cairo_xlib_device_debug_set_precision(), exported by cairo-xlib.
cairo-xlib-xcb must implement it as well, because it must provide the
same public API.
Fixes the compilation of cairo-sphinx with --enable-tee
--enable-xlib-xcb --enable-script.
Reported-by: James Cloos <cloos@jhcloos.com>