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>
45665c0d48 breaks the build of
cairo-xlib-xcb because it does not disable the compilation of
cairo-xlib implementation files when cairo-xlib-xcb is enable. This
results in collisions when linking.
Reported-by: James Cloos <cloos@jhcloos.com>
The assumption that no font face will hash to 0 is not correct.
Moreover, no special value is needed to mark fonts in error status, as
they can simply be detected upon lookup and destruction.
Silence the warning:
cairo-path-stroke.c: In function '_cairo_stroker_add_caps':
cairo-path-stroke.c:861:29: warning: comparison between
'cairo_line_cap_t' and 'enum _cairo_line_join' [-Wenum-compare]
CAIRO_LINE_JOIN_ROUND and CAIRO_LINE_CAP_ROUND have the same value,
hence this defect went unnoticed so far.
Winding of a box is toggled by swapping x1, x2 coordinates. So
we have to swap those coordinate rather than just copying.
Many routines assume that boxes are left-top to right-bottom
convention. So tessellator should produce such output boxes.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
On Win32, the POSIX-compatible unlink function is named "_unlink".
A function named "unlink" exists, but does not have the same behavior
as the POSIX-specified one. This function makes the cairo test suite
behave incorrectly and immediately terminate with the message:
Error: Cannot remove cairo-test-suite.log: No error
The Microsoft C Compiler does not accept empty-initialized arrays:
cairo-boilerplate-win32-printing.c(373) : error C2059: syntax error : '}'
cairo-boilerplate-win32-printing.c(374) : warning C4034: sizeof returns 0
51bd27afa1 removed
make-cairo-test-constructors.c but did not update the win32 Makefiles
accordingly.
cairo-test-constructors.c is now generated by a make target which runs
make-cairo-test-constructors.sh.
cairo-boilerplate-constructors.c is one of the sources required to
build the boilerplate.
This file is generated by a script, invoked by the appropriate make
target during the build.
make on win32 complains that:
make[1]: Entering directory `/home/ranma42/Code/fdo/cairo/src'
../src/Makefile.sources:220: *** missing separator. Stop.
Makefile.sources should not contain if's, which are aoutomake-only
conditionals. The correct way to conditionally include files is to
enable/disable them using C preprocessor macros.
We can't use an X11 surface in create_similar if the specified coordinates are
too small/large. However, we can still use SHM-backed memory for the image
surface which will be used instead.
Thanks to Chris Wilson for the hint.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The PDF blend operators, as offered by cairo, where added in RENDER 0.11. This
commit makes the XCB backend use them, if they are available.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This reverts commit f6e6891b59.
Returning NULL in these cases is actually the right thing to do, because the
caller expects and handles this case.
cairo_surface_create_similar() won't return NULL due to this, because
_cairo_surface_create_similar_solid() will fall back to an image surface.
I think I missed that part when I wrote the bad commit.
This was found via the test suite's "zero-mask" test.
Signed-off-by: Uli Schlachter <psychon@znc.in>
_pixel_to_solid() used to assert that it got a known cairo_format_t.
However, this might not be the case when backends decide to use a pixman
format that is not representable by a cairo format (X and DirectFB are
examples for backends that do that).
This patch makes _pixel_to_solid() return NULL in that case and fixes
the callers to deal with it.
https://bugs.freedesktop.org/show_bug.cgi?id=37916
We cannot assume that parameter 'out' is empty. So we should make it
empty before returning CAIRO_STATUS_SUCCESS when 'in' contains no boxes.
When 'in' contains a single box, we should copy 'in' to 'out' rather
than just returning CAIRO_STATUS_SUCCESS.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
A deficiency of cairo-perf-trace is that it currently always uses similar
surfaces for new surface which are kindly cleared by Cairo. This does
not accurately reflect the captured trace and introduces large bandwidth
overheads that distort the profiles.
So we introduce a new boilerplate hook so that the targets can create a
surface without incurring additional overheads.
[Fixes the broken partial commit of bf1b08d066e.]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
As we write, use and then immediately discard the vertex buffers, our
usage pattern more closely matches DYNAMIC (as opposed to STREAM). This
improve performance by about 10% on intel.
firefox-talos-gfx(snb) 20.226 -> 18.402
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Benjamin just demonstrated this funky trick for generating pixel
outlines, and as no good deed should go unpunished, I've added his code
to the perf suite.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Introduce cairo_xlib_device_debug_set_precision() to override the
automatic selection of rendering precision and force the Xorg/DDX to
strictly adhere to the precise rendering mode of the Render
specification. This allows us to test drivers without worrying, too
much, about minor discrepancies in antialiasing.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
In strictly conforming EGL implementations, eglGetProcAddress() can be used
only to get extension functions, but some of the functions we want belong to
core GL(ES). If the *GetProcAddress function provided by the context fails,
try to get the address of the wanted GL function using standard system
facilities (eg dlsym() in *nix systems).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
According to the GLSL ES standard, the precision of variables in the fragment
shader should be explicitly defined (although mesa's compiler is not that
strict).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
The glReadBuffer/glDrawBuffer functions are not present in GLES2, only
a single buffer is supported.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
The default support for GLES2 NPOT textures is very limited. We need the
additional features provided by the GL_OES_texture_npot extension.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
The previous used value, GL_MAX_TEXTURE_UNITS, is only appropriate for the
fixed pipeline. It is replaced with GL_MAX_TEXTURE_IMAGE_UNITS that refers to
the number of texture units available in the fragment shader.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Work around GLES2 limitations in texture pixel formats and options for
pixel packing/unpacking.
Depending on the endianness and the image pixel format, we may need to
manually swap the elements in a pixel group. This is not currently
implemented, but for little-endian architectures the common pixman BGRA
formats don't need a swap.
Due to GL_UNPACK_ROW_LENGTH missing in GLES2 we have to extract the image
data ourselves in some cases, so we can provide it to glTexSubImage2D
using a layout it can understand. We must extract the pixels if:
a. we don't want full-length lines or
b. the row stride cannot be handled by GL itself using a 4 byte
alignment constraint
We use GL_PACK_ALIGNMENT 4 by default because that is the default pixman
alignment value and in some cases it allows us to avoid the manual pixel
extraction. However, when we extract image data manually we use an alignment
of 1.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
GLES2 doesn't support Pixel Buffer Objects. Use conventional texture upload
for GLES2 (using client-side memory).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
1D textures are not available in GLES2. We use 2D textures with height 1
instead, which are equivalent to 1D textures and exist across all GL flavors.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
The GL_CLAMP_TO_BORDER wrapping method (used with CAIRO_EXTEND_NONE) is not
available in GLES2. We use shaders to implement similar functionality for
GLES2.
If bilinear filtering is used, the shader performs a linear fade to
transparency effect in the texel coordinate intervals [-1/2n, 1/2n]
and [1 - 1/2n, 1 + 1/2n] (n: texture size).
If nearest filtering is used, the shader ensures that a clear color is
used for all texel coordinate values outside [0, 1).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>