Commit graph

3773 commits

Author SHA1 Message Date
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
Behdad Esfahbod
4764e6222b [cairo-mutex] Improve error message if no thread implementation found
to put back Carl's "acknowledge and accept" clause (!) before suggesting
use of CAIRO_NO_MUTEX.
2007-05-01 19:20:06 -04:00
Behdad Esfahbod
b5f015f21f [cairo-mutex] Make sure mutex implementation declares enough macros
We have defaults for the rest.
2007-05-01 19:20:06 -04:00
Behdad Esfahbod
b0a0a1779d [cairo-mutex] Make CAIRO_MUTEX_INIT/FINI take mutex object, not pointer to it
This is more consistent with CAIRO_MUTEX_LOCK/UNLOCK.
2007-05-01 19:20:05 -04:00
Behdad Esfahbod
f9154f7eda [cairo-mutex] Make sure CAIRO_MUTEX_FINI() evaluates its argument once 2007-05-01 19:20:05 -04:00
Behdad Esfahbod
a8d47d0c00 [cairo-mutex] Rename macro arguments from "name" to "mutex" 2007-05-01 19:20:05 -04:00
Carl Worth
f57a536fce Increment version to 1.4.7 after the 1.4.6 release 2007-05-01 13:45:58 -07:00
Carl Worth
ddca8fec07 perf: Add $(EXTRA_PROGRAMS) to CLEANFILES
Otherwise these programs stick around and break distclean,
distcheck, and hence release-publish targets.
2007-05-01 13:37:16 -07:00
Carl Worth
0390ed4f18 Increment version to 1.4.6 (and library versioning to 13:3:11) 2007-05-01 13:24:43 -07:00
Carl Worth
c9e0bb5c79 NEWS: Add notes for cairo 1.4.6 2007-05-01 13:20:56 -07:00
Chris Wilson
7f7f4d4f35 [cairo-xlib-surface.c] Free the Pixmap on surface construction failure.
If we create the Pixmap whilst constructing a similar xlib surface, then
it our responsibility to free the Pixmap should we fail to allocate the
surface.
2007-05-01 12:37:38 +01:00
Chris Wilson
3e3bd4df7e Minor typo in cairo_surface_destroy() documentation.
The type of @surface is #cairo_surface_t, not #cairo_t.
2007-05-01 11:28:45 +01:00
Behdad Esfahbod
f7cdbd385a [cairo-mutex-private.h] Move implementation-specific parts to cairo-mutex-type-private.h
This fixes the problem reported by Dave Yeo that boilerplate wasn't building:

In file included from ../src/cairo-scaled-font-private.h:44,
	     from cairo-boilerplate.c:65:
../src/cairo-mutex-private.h:183: error: syntax error before "extern"
../src/cairo-mutex-private.h:184: error: syntax error before "void"
../src/cairo-mutex-private.h:185: error: syntax error before "void"
make[3]: *** [cairo-boilerplate.lo] Error 1
2007-05-01 00:41:47 -04:00
Behdad Esfahbod
6de0f2d157 [cairo-mutex] Fix CAIRO_MUTEX_FINALIZE definition to take parantheses
This was breaking build on some systems as reported by Adrian Johnson
on the list.
2007-04-30 22:38:00 -04:00
Behdad Esfahbod
3f297a0fcc [TODO] Add various items discussed recently 2007-04-30 22:00:31 -04:00
Behdad Esfahbod
51440ad902 [ROADMAP] Mark clipping trapezoids done 2007-04-30 21:57:29 -04:00
Behdad Esfahbod
8ea48710dc [perf] Check availability before including nonstandard headers 2007-04-30 19:20:56 -04:00
Behdad Esfahbod
fbc8bf0503 [perf] Don't build cairo-perf in "make all" 2007-04-30 19:11:31 -04:00
Adrian Johnson
4be608399f Fix cygwin compile error
The WINVER macros need to be defined before including <windows.h>.
As a result of some recent include file rearranging, <windows.h>
was included indirectly before WINVER was defined.
2007-04-30 14:38:19 -07:00
Chris Wilson
a5d1fc923f Free all memory when cairo-perf exits.
Similar to cairo-test, we free any global memory used by cairo for its
caches through the debug interfaces. We do this so that valgrind does
not unnecessary warn about memory leaks for the cached data and any true
leak is then not lost in the noise.
2007-04-30 16:06:47 +01:00
Carl Worth
7e6ab5461c Add missing prototypes for getline and strndup
This is needed to prevent breaking the build for non-GNU systems.
2007-04-28 07:46:56 -07:00
Carl Worth
422798db1d cairo-perf-diff-files: Add missing include of libgen.h for basename 2007-04-28 07:46:15 -07:00
Carl Worth
d89d8e6b45 pixman.h: Add missing definition of WARN_UNUSED_RESULT
This was breaking the build on systems without support for the
__warn_unused_result__ attribute.
2007-04-28 07:45:26 -07:00
Carl Worth
cb6fcdae92 Fix typo in Makefile preventing builds from succeeding
The cairo-ps-surface-private.h file was not getting included in the
distribution.
2007-04-28 07:38:56 -07:00