Commit graph

25 commits

Author SHA1 Message Date
Uli Schlachter
b7f313a8d2 fix warning: variable X might be clobbered by 'longjmp'
According to "man setjmp", one possible way to avoid variable clobbering
is to declare them as volatile. Thus, this commit turns the variables
that are changed between setjmp() and longjmp() and whose values are
still needed after setjmp() returned the second time into volatile
variables.

The warning in cairo-bentley-ottmann-rectangular.c is worked around by
not initializing the variable before setjmp(). To be honest, I don't
understand why the compiler warns here at all since the value of update
is clearly not used after setjmp()'s second return.

This commit re-fixes the warnings that were reintroduced in commit
82f40285 which reverted b092b63.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
2018-01-13 11:30:50 +01:00
Uli Schlachter
82f4028532 Revert "fix warning: variable X might be clobbered by 'longjmp'"
This reverts commit b092b63119 which
introduced a wrapper function around setjmp(). To quote from man setjmp:

  If the function which called setjmp() returns before longjmp() is
  called, the behavior is undefined.  Some kind of subtle or unsubtle
  chaos is sure to result.

Since after the above commit setjmp() is called from the wrapper
function, the result might or might not work, depending on compiler
settings. If the setjmp() wrapper is not inlined, then the state of the
stack after longjmp() will likely be garbage.
2017-12-23 13:04:59 +01:00
Adrian Johnson
b092b63119 fix warning: variable X might be clobbered by 'longjmp'
Move calls to setjmp into separate function to avoid clobbering
local variables.
2017-10-21 13:08:30 +10:30
Bryce Harrington
576bb3ffee If more than one trap is passed in then it's guaranteed that the
returned traps will have their left edge to the left of their right
edge, but if only one trap is passed in then the function always returns
without doing anything.  This results in incorrect rendering of SVG
paths with more than one subpath.

Currently calls to _cairo_bentley_ottmann_tessellate_rectangular_traps
are guarded by traps.has_intersections checks, so this is only a
theoretical bug.  But we'll eliminate the potential of the bug by
making the left side to be left of the right side, similar to what was
done in _cairo_bentley_ottmann_tessellate_boxes (commit 11b6c49c).

Patch authored by Tom Klein for Mozilla.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=90984
Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=853889
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-27 18:20:07 -07:00
Chris Wilson
c09be68112 bo-rectangular: Emit subsummed boxes for overlapping edges
Fixes bug-bo-collins

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49446
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-23 11:50:34 +01:00
Chris Wilson
afa180935b Split cairo-combsort-privates into struct+inlines
References: https://bugs.freedesktop.org/show_bug.cgi?id=48577
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-04-19 12:22:07 +01:00
Chris Wilson
af9fbd176b Introduce a new compositor architecture
Having spent the last dev cycle looking at how we could specialize the
compositors for various backends, we once again look for the
commonalities in order to reduce the duplication. In part this is
motivated by the idea that spans is a good interface for both the
existent GL backend and pixman, and so they deserve a dedicated
compositor. xcb/xlib target an identical rendering system and so they
should be using the same compositor, and it should be possible to run
that same compositor locally against pixman to generate reference tests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

P.S. This brings massive upheaval (read breakage) I've tried delaying in
order to fix as many things as possible but now this one patch does far,
far, far too much. Apologies in advance for breaking your favourite
backend, but trust me in that the end result will be much better. :)
2011-09-12 08:29:48 +01:00
Chris Wilson
9d5d46e846 bo-rect: One step too far...
Fixes a1-rasterisation-rectangles.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 11:08:58 +01:00
Chris Wilson
ee001b0b9f bo-rect: Micro-optimisation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 09:31:53 +01:00
Chris Wilson
17e34b6eab bo-rectangular: Correctly mergesort a doubly-linked list
Saves having to fixup the pointers afterwards by only having to update
them on the list boundaries during merge.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 17:59:08 +01:00
Chris Wilson
a4e4e2bdd7 bo-rectangular: Use a mergesort to speedup insertion
However, this is only useful for inserting multiple boxes within the
pixel, so we maintain the cached insert cursor as this speeds up the
general case (and aides this optimisation as well).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 17:08:02 +01:00
Chris Wilson
014e5e5ec1 bo-rectangular: Eliminate allocation for pqueue
Since we only allocate a pointer to the rectangle after it is started
and so decoupled from the start queue, we reuse the memory allocated for
the start queue for the stop binary heap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-09 16:06:50 +01:00
Chris Wilson
5ab1eced5f bo-rectangular: handle in==out specifically for the single box case
In this case we do not need to copy anything, but may still need to
re-orientate the box.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-05 09:48:14 +01:00
Chris Wilson
c4f4c57261 bo-rectangular: perform an incremental sort
Bucketing the rectangles together on their top-scanline and then sorting
within that scanline is significantly faster for dragon despite the extra
passes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-01 12:08:55 +01:00
Chris Wilson
b132fae5e8 clip: Rudimentary support for clip-polygon extraction
Step 1, fix the failings sighted recently by tracking clip-boxes as an
explicit property of the clipping and of composition.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-19 21:14:34 +01:00
Taekyun Kim
8e7589abcc tessellator: Fixed to produce an output box with x1 <= x2 for single box input
Winding of a box is toggled by swapping x1, x2 coordinates. So
we have to swap those coordinate rather than just copying.

Many routines assume that boxes are left-top to right-bottom
convention. So tessellator should produce such output boxes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-15 16:13:15 +01:00
Taekyun Kim
6edc5ca55f tessellator: Fix boxes tessellator to handle num_boxes <= 1 correctly
We cannot assume that parameter 'out' is empty. So we should make it
empty before returning CAIRO_STATUS_SUCCESS when 'in' contains no boxes.

When 'in' contains a single box, we should copy 'in' to 'out' rather
than just returning CAIRO_STATUS_SUCCESS.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-08 09:59:42 +01:00
Andrea Canciani
b8a7f8621a Update FSF address
I updated the Free Software Foundation address using the following script.

for i in $(git grep Temple | cut -d: -f1 )
do
  sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i"
done

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
2010-04-27 11:13:38 +02:00
Chris Wilson
6ab5f89571 bo-rectangular: Fix incorrect skipping of colinear eo edges
Fixes test/bug-bo-rectangular

After skipping edges, we need to bd careful to only terminate the box on
a closing edge.
2010-02-23 08:54:58 +00:00
Chris Wilson
9f46bad301 bo-rectangular: Prevent invalid read during edge traversal
Benjamin Otte tracked down an invalid read triggered by WebKit. The
cause is that we attempt to dereference the list_head as an edge as we
failed to check that during the skipping of colinear edges we advanced
to the end, under the false assumption that there would always
be a closing edge in a rectangle. This assumption is broken if the tail
rectangles having colinear right edges.
2010-02-22 14:33:34 +00:00
Chris Wilson
b83f1c347d boxes: Enable tessellation
Extend the special case rectangular tessellator to handle generation of
cairo_boxes_t.
2010-01-22 23:01:51 +00:00
Chris Wilson
c50c8b90c0 Move _cairo_error() to a standalone header
A pending commit will want to include some utility code from cairo and
so we need to extricate the error handling from the PLT symbol hiding.
2010-01-22 22:30:43 +00:00
Chris Wilson
1c4f61ec50 [tessellator] Invalid conversion of list head to edge.
When scanning for collinear right edges, we need to check that we do not
go beyond the end of the array.
2009-09-29 03:03:51 +01:00
Chris Wilson
a6bcb6260e [bo-rectangular] Fix assertion failure with insertion sort
We remember the location of the last insert as the next edge is likely to
be nearby. However, we need to be careful when the pointer rests upon the
HEAD and ensure that we begin the search from the appropriate end.
2009-08-30 10:09:51 +01:00
Chris Wilson
ab035ab2c7 [tessellate] Rectangular special case
Add an even simpler sweep-line tessellator for rectangular trapezoids (as
produced by the rectilinear stoker and box filler).

This is so simple it even outperforms pixman's region validation code for the
purposes of path-to-region conversion.
2009-08-29 08:08:38 +01:00