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
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
Optimizes EXTEND_REPEAT, especially when DDBs are in use through the
use of PatBlt or manually expanding out the repeated blits (up to a
limit). Will still fall back to fallback code as necessary.
Make sure that all operations are correct (the operations chosen
are listed in cairo-win32-surface.c); in particular, deal with the extra
byte present in FORMAT_RGB24 surfaces correctly.
Also adds support for calling StretchDIBits to draw RGB24
cairo_image_surfaces directly.
It turns out that all of the callers want a box anyway, so this
simplfies the code in addition to being more honest to the name.
(For those new to the convention, a "box" is an (x1,y2),(x2,y2)
pair while a "rectangle" is an (x,y),(width,height) pair.)