Commit graph

3796 commits

Author SHA1 Message Date
elaine
195112697f [xlib] The buggy_repeat path should be removed for Xsun now
Sun never released a version of Solaris with Xorg with the buggy repeat
problem.  This patch was only needed for development versions of Solaris
Nevada (roughly builds 25-30).  The latest S10U release and Nevada releases
have a fixed Xorg.  So no users should ever encounter this bug.

We need to remove this test because Xsun has the same VendorString and a lower
VendorRelease number so it falsely triggers buggy_repeat to be turned on.
They just added Xrender support recently to Xsun, so this wasn't an issue
before recently.
2007-05-10 13:58:44 -04:00
Chris Wilson
ab6a767cf4 [cairo-scaled-font] Check for allocation failure.
cairo_scaled_font_create() returns a nil object on failure whereas a few
callers were checking for NULL.

Secondly review the public entry points for cairo_scaled_font_*() to
ensure that all check that they will not attempt to overwrite the
read-only nil object.
2007-05-10 17:18:27 +01:00
Chris Wilson
aec92188f1 [cairo-clip] Correctly report allocation failure
Distinguish between the unrepresentable clip and the failure to allocate
the clip extents.
2007-05-10 09:30:14 +01:00
Chris Wilson
1a719d1189 [cairo] Use _cairo_clip_nil for CAIRO_STATUS_NO_MEMORY
When creating a error clip list for CAIRO_STATUS_NO_MEMORY, simply
reuse the nil object rather than allocate a fresh list.
2007-05-10 09:30:06 +01:00
Chris Wilson
3fbc4bb5ae [cairo-clip] Add missing error status for _cairo__clip_intersect_region()
An out-of-memory error path missed setting CAIRO_STATUS_NO_MEMORY.
2007-05-09 21:42:15 +01:00
Chris Wilson
b5d2506879 [cairo] cairo_pop_group() returns a NULL pattern
cairo_pop_group() checks for a NULL return from
cairo_pattern_create_for_surface() instead of the nil cairo_pattern_t,
and then returns a NULL pattern instead of the nil object.
2007-05-09 16:29:39 +01:00
Chris Wilson
6f09e93ad7 [ciro-surface-fallback] Propagate status for _clip_and_composite_trapezoids
The result of _clip_and_composite_trapezoids() was ignored by 2/3 of
its callers - simply propagate the status.
2007-05-09 16:29:04 +01:00
Chris Wilson
ae5d4a1c17 [cairo] Return after detecting the invalid font-options.
Do not continue to copy the contents of the nil cairo_font_options_t,
but set the error on the context and return.
2007-05-09 16:28:52 +01:00
Chris Wilson
dfd4d41ac9 [cairo-xlib-surface] Free the allocation if we fail to queue the work.
Avoid the leak of the allocated argument if we fail to queue the work to
free the glyph.
2007-05-09 12:56:49 +01:00
Chris Wilson
8ddfc1b2e4 [cairo-pattern] Return status from _cairo_pattern_init_copy()
During the copy, allocation of the gradient may fail and so the callers
need to check for a pattern that returned in an error state. No callers
did so and in order to force all callers to check the error status,
the status return was added to _cairo_pattern_init_copy().  The early
error checking may appear redundant for an object with an embedded
structure, however it does fix an error where an uninitialised pattern
was being used:

==1922== Process terminating with default action of signal 11 (SIGSEGV)
==1922==  Access not within mapped region at address 0x55555555
==1922==    at 0x402CF6F: _cairo_array_index (cairo-array.c:208)
==1922==    by 0x402D4F3: _cairo_user_data_array_fini (cairo-array.c:370)
==1922==    by 0x4046464: _cairo_pattern_fini (cairo-pattern.c:188)
==1922==    by 0x404992A: _cairo_meta_surface_paint (cairo-meta-surface.c:266)
==1922==    by 0x403FCE0: _cairo_surface_paint (cairo-surface.c:1331)
==1922==    by 0x405CB5E: _test_meta_surface_paint (test-meta-surface.c:195)
==1922==    by 0x403FCE0: _cairo_surface_paint (cairo-surface.c:1331)
==1922==    by 0x4032A60: _cairo_gstate_paint (cairo-gstate.c:822)
==1922==    by 0x402B2D1: cairo_paint (cairo.c:1879)
==1922==    by 0x804A4F7: draw (radial-gradient.c:73)
==1922==    by 0x804AFA4: cairo_test_expecting (cairo-test.c:326)
==1922==    by 0x804A57C: main (radial-gradient.c:109)
==1922== Injected fault at:
==1922==    at 0x4020EA5: malloc (vg_replace_malloc.c:207)
==1922==    by 0x404475C: _cairo_pattern_init_copy (cairo-pattern.c:136)
==1922==    by 0x403F779: _cairo_surface_copy_pattern_for_destination (cairo-surface.c:2153)
==1922==    by 0x403FCC1: _cairo_surface_paint (cairo-surface.c:1328)
==1922==    by 0x405CB5E: _test_meta_surface_paint (test-meta-surface.c:195)
==1922==    by 0x403FCE0: _cairo_surface_paint (cairo-surface.c:1331)
==1922==    by 0x4032A60: _cairo_gstate_paint (cairo-gstate.c:822)
==1922==    by 0x402B2D1: cairo_paint (cairo.c:1879)
==1922==    by 0x804A4F7: draw (radial-gradient.c:73)
==1922==    by 0x804AFA4: cairo_test_expecting (cairo-test.c:326)
==1922==    by 0x804A57C: main (radial-gradient.c:109)
2007-05-09 10:14:20 +01:00
Chris Wilson
dbdaf0690e [cairo-scaled-font] Check _cairo_scaled_glyph_loop() status
In _cairo_scaled_font_glyph_path() we forgot to check the status return
of _cairo_scaled_glyph_loop() - propagate any failures.
2007-05-09 09:23:57 +01:00
James Cloos
b744c27051 [cairo-directfb-surface] Fix typo from commit a8c8e17d
Fix typo in name of _cairo_directfb_surface_is_similar().
2007-05-09 09:03:21 +01:00
Chris Wilson
cbc9218cd3 [cairo-xcb-surface] Fix compilation
As spotted by James Cloos <cloos@jbcloos.com>, I broke the compilation...
This is a minimal fix with no claims of completeness.
2007-05-09 09:03:04 +01:00
Chris Wilson
069514a10f [test/in-fill-empty-trapezoid] Cleanup after test failure.
Ensure that the failure path also calls cairo_test_fini().
2007-05-08 22:04:51 +01:00
Chris Wilson
43645eb486 [test/fallback-resolution] Cleanup after test failure
Be valgrind clean even for test failures.
2007-05-08 22:04:41 +01:00
Chris Wilson
21c6643b09 [cairo-surface] Check for errors when generating the scaled font.
cairo_surface_show_glyphs() attempts to generate a device specific
scaled font and so needs to check for failure before attempting to use
it.
2007-05-08 22:00:54 +01:00
Chris Wilson
ede76a97ea [cairo-font-options] Check for the nil-object.
The design is for the user to create a cairo_font_options_t object with
cairo_font_options_create() and then is free to use it with any Cairo
operation. This requires us to check when we may be about to overwrite
the read-only nil object.
2007-05-08 22:00:46 +01:00
Chris Wilson
c441938569 [cairo-pattern] Cleanly handle an invalid pattern in cairo_pattern_transform()
Simply return without writing to potentially read-only members of an
invalid pattern rather than assert. This is cleaner than tracking down
all the error paths that may call into cairo_pattern_transform()...
2007-05-08 21:41:09 +01:00
Behdad Esfahbod
409f973429 [test] If a test target fails, end the test
otherwise cairo is left in a dirty state and further tests are
unreliable.
2007-05-08 14:18:42 -04:00
Chris Wilson
aad66d05fd [test/nil-surface] Destroy the auxiliary context on failure paths.
Just to be tidy, and aim to be valgrind-clean.
2007-05-08 16:48:47 +01:00
Chris Wilson
e3acacc096 [cairo-boilerplate-ps] Destroy the target on creation failure
Remember to destroy the ptc->target as well as the ordinary surface, if
we need to.
2007-05-08 16:48:34 +01:00
Chris Wilson
efd212bfa2 [cairo-boilerplate] Protect against the nil cairo_scaled_font_t
Beware the NULL pointer deference when trying to adjust the max glyph
cache size...
2007-05-08 16:48:21 +01:00
Chris Wilson
b85920684f [cairo-test] Destroy the check image on failure
If drawing the checker pattern should fail, we need to free the
resources allocated locally.
2007-05-08 16:47:40 +01:00
Chris Wilson
0bf3ffacda [test-fallback-surface] Destroy the backing image on malloc failure.
Ensure we free all local resource should we encounter an allocation
failure during _cairo_test_fallback_surface_create().
2007-05-08 16:47:29 +01:00
Chris Wilson
eac18d44c7 [cairo-paginated-surface] Propagate malloc failure
Check for an allocation failure during _cairo_analysis_surface_create()
and propagate to caller - where we discover that the callers themselves
missed the status checks...
2007-05-08 16:46:54 +01:00
Emmanuel Pacaud
0d8a1540ec SVG: Don't clip SVG element, as clipping region is implicit.
That makes editing of produced SVG easier.
2007-05-08 09:11:57 +02:00
Jinghua Luo
936c965777 glitz: kill some compiler warnings. 2007-05-08 13:24:40 +08:00
Jinghua Luo
413705872e glitz: fix a typo preventing build glitz backend from succeeding. 2007-05-08 13:19:35 +08:00
Chris Wilson
d81907734e [cairo-color] Only compare the shorts for equality.
By only checking the premultiplied shorts inside the cairo_color_t we
only have to compare at most 8 bytes instead of the full 24 bytes.
2007-05-05 12:33:29 +01:00
Chris Wilson
966a39396e [NEWS] Surface cache for solid patterns
Add an entry describing the surface cache to NEWS.
2007-05-04 15:25:18 +01:00
Chris Wilson
056d149212 [cairo-pattern] Don't cache fallback surfaces
_cairo_surface_create_similar_solid() may return an image surface,
should the backend not support the required content or should it
encounter an error whilst creating the surface. In those circumstances
we choose not to cache the fallback surface.
2007-05-04 14:29:48 +01:00
Chris Wilson
a8c8e17d84 [cairo-pattern] Cache surface for solid patterns
Original work by Jorn Baayen <jorn@openedhand.com>,
2715f20981

We use a small cache of size 16 for surfaces created for solid patterns.
This mainly helps with the X backends where we don't have to create a
pattern for every operation, so we save a lot on X traffic.  Xft uses a
similar cache, so cairo's text rendering traffic with the xlib backend
now completely matches that of Xft.

The cache uses an static index variable, which itself acts like a cache of
size 1, remembering the most recently used solid pattern.  So repeated
lookups for the same pattern hit immediately.  If that fails, the cache is
searched linearly, and if that fails too, a new surface is created and a
random member of the cache is evicted.

A cached surface can only be reused if it is similar to the destination.
In order to check for similar surfaces a new test is introduced for the
backends to determine that the cached surface is as would be returned by
a _create_similar() call for the destination and content.

As surfaces are in general complex encapsulation of graphics state we
only return unshared cached surfaces and reset them (to clear any error
conditions and graphics state). In practice this makes little difference
to the efficacy of the cache during various benchmarks. However, in order
to transparently share solid surfaces it would be possible to implement a
COW scheme.

Cache hit rates:    (hit same index + hit in cache) / lookups
cairo-perf:         (42346 + 28480) / 159600 = 44.38%
gtk-theme-torturer: (3023  + 3502)  / 6528   = 99.95%
gtk-perf:           (8270  + 3190)  / 21504  = 53.29%

This translates into a reduction of about 25% of the XRENDER traffic during
cairo-perf.
2007-05-04 14:29:38 +01:00
Chris Wilson
52472b740e [cairo-xlib-surface] Defer application of clip mask until required.
By deferring the issuing of the X requests to set the clip mask we can
theoretically avoid some redundant requests, but primarily we remove
another path where X requests are emitted.
2007-05-04 14:19:57 +01:00
Chris Wilson
a81823cdf9 [cairo-xlib-display] Allocate the close_display hooks from a freelist.
Similar to job allocation, but only useful for toolkits like GTK+ which
recreate a new xlib surface for each expose.
2007-05-04 14:17:27 +01:00
Chris Wilson
c29ffc64ca [cairo-xlib-display] Cache the screen_info for the lifetime of the display.
Hold an extra reference to the screen_info and explicitly destroy the
list of screens on CloseDisplay.
2007-05-04 14:14:17 +01:00
Chris Wilson
1d6f7b7a02 [cairo-xlib] Cache freed GCs
Maintain a cache of freed GCs, one for each used depth.
2007-05-04 14:11:25 +01:00
Chris Wilson
88c6d25d4e [cairo-xlib-surface] Defer xlib resource cleanup.
Due to caching, destruction of X11 resources may occur outside of a
usable X11 context. To avoid this, we defer the destruction onto a work
queue which will be run the next time we try to use the X11 connection
on behalf of the user (at which point we must have a usable X11 context!)
or we are closing the Display.
2007-05-04 14:08:20 +01:00
Chris Wilson
8ad30ccdb0 [cairo-xlib] Introduce a workqueue for deferred destruction of X resources.
Due to the nature of the reference counting, an X resource may be
destroyed later than anticipated and possibly from a different thread
than the original context. This becomes an issue for applications that
carefully manage their single X connection from a single thread and do
not use locking and are then suprised when cairo triggers X traffic when
performing work for a different part of the application in another thread.
2007-05-04 14:06:01 +01:00
Chris Wilson
dd8681b76b [cairo-xlib] Split per-display attributes from per-screen.
Previously, we stored the per-display attributes inside a special
screen=NULL _cairo_xlib_screen_info_t. Now we keep track of known X
displays and store the screen information beneath the display structure
alongside the per-display hooks.
2007-05-04 14:02:28 +01:00
Behdad Esfahbod
9919f1ed9c [TODO] Add link to cairo_copy_clip() proposal 2007-05-03 19:54:31 -04:00
Behdad Esfahbod
e5d9d51e55 [cairo-mutex] Fix typo. 2007-05-03 19:04:21 -04:00
Chris Wilson
5ec27eef95 [pixman] Free the old rects if we fail to allocate new.
During the pixman_op, a complicated dance is performed to handle
enlarging the rectangle array to accommodate the op. One consequence
of this is to, under certain circumstances, replace the current
rectangle array with emptyData and track the old array with oldData.
Hence if we fail to realloc the enlarged array we need to free oldData.
2007-05-03 13:46:25 +01:00
Behdad Esfahbod
ef30708217 [boilerplate] Fix typo 2007-05-02 16:22:44 -04:00
Chris Wilson
c412e42c72 [cairo-xlib-surface] Check that the acquire surfaces are xlib surfaces
_cairo_pattern_acquire_surfaces() may substitute an image surface for
either the source or the mask should the backend not support creation
of similar scratch surfaces or an error occurs during creation. For
composition we require xlib surfaces and so we must trigger the
fallback path if this happens.
2007-05-02 21:17:39 +01:00
Behdad Esfahbod
f3153091b7 [cairo-mutex] Document the API for adding cairo_mutex_t implementations 2007-05-01 20:10:39 -04:00
Behdad Esfahbod
5bfd6553fd [cairo-mutex] Define a NOOP CAIRO_MUTEX_FINALIZE() for pthread
as now the mutex layer will define a generic CAIRO_MUTEX_FINALIZE()
whenever the implementation defines CAIRO_MUTEX_FINI().  In the
case of pthread however we don't need finalization as we don't
have any place to call it, and pthread_mutex_destroy() doesn't
do much anyway.
2007-05-01 19:48:33 -04:00
Behdad Esfahbod
c4e0a059fe [cairo-mutex] Remove NOOP definition of CAIRO_MUTEX_INITIALIZE
as now the mutex layer will use a NOOP CAIRO_MUTEX_INITIALIZE
by default if the implementation does not define CAIRO_MUTEX_INIT.
2007-05-01 19:46:51 -04:00
Behdad Esfahbod
06cc74d974 [cairo-mutex] Rewrite defaults for CAIRO_MUTEX macros not defined by the implementation
to make them better match the design I have in mind, that I will
document in a minute.  They are a lot more readable and understandable
now.
2007-05-01 19:45:29 -04:00
Behdad Esfahbod
e87a25dc7c [cairo-mutex] Fix usage of CAIRO_MUTEX_DECLARE()
Previously cairo-mutex.c was abusing cairo-mutex-private.h by
defining CAIRO_MUTEX_DECLARE before including it, and
cairo-mutex-private.h was simply not overriding any available
CAIRO_MUTEX_DECLARE.  This is not the way it should be.
cairo-mutex.c should instead define CAIRO_MUTEX_DECLARE and
include cairo-mutex-list-private.h for itself.
2007-05-01 19:24:26 -04:00
Behdad Esfahbod
1a33e44aa5 [RELEASING] Update GNOME URL to point to 2.19 planning page 2007-05-01 19:20:06 -04:00