Commit graph

9367 commits

Author SHA1 Message Date
Andrea Canciani
463a8b67a3 perf: Fix build on win32
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.
2011-06-24 14:13:09 +02:00
Andrea Canciani
33403cfb37 perf: Ensure M_SQRT2 is defined
pythagoras-tree uses M_SQRT2, which on Win32 is defined by math.h if
and only if _USE_MATH_DEFINES is defined.
2011-06-24 14:13:09 +02:00
Andrea Canciani
5291f7ccad script-interpreter: Build on win32
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
2011-06-24 14:13:09 +02:00
Andrea Canciani
3a5c8b2c74 test: Cleanup build on Win32
Put cairo-test-suite.exe in a $(CFG)-dependent folder and link to
libraries from $(top_builddir).
2011-06-24 11:57:28 +02:00
Andrea Canciani
f21ac5b13b error: Do not define _cairo_error twice
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).
2011-06-24 11:57:22 +02:00
Andrea Canciani
0740c8e4f3 Hide private symbols on MacOSX
gcc provides the hidden visibility attribute on Darwin, which can be
used to deny access to private cairo symbols.
2011-06-24 11:57:07 +02:00
Taekyun Kim
441f9c5037 Fix intersect_with_boxes() to produce tight clip extents
Previous code was intersecting extents with infinitely large rectangle.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-21 09:59:30 +01:00
Haithem Rahmani
8fb9a6727e boilerplate: Use correct flag type in DFBWindowDescription
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
2011-06-20 11:43:38 +02:00
Andrea Canciani
190d8d7290 build: Silence autoconf warnings
Autoconf 2.86 reports:

warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
2011-06-20 11:07:33 +02:00
Andrea Canciani
b6d593dc71 build: Clean up environment variables and flags for the win32 build
Avoid ovverriding LINK, as it has a special meaning for the MSVC build
tools.
2011-06-20 10:24:21 +02:00
Andrea Canciani
5534c30524 build: Use common rules for making pdiff
Instead of providing special rules for compiling C files in pdiff, use
the common ones and build a different pdiff for debug and release.
2011-06-20 10:24:21 +02:00
Andrea Canciani
f9b50cec2b build: Improve dependencies in win32 Makefiles
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.
2011-06-20 10:24:21 +02:00
Andrea Canciani
c7c3475cdb build: Improve generation of cairo-features.h on win32
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'.
2011-06-20 10:24:21 +02:00
Andrea Canciani
101fab7cd8 win32-font: Improve static data reset function
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
2011-06-20 10:24:21 +02:00
Andrea Canciani
94bc20da50 win32-font: Implement destroy function
Win32 font faces can be removed from the hashtable upon destruction.
Based on the toy-font destruction code.

See https://bugs.freedesktop.org/show_bug.cgi?id=38049
2011-06-20 10:24:20 +02:00
Andrea Canciani
94b14c929d win32-font: Do not return font in error status
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.
2011-06-20 10:24:20 +02:00
Andrea Canciani
b9d9ca281c Avoid deprecated functions on win32
Some POSIX functions are deprecated in MSVC and should instead be used
with an alternative name beginning with '_'.
2011-06-20 10:24:20 +02:00
Andrea Canciani
00a5a13612 boilerplate: Silence MSVC warnings
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'
2011-06-20 10:24:20 +02:00
Andrea Canciani
cbf11fa261 toy-font: Do not open-code cairo_font_face_reference ()
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.
2011-06-20 10:24:20 +02:00
Andrea Canciani
5a79e9f536 script: Return status when flushing device
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]
2011-06-20 09:44:49 +02:00
Andrea Canciani
ced061124d xlib-xcb: Implement cairo_xlib_device_debug_{g,s}et_precision
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>
2011-06-16 18:31:14 +02:00
Andrea Canciani
3a504282ef build: Don't build cairo-sphinx when the tee surface is off
cairo-sphinx depends on cairo-tee, which is not always enabled.

Reported-by: James Cloos <cloos@jhcloos.com>
2011-06-16 15:11:24 +02:00
Andrea Canciani
f409f74dec xlib: Fix build of xlib-xcb
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>
2011-06-16 15:11:24 +02:00
Andrea Canciani
a2cd83a986 toy-font-face: Do not assume hash != 0
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.
2011-06-16 12:17:33 +02:00
Andrea Canciani
a06668fabe path-stroke: Avoid mixing cap and join values
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.
2011-06-16 09:48:30 +02:00
Taekyun Kim
8e7589abcc tessellator: Fixed to produce an output box with x1 <= x2 for single box input
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>
2011-06-15 16:13:15 +01:00
Andrea Canciani
3b9c874489 test: Use POSIX-compatible unlink
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
2011-06-14 16:47:32 +02:00
Andrea Canciani
5cb18fcec7 test: Fix compilation on win32
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
2011-06-14 16:46:32 +02:00
Andrea Canciani
0cbe3d1020 test: Update generation of constructors on win32
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.
2011-06-14 16:46:32 +02:00
Andrea Canciani
510f0f391c boilerplate: Add generation of constructors on win32
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.
2011-06-14 16:46:32 +02:00
Andrea Canciani
45665c0d48 Remove if's from Makefile.sources
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.
2011-06-14 15:25:08 +02:00
Uli Schlachter
9d256b7db9 xcb: Fallback to image surface for create similar
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>
2011-06-12 15:42:01 +02:00
Uli Schlachter
fb0a40fc10 XCB: Implement PDF blend operators natively
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>
2011-06-11 21:32:29 +02:00
Uli Schlachter
ad01d571dd Revert "xcb: Never return NULL from create_similar"
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>
2011-06-11 20:18:27 +02:00
Dagobert Michelsen
753a4cdf30 Use detected EGREP instead of generic grep
https://bugs.freedesktop.org/show_bug.cgi?id=38069
2011-06-08 16:01:03 +02:00
Benjamin Otte
00de16b7ac image: Don't crash on weird pixman formats
_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
2011-06-08 16:01:03 +02:00
Murray Cumming
d0615633dc cairo: Remove trailing comma from cairo_format_t
Fixes warnings when building with C++.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36989
2011-06-08 12:02:28 +02:00
Taekyun Kim
6edc5ca55f tessellator: Fix boxes tessellator to handle num_boxes <= 1 correctly
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>
2011-06-08 09:59:42 +01:00
Chris Wilson
27d26bb8b5 cairo-perf-diff-files: Don't print size/content for trace results
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-06 15:09:50 +01:00
Chris Wilson
61fd10376f cairo-trace: Fix use of buf outside of scope
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37746
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-06 15:05:51 +01:00
Chris Wilson
d673b9547f boilerplate: Introduce create_similar hook
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>
2011-06-02 09:11:32 +01:00
Chris Wilson
72b6299c12 gl: Mark the use-once vertex buffers as DYNAMIC
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>
2011-06-02 08:57:19 +01:00
Chris Wilson
bf1b08d066 perf 2011-06-02 08:57:13 +01:00
Chris Wilson
52f79bfcf3 perf/micro: Add wave
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>
2011-06-01 19:17:06 +01:00
Chris Wilson
1b33552a6d test: Add unaligned-box
Test the handling of the various pixel-alignment boundary points of
rectangles.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-01 18:09:48 +01:00
Chris Wilson
9bdfae6e21 boilerplate/xcb: Fix silly cut'n'paste errors in previous commit
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-01 16:57:30 +01:00
Chris Wilson
63bdae27a8 xlib,xcb: Force strict adherence to the Render specification when testing
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>
2011-06-01 16:50:25 +01:00
Chris Wilson
e21b373c94 cairo-trace: Fix an obscure bug recording the fishtank
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-26 16:31:40 +01:00
Adrian Johnson
6936a2b417 PS: Use tight bounding box
Now that the page size is specified by %%DocumentMedia
we can make %%BoundingBox compliant.
2011-05-22 20:41:18 +09:30
Benjamin Otte
d11b39ea27 build: Use $GREP -e instead of plain grep -e
https://bugs.freedesktop.org/show_bug.cgi?id=37388
2011-05-20 20:59:13 +02:00