Commit graph

9282 commits

Author SHA1 Message Date
Andrea Canciani
058227004e Remove unused function declarations
These functions have no implementation and are never called.
2011-03-19 15:27:29 +01:00
Andrea Canciani
ab8c108b88 Do not warn when ignoring the return value of _cairo_rectangle_intersect()
gcc complains that

cairo-surface-wrapper.c:647: warning: ignoring return value of
‘_cairo_rectangle_intersect’, declared with attribute warn_unused_result

It can be silenced by making _cairo_rectangle_intersect()
cairo_private_no_warn. This makes it possible to avoid unused
temporary variables in other places and reduces the dead assignments
reported by clang static analyzer from 114 to 98.
2011-03-19 12:24:14 +01:00
Andrea Canciani
628ef17aca image: Silence gcc warning
gcc does not know thta num_glyph is guaranteed to be strictly
positive, so it complains that:

cairo-image-surface.c:3787: warning: ‘status’ may be used uninitialized in this function
2011-03-18 17:54:54 +01:00
Andrea Canciani
e0444a458a image: Silence missing enum value warning
cairo-image-surface.c:101: warning: enumeration value ‘PIXMAN_x14r6g6b6’ not handled in switch
2011-03-18 17:54:54 +01:00
Andrea Canciani
ad458d816a trace: Always emit a function name for write-to-png-stream
By emitting an empty function name when it it impossible to perform
the lookup, we can get rid of the warning:

trace.c:3714: warning: unused variable ‘symbol’

Additionally, this makes the syntax (or, rather, the parameter count)
for write-to-png-stream the same on every configuration.
2011-03-18 17:54:54 +01:00
Andrea Canciani
f2eb3f2178 Improve cairo_rectangle_list_t error handling
Unify the _cairo_rectangle_list_create_in_error() functions, keeping
the best features from both (the one in cairo-clip.c statically
allocates the most common cases, the one in cairo.c throws a NO_MEMORY
error when it cannot malloc() instead of rethrowing the same error).

The same function can be used to return an error-list in
_cairo_gstate_copy_clip_rectangle_list() when _cairo_clip_rectangle()
fails (for example becaouse of an OOM).
2011-03-18 17:54:54 +01:00
Behdad Esfahbod
7db5e3fdc8 Don't cache _CAIRO_ENABLE results
Caching is fragile sinle the enable commands cannot have any side-effects
when caching.  And doesn't have significant speedup at this level.  Just
remove it.
2011-03-18 13:13:18 -03:00
Chris Wilson
df1dd83880 trace: Fix hint_style/hint_metrics typo
Compiler warning saves the day!

trace.c: In function ‘_emit_font_options’:
trace.c:2973:20: warning: comparison between ‘cairo_hint_style_t’ and
‘enum _cairo_hint_metrics’

A genuine bug, thanks gcc!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-03-18 13:23:26 +00:00
Andrea Canciani
8a4299bf7e quartz-font: Remove unused variables
x_scale and y_scale are computed but never used.
2011-03-18 11:46:15 +01:00
Andrea Canciani
fd1fca8010 Make cairo_set_font_size() a wrapper of cairo_set_font_matrix()
cairo_set_font_size() should be equivalent to setting the font matrix
to an appropriate scale matrix.

Implementing it this way saves some code and makes sure that the same
code path is used whenever the font matrix is changed.
2011-03-18 11:43:42 +01:00
Andrea Canciani
f99358acf7 script: Fix stroking of 3 sided boxes
3-sided boxes can be replaced with rectangles when clipping and
filling, but not when stroking. _emit_path() is used for all of these
operations, so it cannot perform the optimization except for 4-sided
boxes.

Fixes stroke-open-box.
2011-03-18 10:50:23 +01:00
Andrea Canciani
c0fe556515 path: Fix _cairo_path_fixed_is_rectangle()
__cairo_path_fixed_is_rectangle() is used by the PS and PDF backends
to check if a path is equivalent to a rectangle when stroking. This is
different from being a rectangle when filling, because of the implicit
close_path appended to every subpath when filling.

Fixes stroke-open-box.

See https://bugs.freedesktop.org/show_bug.cgi?id=34560
2011-03-18 10:30:25 +01:00
Andrea Canciani
4369255961 test: Add stroke-open-box
Add a new test to check that the stroking of a 3-sided box is not
"optimized" to a 4-sided box.

Test case based on the code by Simon Kellner in
https://bugs.freedesktop.org/show_bug.cgi?id=34560
2011-03-18 10:30:25 +01:00
Andrea Canciani
6521bab6e8 xcb,xlib: Fallback upon generic radial gradients
The RENDER specification requires radial gradients to have the first
circle completely inside the second one, but the error is not actually
generated.

The implementation produces the expected results if either circle
contains the other one, so only fall back in these cases.
2011-03-18 09:48:56 +01:00
Andrea Canciani
426fe6fadf xcb,xlib: Fix 1-stop gradients
The RENDER specification does not specify the constraints on the
gradient stops, but its implementation returns an error if less than 2
stops are used.

Xlib and XCB can work around this because gradients with just one stop
are by-definition the same as gradients with that stop repeated twice.

Fixes radial-gradient-one-stop.
2011-03-18 09:48:56 +01:00
Andrea Canciani
c42d7f7acf quartz: Fix y glyph advance
The advances must be transformed by the "quartz inverse scale",
i.e. (scale_inverse * scale(1,-1)).

Fixes show-glyph-advance.
2011-03-18 09:41:55 +01:00
Andrea Canciani
db04ab8f63 test: Add show-glyphs-advance
This new test (based on show-glyphs-many) checks that the glyphs
advances are respected along both axes.

9c0d761bfc introduced a bug which
regresses this test in quartz.

Thanks to Jeff Muizelaar for the report!
2011-03-18 09:41:55 +01:00
Andrea Canciani
0ce4face45 test: Use ARRAY_LENGTH() macro
Some tests hand-code ARRAY_LENGTH(). It is now provided by
cairo-test.h, so it can be reused.
2011-03-17 17:45:57 +01:00
Andrea Canciani
75fea162d9 test: Cleanup macros
The ARRAY_LENGTH macro is used by many tests, although sometimes it is
named ARRAY_SIZE. Define it just once in cairo-test.h and reuse it.

In a similar way, MAX() and MIN() are currently defined in some
specific tests, while they could be reused.
2011-03-17 17:45:57 +01:00
Andrea Canciani
4ef32a36ba test: Silence gcc warnings
warning: cannot optimize possibly infinite loops

gcc does not detect that the "infinite" loops are actually just one or
two iterations, depending on the has_similar value being FALSE or
TRUE. It realizes it if the iteration variable and the iteration stop
value are both enum values.
2011-03-17 17:35:28 +01:00
Andrea Canciani
d6efb2a0b7 test: Silence gcc warning
cairo-test-runner.c:180: warning: unused variable ‘buf’
2011-03-17 17:04:42 +01:00
Andrea Canciani
2b84d82bcf test: Silence gcc
api-special-cases.c:94:1: warning: "Cursor" redefined
api-special-cases.c:81:1: warning: this is the location of the previous definition
2011-03-17 16:47:44 +01:00
Andrea Canciani
e45077612d test: Fix missing REFERENCE_IMAGES 2011-03-17 16:47:33 +01:00
Uli Schlachter
ed78510154 xcb-drm: Fix undeclared variable error
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-16 16:01:35 +01:00
Chris Wilson
02b2e3c93f xcb: Compile fix when using xcb-drm
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31368
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-03-16 15:56:10 +01:00
Uli Schlachter
f6e6891b59 xcb: Never return NULL from create_similar
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-15 19:41:41 +01:00
Chris Wilson
59fec48cd6 configure: Test for funlockfile
cairo-trace already depended upon HAVE_FUNLOCKFILE for its
thread-safety.

[This is a candidate for 1.10.]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-03-15 13:22:52 +00:00
Adrian Johnson
f2f65684f0 cff: Fix heap corruption
caused by holding a pointer into a cairo_array after a realloc

https://bugs.freedesktop.org/show_bug.cgi?id=35161
2011-03-13 21:16:14 +10:30
Uli Schlachter
f1d313e042 xcb: Remove _cairo_xcb_picture_copy
All cairo_xcb_picture_t now get their own, private Picture instead of possibly
sharing it with a cairo_xcb_surface_t.

This solves a cyclic dependency which caused cairo_xcb_picture_t to be leaked
until their device was finished.

When an xcb surface was used as a source, a cairo_xcb_picture_t was created
which kept a reference to the surface. This picture was then added as a snapshot
to the surface which caused the surface to own a reference to the picture.

As a result, the Picture and possibly its associated Pixmap were not freed on
the X11 server which could thus run out of memory.

This change causes more Pictures to be created which could possibly slow down
cairo-xcb. There seems to be no measurable difference with cairo-perf-trace. For
the micro benchmarks, this has the most impact on paint_similar-rgba_source.512:

       min(ticks)  min(ms) median(ms) stddev. iterations overhead
before     158732    0.159    0.159  0.11%   4: 1651.49
after      162579    0.163    0.163  0.18%   4: 1612.41

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=34912

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-04 16:37:13 +01:00
Uli Schlachter
f934491125 xcb boilerplate: Handle device offsets correctly
When running cairo-test-suite with "-a", backends are also tested with a
non-zero device offset. However, for "xcb-window&" the boilerplate incorrectly
overwrote the device offset with a zero offset again.

This caused all test results to be offset by 25 pixels which obviously makes all
tests fail.

Just removing the call to cairo_surface_set_device_offset solves the problem.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-04 16:37:13 +01:00
Jeff Muizelaar
de2c5bfa19 Add an implementation of fmax for use with MSVC 2011-03-03 16:34:43 -05:00
Jeff Muizelaar
aca492eb3f Add UINT32_MAX define.
This is needed for building with MSCV
2011-03-03 16:31:03 -05:00
Chris Wilson
9669b300a0 surface: Don't pass INT_UNSUPPORTED to _cairo_surface_set_error
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-03-02 18:31:28 +00:00
Uli Schlachter
c0dc933efd xcb: Remove CAIRO_XCB_RENDER_HAS_COMPOSITE_SPANS
This flag was only ever tested, but never set. Also, there is no X11 server out
there which actually supports this.

AFAIK it was just an experiment which turned into dead code.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-28 15:54:02 +01:00
Uli Schlachter
6cd96f966f xcb: Fix for PDF operators with RENDER 0.11
RENDER 0.11 added PDF operators and the cairo-xcb backend is already prepared
for handling them. However, it doesn't actually handle them.

If you used such an operator with RENDER 0.11, _operator_is_supported() would
return TRUE, but later on an ASSERT_NOT_REACHED in _render_operator() is hit.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-28 15:45:14 +01:00
Uli Schlachter
da9d6db115 xcb: Remove some unused code
All of these defines where not used anymore and this '#if 0'd code was so for
ages and most likely would stay commented out for more ages, too.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-28 15:42:57 +01:00
Eric Anholt
17169a1e51 gl: Bind samplers just once at program compile time.
We never bound any other value to the sampler uniforms, so why bother
resetting them all the time?

[  0]   before      firefox-talos-gfx   29.972   30.493   0.89%    3/3
[  0]   after       firefox-talos-gfx   29.397   29.599   1.27%    3/3

Signed-off-by: Eric Anholt <eric@anholt.net>
2011-02-26 14:09:54 -08:00
Eric Anholt
2fae22a3f2 gl: Take advantage of GLX_MESA_multithread_makecurrent to avoid unbinding.
Because of GLX's unfortunate requirement that only one context have a
thread current at a time, we had to unbind the context, triggering a
flush, and eating of all the CPU.  With a small tweak to the GLX spec
by GLX_MESA_multithread_makecurrent, and a small tweak to Mesa that
consisted mostly of deleting the "is this thread already bound
elsewhere?" check, we can bind our context to any thread and use it
safely as long as our usage of it is mutexed, which cairo-gl should
already be doing.

[  0] before      firefox-talos-gfx   50.260   50.525   0.25%    3/3
[  0] after       firefox-talos-gfx   32.091   32.422   0.65%    3/3
2011-02-26 14:09:33 -08:00
Eric Anholt
2e67809be0 gl: Add a first bit of general documentation on cairo-gl usage.
Since its inception, cairo-gl has been plagued by the "how am I really
supposed to use it?" problem.  This lays down my expectations for how
cairo-gl will interact with other usage of the GL API.
2011-02-21 14:12:47 -08:00
Behdad Esfahbod
90e1ef2d80 Bug 34011 - headers-standalone target is incorrect for some non-gcc compilers 2011-02-20 18:16:10 -05:00
Andrea Canciani
47f70537b8 image: Fix surface acquisition if PIXMAN_HAS_ATOMIC_OPS
If PIXMAN_HAS_ATOMIC_OPS, ix and iy will be changed if the source
surface is of subsurface type. They need to be reset to 0 before being
passed to _cairo_matrix_to_pixman_matrix_offset() or the acquired
surface will have an incorrect offset .
2011-02-19 19:26:20 +01:00
M Joonas Pihlaja
71e8a4c230 image: Avoid reusing pixman images for threadsafety.
The pixman_image_ref() and pixman_image_unref() functions
aren't threadsafe in current pixman, so we can't share
pixman images across contexts where they may end up
moving between threads.  The main use of these functions
is in keeping a global cache of pixman_image_ts for
solid colours and reusing the same pixman_image_t for
patterns pointing to the same image data where possible.

This patch removes those uses from cairo by wrapping
them in a PIXMAN_HAS_ATOMIC_OPS conditional.  There is
no automatic test this, so we will have to manually
turn this code back on when pixman does gain atomic
ops.

The only two remaining calls to pixman_image_ref() are
done on locally created images so they are safe.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=34177
2011-02-19 18:01:27 +02:00
Benjamin Otte
48774c09d0 test: Fix gcc signedness warning 2011-02-19 12:08:17 +01:00
Benjamin Otte
94612bc032 arc: Remove erroneous return statement
Introduced in e46dc9e17a.
2011-02-19 10:40:01 +01:00
Benjamin Otte
9fc5ff797a test: Fix copy/paste error 2011-02-19 10:32:19 +01:00
Benjamin Otte
f847b3c216 test: Fix gcc complaints about old style definitions 2011-02-19 10:25:22 +01:00
Benjamin Otte
7386960d06 test: Add a test for 0-radius negative arcs
This test checks the behavior of
e46dc9e17a
2011-02-19 10:23:46 +01:00
Benjamin Otte
b2bda24e42 Declare variables first so gcc shuts up 2011-02-19 10:22:45 +01:00
Benjamin Otte
0fc65a1008 Revert accidental checkin in last commit
Today is not my day...
2011-02-18 19:57:22 +01:00
Benjamin Otte
e46dc9e17a arc: Handle radius == 0 the same no matter the arc direction
Commit a0ea0b63fd fixed cairo_arc() but
did not apply the same patch to cairo_arc_negative(). This patch fixes
that oversight.
2011-02-18 19:51:44 +01:00