<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#ffffff">
Dear all,<br>
<br>
I'm trying to solve clipping bug in current master branch of cairo.<br>
As I mentioned before from here <a
href="http://lists.freedesktop.org/archives/cairo/2011-June/022046.html">http://lists.freedesktop.org/archives/cairo/2011-June/022046.html,</a><br>
there're some mismatches on making decision to use clip surface or
not.<br>
<br>
Current implementation of _cairo_image_surface_fill() is consist of
following stages.<br>
<br>
1. Calculate clip boxes.<br>
2. Set clip boxes as limit boxes.<br>
3. Convert given path to desired geometry.<br>
4. _clip_and_composite() resulting geometry. (boxes or polygon)<br>
<br>
Our final geometry which will be given to _clip_and_composite() may
or may not be clipped. If clip can be reduced to a set of boxes, we
can assume that our geometry is properly clipped. If not, only
extent will be bounded and we should use clip mask surface. Current
_clip_and_composite() determines this by extracting region from a
clip, i.e. _cairo_clip_get_region() succeed or not. So, if clip
cannot be reduced to a set of boxes, _cairo_clip_get_region() should
also fail. But unfortunately we cannot assume that.
_cairo_clip_to_boxes() internally try to get clip boxes using
_cairo_clip_get_boxes(). If it fails, it just returns clip extent.
And _cairo_clip_get_boxes() will fail if there're any
non-rectilinear paths in linked list. But _cairo_clip_get_region()
will succeed if intersection between non-rectilinear and rectilinear
paths can be reduced to an aligned box. One very simple example for
this, you can think about clip which is consist of two paths which
will be intersected, a rectangle contained in a round rectangle.
_cairo_clip_get_boxes() will fail, but _cairo_clip_get_region() will
succeed.<br>
<br>
I have already fixed this but maybe you guys can help me making a
decision between two choices.<br>
<br>
Plan A : Use _cairo_clip_get_region on stage 1 (instead of
_cairo_clip_to_boxes)<br>
Plan B : Use _cairo_clip_get_boxes on stage 4 (instead of
_cairo_clip_get_region)<br>
<br>
Indeed, I need more work on plan B due to handling of unbounded ops
and anti-alias.<br>
(It seems that current implementation also does not handle those
cases properly)<br>
<br>
And one last question.<br>
Are there any plans to implement geometry clipping (to avoid using
clip mask) by polygon clipper or tessellator or scan rasterizer?<br>
<br>
Thanks in advance.<br>
<br>
--<br>
Best Regards,<br>
Taekyun Kim<br>
</body>
</html>