Commit graph

5351 commits

Author SHA1 Message Date
Behdad Esfahbod
498f3ddf2e Add status CAIRO_STATUS_NEGATIVE_COUNT
To be used for things like passing a negative number of glyphs
to cairo_show_glyphs().
2008-06-23 17:53:25 -04:00
Behdad Esfahbod
ce24588d1c [doc] Update doc/public/Headers.mk 2008-06-23 17:51:32 -04:00
Behdad Esfahbod
676b221326 Protect against NULL glyphs array in text API
We still don't do anything if num_glyphs is negative.  Why isn't
that argument unsigned int...
2008-06-23 17:42:29 -04:00
Behdad Esfahbod
233b387c29 Use #include "cairo-*." instead of #include <cairo-*.h>
The rule is simple: <x.h> for system / other project includes,
"x.h" for local includes.
2008-06-23 00:30:04 -04:00
Behdad Esfahbod
9fea50a1e6 Rename _cairo_font_reset_static_data to _cairo_font_face_reset_static_data 2008-06-22 15:15:44 -04:00
Behdad Esfahbod
7407362d70 Rename cairo_quartz_scaled_font_backend to _cairo_quartz_scaled_font_backend 2008-06-22 15:13:42 -04:00
Behdad Esfahbod
4240794ea4 Rename cairo_win32_scaled_font_backend to _cairo_win32_scaled_font_backend 2008-06-22 15:13:15 -04:00
Behdad Esfahbod
e09f20fe01 [gstate] Fix huge-font path;fill fallback options 2008-06-22 14:50:08 -04:00
Behdad Esfahbod
d9784c8c37 [cairo-xlib] Don't undither pseudocolor, doesn't look good 2008-06-19 22:24:13 -04:00
Behdad Esfahbod
fe41d100aa [cairo-xlib-surface] Fix core solid_fill_rectangles to do dithering
Do this by tiling the surface form the solid pattern.  The pattern in
turn calls into xlib's create_solid_surface which returns a dithered
pattern.

This can get into infinite loop right now, because of the way solid
surface cache tries to repaint cached surfaces.
2008-06-19 22:00:52 -04:00
Behdad Esfahbod
abac0f96cb [cairo-xlib-surface] Implement create_solid_pattern_surface
If render is disabled, this will create a surface the size of the
dither pattern and paint it with dithering.
2008-06-19 22:00:50 -04:00
Behdad Esfahbod
fb8f2b3854 [cairo-xlib-surface] Make _draw_image_surface handle arbitrary image formats
This is not a useful change.  Just committing because I already did it.
2008-06-19 21:55:41 -04:00
Behdad Esfahbod
bc4b788ec1 [cairo-xlib-surface] In _get_image_surface only use pixman formats >= 24bpp
Otherwise we can't do dithering.  This drastically improves gradient rendering
on 16bit displays, essentially making them indistinguishable from 32bit ones
with a naked eye.
2008-06-19 21:55:27 -04:00
Behdad Esfahbod
5faf8663b2 [cairo-xlib-surface] Force buggy_repeat to TRUE if Render is not available
So we use more core protocol paths.
2008-06-19 21:54:29 -04:00
Behdad Esfahbod
e7c1fc5bf5 [xlib] Implement dithering
Remove the intermediate rgb333 for PseudoColor and work on the
cube directly.  Also upgrade to a 6x6x6 cube instead of 5x5x5.
Do dithering on both PseudoColor and TrueColor, using a 4x4 pattern.

This only affects X servers with no XRender.
2008-06-19 21:54:23 -04:00
Behdad Esfahbod
c0176dc54c [cairo-xlib-surface] Remove unused macro 2008-06-19 21:54:02 -04:00
Behdad Esfahbod
93efdce43a Add a create_solid_pattern_surface surface backend method
This can be used by _cairo_pattern_acquire_surface_for_solid() to let
the backend create custom surfaces for solid fill instead of a 1x1
similar surface.
2008-06-19 21:53:57 -04:00
Behdad Esfahbod
ff1371a0a7 [cairo-surface] Remove optional pattern argument from create_similar_solid()
This was added in 41c6eebcd1, to avoid
allocating short-lived patterns.  However, this was error prune as the
color information was duplicated in the pattern and could get out of
sync.  Indeed, it was out of sync before this commit in the call from
cairo-clip.c.

By allocating the solid pattern on the stack we fix the original problem
without creating new ones.
2008-06-19 21:06:07 -04:00
Behdad Esfahbod
240cb59fe8 [cairo-pattern] Clean up _cairo_pattern_acquire_surface_for_solid() 2008-06-19 19:49:23 -04:00
Behdad Esfahbod
2a59287711 Fix comment 2008-06-19 19:28:49 -04:00
Behdad Esfahbod
b0d112756f Remove opaque solid pattern COLOR_ALPHA optimization from call sites
As we do this in _cairo_pattern_init_solid() now.
2008-06-19 19:25:33 -04:00
Behdad Esfahbod
e93e990324 [cairo-pattern] In init_solid() convert COLOR_ALPHA to COLOR if color is opaque
Moving this further than, so it benefits all callers.
2008-06-19 19:22:36 -04:00
Behdad Esfahbod
333a49d01d [cairo-pattern] Don't call _cairo_stock_color() directly 2008-06-19 19:18:57 -04:00
Behdad Esfahbod
4eae72317f [cairo-pattern] Remove stale comment 2008-06-19 19:08:50 -04:00
Behdad Esfahbod
52cf67a8f2 Rename cairo_* global vars to _cairo_* 2008-06-19 17:44:43 -04:00
Behdad Esfahbod
9388cc71db [src/check-def.sh] Make sure no global variables are named cairo_*
Even if they are marked cairo_private.
2008-06-19 17:43:52 -04:00
Behdad Esfahbod
aef25b8345 [cairo-pattern] Fix solid surface cache to check for content match too
The code in that cache is becoming uglier and uglier.  But at least it
works correctly again.  Time for a rewrite.

(Also move the destroy after unlocking)
2008-06-19 17:31:10 -04:00
Chris Wilson
565644e616 [cairo-pattern] Band-aid for the solid surface cache.
Behdad noticed that the mixing of dissimilar surfaces within the cache
was fubar
(http://lists.cairographics.org/archives/cairo/2008-June/014348.html).

This corrects the dereferencing of the evicted surface, but leaves open
the question of the future of the cache.
2008-06-19 12:29:49 +01:00
Chris Wilson
47d8739ea1 [test/xlib-surface-source] Build under --disable-xlib-xrender.
Add an ifdef to support compiling without XRender.
2008-06-19 12:25:01 +01:00
Chris Wilson
38c4bcc2da [test/solid-pattern-cache-stress] Do what it says on the tin.
Actually draw to the surface after setting the source in order to
trigger use of the solid surface cache.
2008-06-19 12:24:30 +01:00
Behdad Esfahbod
233ba271d6 [cairo-xlib-xrender] Simplify dummy XRender function stubs
for the case of missing Xrender that is.  This compiles
warning-clean now.
2008-06-18 20:48:09 -04:00
M Joonas Pihlaja
d36347e0e2 Bug: tessellator sometimes ends rightmost trapezoids too late
Reported on the cairo mailing list:

http://lists.cairographics.org/archives/cairo/2008-May/014233.html

The tessellator would sometimes produce self-intersecting trapezoids
because it would skip the last edge in the active list when deciding
whether we can continue the current trapezoid or not.

The bug never caused a problem with pixman based rasterisation
because pixman stops filling in a trapezoid once it detects a self
intersection.
2008-06-18 18:35:42 +03:00
Chris Wilson
f2ea46edf4 [cairo-xlib-surface] Optimize away clip that covers the entire surface.
Replace a clip rectangle that covers the entire surface with no
clipping as this is quite a common operation when toolkits (i.e. GTK+)
clear surfaces before drawing and avoids a redundant
XRenderSetClipRectangles.
2008-06-13 21:52:37 +01:00
Chris Wilson
b06bd9379a [cairo-xlib-surface] Handle a NULL visual along core FillRectangles path.
It is possible for an XRender capable surface to use
_cairo_xlib_surface_solid_fill_rectangle() if the surface
HAS_CREATE_PICTURE() && ! HAS_FILL_RECTANGLES(), in which case we need to
handle the surface having no associated visual.

Fixes test/xlib-expose-event.
2008-06-13 21:37:58 +01:00
Chris Wilson
db32e5ffcc [check-def.sh] Ignore magic PPC symbols
It appears that the PowerPC Linux ABI specifies a number of magic
functions for register saves and restores which currently appear as
exported symbols in the shared object. Ignore them.
2008-06-13 21:37:58 +01:00
Chris Wilson
ad9a334e2c Allocate the correct pattern type on the stack.
Instead of allocating the union of all possible pattern types, just
allocate the specific pattern as used by the function in order to trim
the stack space consumption and flag potential misuse.
2008-06-13 21:37:58 +01:00
Chris Wilson
74c1e9b545 Trivial warning fixes to silence the compiler. 2008-06-13 21:37:58 +01:00
Chris Wilson
b235050316 [cairo-pattern] Generate an opaque solid colour if alpha >= 1.
If the user supplies an alpha value of >= 1 to
cairo_pattern_create_rgba(), substitute a call to
cairo_pattern_create_rgb() instead.
2008-06-13 21:37:57 +01:00
Chris Wilson
40e1aa60f2 [cairo-pattern] Try to repaint the evicted surface from the solid surface cache.
Behdad Esfahbod complained that commit
8457374c9c overwhelmed the function with
added complexity and arbitrary limited a backend to one-quarter of the
cache. The elegant solution, he outlined, was to look at the surface that
would be evicted and if possible repaint it, instead of creating a
replacement. This not only simplifies the code, reduces the number of
checks performed to find a match (or victim) and allows the cache to be
naturally shared between the various backends.
2008-06-13 21:37:57 +01:00
Chris Wilson
ea79af728c [cairo-xlib] Scan for a glyphset to match a pending free glyph.
In order to avoid re-rasterising a glyph that is pending an
XRenderFreeGlyph, we first scan all glyphsets and their arrays of
pending_free_glyphs for a matching glyph. The additional cost of
scanning the extra arrays should be negligble as most fonts will only
have the single array (which we would scan anyway) but we potentially
save an expensive rasterisation and short-lived image surface.

(As suggested by Behdad Esfahbod.)
2008-06-13 21:37:57 +01:00
Chris Wilson
c2963fa6c1 [cairo-boilerplate] Silence compiler warning.
Mark the optstr argument as const to silence a compiler warning in
cairo-perf.
2008-06-13 21:34:43 +01:00
Chris Wilson
ac44817c4a [cairo-perf] Only allocate arrays once.
Store the array of times on the cairo_perf_t context to avoid
reallocating it for every perf-case.
2008-06-13 21:34:42 +01:00
Chris Wilson
335ed74589 Enlarge the embedded arrays to eliminate frequent allocations.
Enlarge the embedded arrays of edges and points for cairo_polygon_t and
cairo_spline_t respectively, such that the frequent allocations are
eliminated whilst running a firefox3 benchmark.
2008-06-13 21:34:42 +01:00
Chris Wilson
963ff0b948 [cairo-pen] Embed a small array of vertices into cairo_pen_t.
Eliminate allocation of the vertex array for the common cases.
2008-06-13 21:34:42 +01:00
Chris Wilson
d9b2e8f004 [cairo-path-stroke] Avoid allocation for single rectangle.
The most common case for path stroking is a single rectangle, so embed
sufficient segments into the stroker to avoid an extra allocation.
2008-06-13 21:34:41 +01:00
Chris Wilson
ba6b2d092a [cairo-hull] Attempt to allocate vertices on stack.
First try to allocate the vertices using an on-stack array, otherwise, if
we need more vertices than can be accomodated, fallback to using a heap
array.
2008-06-13 21:34:41 +01:00
Chris Wilson
b2eadb94f8 [cairo] Cache freed gstates.
Reduce the malloc pressure from frequent cairo_save()/cairo_restore() by
caching the freed gstates in a list on the context.
2008-06-13 21:34:41 +01:00
Søren Sandmann
c57b1eca18 Merge branch 'region32' 2008-06-13 16:18:13 -04:00
Behdad Esfahbod
b9acf625d6 Make check-*.sh scripts more portable (#16299) 2008-06-12 21:03:19 -04:00
Behdad Esfahbod
d47142907f [xlib-visual] Make the 5x5x5 color cube better approximate the rgb333 space
That is, instead of uniformly spreading the colors at 0/4, 1/4, 2/4, 3/4, 4/4
intensities, we do 0/7, 1.5/7, 3.5/7, 5.5/7, 7/7 now.  Those better
approximate the 0/7..7/7 of the rgb333 space that we first convert to.
2008-06-12 14:18:06 -04:00