Commit graph

1609 commits

Author SHA1 Message Date
Frederic Crozat
fe21f9d8ca [check-defs.sh] Fix make check for OPD platforms
Make symbol checks work on OPD platform (such as IA64 or PPC64).
2006-12-16 13:55:21 -05:00
Jonathan Watt
81a620fb66 revert accidental mode changes in my previous commit 2006-12-15 04:52:28 +01:00
U-JONATHAN-X60S\jonathan
bf78be63fc Fix a couple of character spacing issues on Windows 2006-12-15 00:48:54 +01:00
Behdad Esfahbod
1781e6018c [Xlib] Rewrite an optimized cairo_xlib_show_glyphs()
The old implementation was a very naive one that used to generate one XRender
glyph element per glyph.  That is, position glyphs individually.  This was
raised here:

  http://lists.freedesktop.org/archives/cairo/2006-December/008835.html

The new implmentation is a free rewriting of the Xft logic, that is,
compressing glyphs with "natural" advance into elements, but with various
optimizations and improvements.

In short, it works like this: glyphs are looped over, skipping those that are
not desired, and computing offset from "current position".  Whenever a glyph
has non-zero offsets from the current position, a new element should be
started.  All these are used to compute the request size in the render
protocol.  Whenever the request size may exceed the max request size, or at
the end, glyphs are flushed.  For this to work, we now set non-zero glyph
advances when sending glyphs to the server.

Notable optimizations and improvements include:

  - Reusing the input glyph array (with double glyph positions) as a working
    array to compute glyph offsets.

  - Reusing the input glyph array as the output glyph-index array to be passed
    to XRender.

  - Marking glyphs to be skipped as so, avoiding a copy of the glyph array,
    which is what the old code was doing.

  - Skip glyphs with positions "out-of-range".  That is, those with positions
    that would cause an overflow in Xrender's glyph offset calculations.

On my Fedora desktop on Pentium 4, and on a Nokia 770, it shows a 6% speedup on
the timetext test.
2006-12-12 03:30:21 -05:00
Behdad Esfahbod
198c1439ab Cache rounded glyph advance values
This is done in cairo_scaled_glyph_t->x/y_advance.  The value is mostly useful
for raster backends, for example to set as default advance of a glyph, and
later on optimize glyph positionings that use the default advance.
2006-12-12 03:30:19 -05:00
Behdad Esfahbod
e7ed9eee76 [cairo-gstate] Use a local buffer on the stack for small glyph operations
We duplicate the incoming glyph array for two reasons: 1) applying
transformations, and 2) to let the lower level functions have a glyph array
they can modify.  By using a 2kb array on the stack we can avoid malloc() for
requests of less than 100 glyphs.  The size of the array can be tuned by
setting CAIRO_STACK_BUFFER_SIZE.
2006-12-12 03:30:14 -05:00
Behdad Esfahbod
da60bc45f2 [cairoint] Define CAIRO_STACK_BUFFER_SIZE (defaults to 2kb)
This is the suggested size in bytes of buffers allocated on the stack per
function, mostly used for glyph rendering.  We typically use a local buffer on
the stack to avoid mallocing for small requests.  Requests that do not fit are
malloc()ed automatically.  The default value should be enough for about a
100-glyph cairo_show_glyphs() operation.
2006-12-11 03:10:05 -05:00
Behdad Esfahbod
5a9642c574 Add/remove const to cairo_glyph_t* arguments consistently
The rule is: cairo_glyph_t* is always passed as const for measurement
purposes.  This was not reflected in our public api previously.  Fixed

Showing glyphs used to have cairo_glyph_t* always as const.  With this
changed, it is only const on cairo_t and cairo_gstate_t operations.
cairo_surface_t, cairo_scaled_font_t, and individual backends receive
cairo_glyph_t* as non-const.  The desired semantics is that they may modify
the contents of the array as long as they do not return
CAIRO_STATUS_UNSUPPORTED.  This makes it possible to avoid copying the glyph
array again and again, and edit it in-place.  Backends are in fact free to use
the array as a generic buffer as they see fit.
2006-12-11 01:39:51 -05:00
Behdad Esfahbod
70695f5c62 [FreeType] Remove "UNSUPPORTED" show_glyphs stub and NULL its entry
The fallback paths always assume UNSUPPORTED if a method is NULL, so, no need
for a method to just return UNSUPPORTED.
2006-12-10 02:33:59 -05:00
Dan Amelang
fea60c7283 Change _cairo_lround to correctly handle edge cases previously missed
A nice side effect of this new approach is that the valid input range
was expanded back to (INT_MIN, INT_MAX]. No performance regressions observed.
Also included is documentation about the internal mysteries of _cairo_lround,
as previously promised.
2006-12-09 21:05:20 -08:00
Behdad Esfahbod
cc75159587 [FreeType] Do not return large structs from functions
Pass cairo_ft_options_t around by pointer, not by value.  That's what we do
with cairo_font_options_t anyway, and there is no reason to not do the same
here.  (makes -Waggregate-return warnings go away btw).
2006-12-08 16:10:57 -05:00
Behdad Esfahbod
16c7587f2d [slim] Define slim macros to dummy prototypes for non-gcc compilers (#9150) 2006-12-08 15:40:59 -05:00
M Joonas Pihlaja
e857ac325a tessellator bug fix: linking fails on x86_64 due to superfluous inline attribute.
Remove inline attribute from cairo_bo_event_compare_abstract()
to fix the linking issue reported by Jinghua Luo on the mailing list:

http://lists.freedesktop.org/archives/cairo/2006-November/008574.html
2006-12-07 02:31:10 +02:00
Dan Amelang
ce58f874fe Change _cairo_lround to use arithmetic rounding
This fixes the text rendering bug reported here:

    https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=217819

No performance impact on x86. On the 770, I see minor speedups in text_solid
and text_image (~1.05x).
2006-12-06 12:30:28 -08:00
M Joonas Pihlaja
d0eff39196 tessellator: input validation and guard bit removal
This patch removes the guard bits from the tessellator internal
coordinates and reworks the input validation to make sure that the
tessellator code should never die on an assert.  When the extent of a
polygon exceeds a width or height of 2^31-1, then the rightmost
(resp. bottommost) points are clamped to within 2^31-1 of the leftmost
(resp. topmost) point of the polygon.  The clamping produces bad
rendering for really large polygons, and needs to be fixed in a saner
manner.

Cleaned up as per

http://lists.freedesktop.org/archives/cairo/2006-December/008806.html
2006-12-06 05:58:44 +02:00
M Joonas Pihlaja
f8ba749172 tessellator: offset working coordinates to be nonnegative
This patch improves the translation invariance of the tessellator
by offsetting all input coordinates to be nonnegative and paves
the way for future optimisations using the coordinate range.

Also changes the assertions to make sure that it is safe to add
the guard bits.  This needs to be changed to do something sensible
about input coordinates that are too large instead of croaking.
The plan is to steal the guard bits from the least significant
instead of the most significant user bits, and having all coordinates
nonnegative will make the rounding involved there easier.
2006-12-06 05:58:44 +02:00
M Joonas Pihlaja
633c51b442 tessellator bug fix: in-fill-empty-trapezoid
The cairo_in_fill() function sometimes gives false positives
when it samples a point on the edge of an empty trapezoid.
This patch alleviates the bug (but doesn't fix it completely),
for the common(?) case where the left and right edges of the
empty trapezoid have equal top and bottom points.
2006-12-06 05:58:44 +02:00
M Joonas Pihlaja
e6c8febca7 tessellator bug fix: fill-missed-stop
Fixes the regression exhibited by the test fill-missed-stop,
where the tessellator would sometimes extend a trapezoid
too far below the end of the right edge.
2006-12-06 05:58:44 +02:00
M Joonas Pihlaja
614117e487 tessellator bug fix: fill-degenerate-sort-order
Fixes the regression fill-degenerate-sort-order, where
confusion arises in the event order for collinear edges.
Also fixes (or at least hides) the issues with zrusin-another
sometimes generating different trapezoids depending on the
state of the random number generator in cairo-skiplist.c.
2006-12-06 05:58:44 +02:00
Mathieu Lacage
a4f5463cdd bugfix: fix cairo-wideint.c uint64_t usage and const return qualifiers
These patches were sent to the cairo mailing list by Mathieu Lacage
<Mathieu.Lacage@sophia.inria.fr>:

http://lists.freedesktop.org/archives/cairo/2006-December/008741.html

  _cairo_uint_96by64_32x64_divrem(): fixes misuse of the uint64_t type
  and cairo-wideint-private.h functions.

http://lists.freedesktop.org/archives/cairo/2006-December/008742.html

  Remove const qualifiers from return types from cairo-wideint.c functions.

http://lists.freedesktop.org/archives/cairo/2006-December/008747.html

  Fixes a typo in cairo-wideint-private.h: _cairo_uint128_to_int128_
  had an extra trailing underscore.
2006-12-05 03:59:11 +02:00
Carl Worth
a8f6d27fba Add some missing cairo_private decorators 2006-11-22 18:44:34 -08:00
Joonas Pihlaja
fac3684e68 perf: new-tessellator: Deferred trapezoid generation (first try) 2006-11-22 17:55:54 -08:00
Joonas Pihlaja
6bd72ce74a Sort pointers instead of cairo_bo_events in the tessellator.
We were spending a lot of time in memcpy.
2006-11-22 17:55:54 -08:00
Joonas Pihlaja
b177573b72 Make the skip list check for uniqueness.
This patch removes a redundant call to skip_list_find()
that was being used to detect duplicate intersection events.
Instead, skip_list_insert() now takes an additional parameter
letting it know what to do with duplicates.
2006-11-22 17:55:54 -08:00
Joonas Pihlaja
8bec0bac56 Malloc less using a free list of nodes. 2006-11-22 17:55:54 -08:00
Joonas Pihlaja
de0e327b3d Tweak comparators. 2006-11-22 17:55:54 -08:00
Joonas Pihlaja
67359d7a58 Separate start and stop events from intersections (first try.)
Don't use the skip list for start and stop events, but presort
those first.
2006-11-22 17:55:54 -08:00
Joonas Pihlaja
97f02dca5d Avoid a skip-list lookup when deactivating edges. 2006-11-22 17:55:54 -08:00
Joonas Pihlaja
99f8a5313d Special cases for skip list comparators. 2006-11-22 17:55:54 -08:00
Joonas Pihlaja
fd8cd39cda Use an LFSR instead of random(). 2006-11-22 17:55:53 -08:00
Joonas Pihlaja
d957e59744 Replace the 128 bit divrem by a 96/64 bit one. 2006-11-22 17:55:53 -08:00
Joonas Pihlaja
1da14262ea A 96 by 64 bit divrem that produces a 32 bit quotient and 64 bit remainder. 2006-11-22 17:55:53 -08:00
Carl Worth
762bd1330d Make event_queue_insert ignore duplicate intersection events (not duplicate start/stop events)
This fixes the failures of the new tessellator with the 3 tests:
bitmap-font, rectangle-rounding-error, and close-path
The problem was that identical edges from separate polygons
were not being added to the event queue, (because of a check
that was actually only intended to prevent an intersection
event from being scheduled multiple times).
2006-11-22 16:56:51 -08:00
Carl Worth
4cd871b6f3 Switch from old tessellator to new tessellator 2006-11-22 16:56:51 -08:00
Carl Worth
0f7c488906 Adapt new tessellator to match the interface provided by the old tessellator. 2006-11-22 16:56:51 -08:00
Carl Worth
8921f73399 Add new tessellator (unused) in cairo-bentley-ottmann.c
This is the implementation as it cooked in the new-tessellator branch
available from:

	git://people.freedesktop.org/~cworth/cairo

The file here comes from commit eee4faf79900be2c5fda1fddd49737681a9e37d6 in
that branch. It's sitting here not hooked up to anything in cairo yet,
and still with a main function with test cases, etc.
2006-11-22 16:56:51 -08:00
Carl Worth
c2509f8a72 Add skip list implementation (many thanks to Keith Packard)
The files here are copied directly from the standalone skiplist module
available from:

	git clone git://cworth.org/~cworth/skiplist

In particular the files come from the double branch and the following
commit on that branch:

	8b5a439c68e220cf1514d9b3141a1dbdce8af585

Also of interest is the original skiplist module hosted by Keith Packard
that is the original implementation on which these files were based.
Since the cworth/skiplist branched off of keithp's, Keith has also
now implemented a doubly-linked variant which might be interesting for
further simplification of the code. See:

	git clone git://keithp.com/git/skiplist

and the double-link branch there.
2006-11-22 16:56:50 -08:00
Dan Amelang
11d21dbaa3 Change _cairo_matrix_to_pixman_matrix to use a pixman_transform_t as the template, thus avoiding a forced memcpy 2006-11-22 16:25:54 -08:00
Dan Amelang
8a5e296239 Optimize _cairo_matrix_to_pixman_matrix for the common case of an identity matrix 2006-11-22 16:25:54 -08:00
Dan Amelang
b7cd46ddc2 Add and incorporate _cairo_gstate_transform_glyphs_to_backend
After changing _cairo_gstate_show_glyphs and _cairo_gstate_glyph_path to use
this function, we see a significant speedup due to the elimination of redundant
FP calculations.
2006-11-22 16:25:54 -08:00
Dan Amelang
6cfb4a01e0 Refactor _cairo_matrix_is_integer_translation
Now that we have _cairo_matrix_is_translation, we can change
_cairo_matrix_is_integer_translation to use it and thus reduce code
duplication.
2006-11-22 16:25:54 -08:00
Dan Amelang
ca79307bdf Add _cairo_matrix_is_translation 2006-11-22 16:25:54 -08:00
Daniel Amelang
57fba8d9b6 Replace existing rounding code with _cairo_lround 2006-11-22 16:25:53 -08:00
Daniel Amelang
efb483c3a3 Add _cairo_lround for much faster rounding
This function uses the same "magic number" approach as _cairo_fixed_from_double.
2006-11-22 16:25:53 -08:00
Behdad Esfahbod
eaaeba170d [SVG] Fix compiler warning
cairo-svg-surface.c:980: warning: 'id' might be used uninitialized in this function
2006-11-21 19:05:16 -05:00
Behdad Esfahbod
c6fceb6721 [PS] Rename n_glyphs to num_glyphs_unsigned
Follow-up on my previous commit.  Use a more descriptive name to avoid
confusion between n_glyphs and num_glyphs.
2006-11-21 17:52:58 -05:00
Behdad Esfahbod
75eeb88976 [PS] Eliminate compiler warnings about unoptimizable loops
An innocient-looking loop like this:

  for (j = 0; j <= last; j++)
    something();

cannot be optimized, because it may loop forever!
Imagine the case that last is MAXINT, the loop will never end.  The correct
way to write it is:

  for (j = 0; j < last+1; j++)
    something();

In this case, if last is MAXINT, the loop will never run.  Not correct, but
better than looping forever.

Still better would be to correctly handle the MAXINT case (even though it
doesn't make any sense to show MAXINT number of glyphs in one operation!)  To
do that, we can use the fact that the input num_glyphs is a signed.  If
there is one good thing about using signed int as input length, it's that you
can use an unsigned looping variable to avoid looping forever.  That is
exactly what this patch does.
2006-11-21 12:11:19 -05:00
Emmanuel Pacaud
2dbb3dfd5f SVG: plug a memory leak
What's the point in creating a memory stream if we overload the
pointer a couple of lines below ?
2006-11-21 14:43:43 +01:00
Behdad Esfahbod
12f8718a3e [SVG] Define enum _cairo_svg_version. 2006-11-21 00:22:19 -05:00
Carl Worth
e5bd21136c Add const qualifier to cairo_path_t* parameter of cairo_append_path 2006-11-20 09:36:10 -08:00