Commit graph

3868 commits

Author SHA1 Message Date
Chris Wilson
9d2c55c661 [traps] Embed sufficient traps to accommodate a stroke rectangle
Small numbers of traps are frequently generated from either a path of a
single line, or that of a rectangle. Therefore should embed sufficient
storage with cairo_traps_t to accommodate the stroke of a single rectangle
(e.g. a pango unknown glyph hexbox) to avoid frequent allocations.
2008-11-21 09:40:42 +00:00
Chris Wilson
a11442154d [cairo] Allocate glyphs on the stack for show_text().
First try to use a stack buffer for the glyphs and clusters if the user
calls cairo_show_text() - for example, as pango does to draw the unknown hex
box.
2008-11-21 09:40:42 +00:00
Chris Wilson
9556266ffc [surface] Make the error surfaces have a NULL backend.
By using a NULL backend for the error surfaces, instead of a pointer to
the image surface backend end, we save a few lookup/redirections during
dynamic linking.
2008-11-21 09:40:42 +00:00
Chris Wilson
cfd2c73826 [image] Trim image surface size by a few bytes
Convert an infrequently accessed series of cairo_bool_t and short enums
to a common bitfield.
2008-11-21 09:40:37 +00:00
Chris Wilson
727ff2bd72 [xlib] Explicitly track whether the GC has clip_rects.
Simplify the logic and remove some pessimism from the code by explicitly
tracking when we set clip rectangles on the GC.
2008-11-19 17:11:49 +00:00
Chris Wilson
63a86a470f [surface] Replay meta surfaces to a similar surface.
When cloning a meta-surface, first attempt to replay it to a similar
surface rather than a full-sized image buffer.
2008-11-19 14:06:10 +00:00
Chris Wilson
81ef772aa0 [xlib] Mark GC as dirty if we have an outstanding clip.
Ginn Chen reported a regression with Firefox where "the whole area of web
page is transparent until it redraws", and bisected it to the change to
lazily clear the clip.

The bug would appears to be when we have an inconsistent GC clip - i.e.
the clip on the surface has been cleared, but we have not yet used and
thus cleared the GC, so that we did not mark the GC as having a clip set
when we freed it.
2008-11-19 11:59:21 +00:00
Chris Wilson
8345fedbe4 [spline] Fix compile.
Do not return the result of a void function. gcc chose to not warn about
this when removing the return parameter...
2008-11-19 11:59:21 +00:00
Chris Wilson
b6c371a47f [pattern] Cosmetic.
surface is equal to pattern->surface at this point.
2008-11-19 11:59:21 +00:00
Chris Wilson
645df0c6d2 [scaled-font] Clean-up compiler warning.
gcc warns that the status may be used uninitialized, so fix it.
2008-11-19 11:59:20 +00:00
Chris Wilson
2fdee49074 [compiler] likelihood macros
Behdad prefers these to be upper-case to be consistent with G_UNLIKELY and
friends. However, as I intend to use these for nearly all instances of
if(status), I suggest that we keep to the short and not so loud:
    if (unlikely (status))
       return status;
2008-11-19 11:59:20 +00:00
Chris Wilson
97edc680c1 [twin] Reduce tolerance.
As the glyphs are rendered to cache, ensure that they are rendered at the
highest quality settings.
2008-11-19 11:59:20 +00:00
Chris Wilson
e50538863a [twin] Tweak line width.
Slightly increase line width to eliminate internal holes in the characters
where the strokes were not quite overlapping.
2008-11-19 11:59:20 +00:00
Chris Wilson
d7873eecc5 [spline] Eliminate intermediate allocations during spline decomposition.
The spline decomposition code allocates and stores points in a temporary
buffer which is immediately consumed by the caller. If the caller supplies
a callback that handles each point computed along the spline, then we can
use the point immediately and avoid the allocation.
2008-11-16 16:21:25 +00:00
Chris Wilson
3bf8379408 [type1] Propagate fatal NO_MEMORY erro from FreeType.
If FreeType fails to load the glyph, check for a fatal error before
falling back (and effectively masking the fatal condition).
2008-11-16 16:21:24 +00:00
Chris Wilson
db9ed77d8a [cairo] FLush surface on cairo_destroy()
When discussing the implications of snapshot cow, one of the questions
that we raised was what happens on cairo_destroy()? The lifetime of the
context implicitly marks the extents of the drawing operations, typically
the expose event (or perhaps one phase of it). Therefore at the end of the
sequence we implicitly wish to flush the graphics events to the surface.
2008-11-16 16:21:24 +00:00
Chris Wilson
032be9849d [skiplist] Inline testing.
Add a loop to create a skip list to allow manual checking.
2008-11-16 16:21:23 +00:00
M Joonas Pihlaja
e44c1f26e4 Use a smaller and faster random number generator.
The previous LFSR generator used a large table to be speedy.  The
replacement generator is the single stage generator (1) from section
5.4 of [HP2007], requires no tables or extra state.  I've run the
generator through Rob Brown's extended Dieharder test suite and it
passes all but one self-proclaimed buggy test (-d2) and the 2D sphere
minimum distance test (-d12).

[HP2007] Hars L. and Petruska G., ``Pseudorandom Recursions: Small and Fast Pseurodandom Number Generators for Embedded Applications'',
Hindawi Publishing Corporation
EURASIP Journal on Embedded Systems
Volume 2007, Article ID 98417, 13 pages
doi:10.1155/2007/98417
http://www.hindawi.com/getarticle.aspx?doi=10.1155/2007/98417&e=cta
2008-11-16 16:21:23 +00:00
Chris Wilson
a4c5371b5e [os2] Move include cairo.h before os2.h
The defines need to come first, but we specify that cairo.h is the first
header file to be included by files.
2008-11-16 16:21:23 +00:00
Carl Worth
456252a1c2 Merge branch '1.8'
Conflicts:

	NEWS
	cairo-version.h
2008-11-14 15:27:34 +01:00
Carl Worth
d654d528de Blacklist "X.Org" < 7.0 with the buggy_repeat workaround.
This is in response to a report that a 6.9 server crashes with
cairo's extend-reflect test:

https://bugs.freedesktop.org/show_bug.cgi?id=15628#c2
2008-11-13 16:54:00 +01:00
Carl Worth
35a1ba0ddc Document the buggy_repeat workaround more carefully.
It's a confusing condition, so let's be explicit about where
the various numbers come from.
2008-11-13 16:54:00 +01:00
Chris Wilson
a856371bef Add CairoScript backend.
A new meta-surface backend for serialising drawing operations to a
CairoScript file. The principal use (as currently envisaged) is to provide
a round-trip testing mechanism for CairoScript - i.e. we can generate
script files for every test in the suite and check that we can replay them
with perfect fidelity. (Obviously this does not provide complete coverage
of CairoScript's syntax, but should give reasonable coverage over the
operators.)
2008-11-13 11:36:54 +00:00
Chris Wilson
47a56e0850 [type1] Bind the RD procedure
As the RD procedure may be called several hundred times for a full font,
it is worth binding.
2008-11-13 11:36:50 +00:00
Chris Wilson
0769d39d00 Add predicate likelihood macros.
Define the couple of standard macros that we can use to guide gcc
optimisations of which code path will be most likely taken.
2008-11-13 11:36:44 +00:00
Chris Wilson
b06c50cc54 [cairoint.h] Remove unused PLT entries.
Trim the slim_hidden_proto/def to match the currently used functions.
2008-11-13 11:36:43 +00:00
Chris Wilson
20fc2a2f92 [in-fill] Fixup boundary insideness testing
Benjamin Otte noticed that the top-left vertex was now included within the
fill extents. Having updated the test case to check the insideness
conditions as defined by flash, fix the edge handling to match.
2008-11-13 11:36:43 +00:00
Chris Wilson
cebc84f367 [hash] Separate out unique patterns of iterating over the table.
Avoid unnecessary conditionals for the hotpaths by separating out the
iteration over the elements into their distinct modes.
2008-11-13 11:36:42 +00:00
M Joonas Pihlaja
efa9e1088c [clip] Fix uninitialised status return in _cairo_clip_intersect_mask() for empty extents.
This fixes the clip-all test case crashing for me.
2008-11-13 13:10:18 +02:00
Behdad Esfahbod
279a7cef34 [os2] Fix includes
Patch from Dave Yeo to make cairo-os2.h include os2.h directly so the
header is standalone.
2008-11-13 10:50:41 +01:00
Jeff Muizelaar
0a682034a0 Make the clipping implementation comment clearer
When reviewing the spans changes, I reread this comment and it wasn't as clear
as it could be.
2008-11-11 13:26:09 -05:00
Jeff Muizelaar
9c0042840c [quartz] Add the proper propagation of extents
This fixes the problems introduced by d682d275b9
2008-11-11 08:41:31 -05:00
Jeff Muizelaar
57551a9116 [quartz] Fix fallout caused by const cairo_pattern_t *
7944601864 broke the quartz backend.
Fix it by adding const to the appropriate parameters in the function
declarations and copying the pattern when needed.
2008-11-11 08:31:23 -05:00
Maarten Maathuis
164069b339 cairo-xcb: avoid leaking memory 2008-11-08 14:41:21 +00:00
Chris Wilson
f1cae5c52a [ps] Trivial compile warning clenaup.
Add a missing const to silence the compiler.
2008-11-07 20:52:08 +00:00
Chris Wilson
2b32c8b9e5 [hash] Return lookup entry.
Use the return value to return the result from _cairo_hash_table_lookup()
(as opposed to filling an output parameter on the stack) as this (a)
results in cleaner code (no strict-alias breaking pointer casts), (b)
produces a smaller binary and (c) is measurably faster.
2008-11-07 20:50:34 +00:00
Karl Tomlinson
d15fb9344b [hash] Set is_unique when finding an available for inserts
As we obey the rule in Cairo that we only insert if we know that there is
no existing entry in the hash table, we can therefore perform a much quicker
search knowing that the key is unique.
2008-11-07 20:49:14 +00:00
Chris Wilson
2554d17598 [surface] Pass a separate closure for the mime-type destroy notifier.
A limitation of the current API was that the destroy notifier was called
on the mime-data block. This prevents the user from passing in a pointer
to a managed block, for example a mime-data block belonging to a
ref-counted object. We can overcome this by allowing the user to specify
the closure to be used with the destroy notifier.
2008-11-07 19:30:33 +00:00
Chris Wilson
13627b4620 [in-fill] Fix transposed arguments.
Silly typo that escaped the test suite.
2008-11-06 01:07:25 +00:00
Chris Wilson
f5965cb7d6 [in-fill] Avoid tessellation by counting number of edge crossing to -∞
Benjamin Otte reports that in one particular benchmark cairo_in_fill() is
a hotspot in the profile. Currently we tessellate the entire path and then
search for a containing trapezoid. This is very expensive compared to the
simple method of counting the number of edge crossing between the point of
interest and x=-∞. For example, this speeds tessellate-256 up by almost 3
orders of magnitude.
2008-11-06 00:27:23 +00:00
Chris Wilson
564d64a132 [png] Complete the idempotent read_png() -> write_png()
Write out the original PNG mime-data if attached to the surface during
cairo_surface_write_to_png(). Similar to how the compressed alternate
representations are handled by the other backends.

Note: by automatically attaching and using the mime-data in preference to
the image data, we break the read_from_png(); draw(); write_to_png()
cycle.
2008-11-05 18:47:34 +00:00
Chris Wilson
e4ec5c762f [svg] Embed original PNG data.
Embed the attached PNG representation of a surface in preference to
re-encoding the surface.
2008-11-05 18:13:10 +00:00
Chris Wilson
e40d62a0fe [png] Attach the png representation to cairo_surface_create_from_png().
Attach the original png data as an alternate representation for image
surfaces created by cairo_surface_create_from_png().
2008-11-05 18:13:09 +00:00
Chris Wilson
89616dee8f [surface] Don't allocate a structure for mime_data == NULL.
If the user attempts to clear the attached mime data representation, just
clear the user data slot and do not allocate an empty structure.
2008-11-05 18:13:09 +00:00
Behdad Esfahbod
a1ab11df01 Define RepeatNone, etc if the available Render version doesn't (#18385) 2008-11-05 11:54:54 -05:00
Behdad Esfahbod
43cfaec39c Define RepeatNone, etc if the available Render version doesn't (#18385) 2008-11-05 11:50:20 -05:00
Chris Wilson
199c0e7113 [svg] Embed jpeg data.
Support jpeg embedding for svg output.
2008-11-05 15:13:02 +00:00
Adrian Johnson
248dd97075 win32-printing: Implement JPEG support 2008-11-06 00:21:35 +10:30
Chris Wilson
29621bd399 [matrix] Remove stray offset from previous commit.
I moved the pixel centre to xc,yc but forgot to remove it during
compensation - as caught by the test suite.

Refresh a couple of reference images that depend upon exact pixel-centre
rounding conditions.
2008-11-05 12:16:47 +00:00
Chris Wilson
e811173311 [matrix] Compensate pixman_matrix in device space.
We wish to reduce the visible error when converting to a pixman matrix, so
perform the compensation in device space instead of pattern space.
2008-11-05 11:16:08 +00:00