[cairo] cairo_win32_surface_create api change
otaylor at redhat.com
Wed Dec 7 21:45:16 PST 2005
On Mon, 2005-12-05 at 12:16 -0800, Stuart Parmenter wrote:
> On 12/2/05, Owen Taylor <otaylor at redhat.com> wrote:
> > On Thu, 2005-12-01 at 14:54 -0800, Stuart Parmenter wrote:
> > > Here is my patch.
> > >
> > > The things "set up so that the width/height *are not* necessary" are
> > > broken it turns out. You are using the clipbox as the width/height of
> > > the surface which will almost always be wrong if you're using
> > > clipping. Backend functions such as get_extents need to actually
> > > return the proper values for things to work. Both of these tests hit
> > > code paths that use get_extents after setting the clip region to null
> > > resulting in a 0,0,0,0 return from get_extents which ends up clipping
> > > out lots of stuff, which isn't really what you want.
> > Without an actual description of the code paths that aren't working,
> > it's hard for me to propose the correct fix, but the extents of a
> > DIB or DDB are determinable without extra API and on general grounds
> > having a drawing operation depend on the extents of a window almost
> > certainly indicates that something is wrong.
> > Regards,
> > Owen
> I noticed that I only sent this to Owen previously. Resending to list.
> Run the tests I said previously and put some break points in
> _cairo_win32_surface_get_extents and then see what happens when you
> get 0,0,0,0 returned. Or simply grep for cairo_surface_get_extents
> and look at all the callers.
I spent some time tracking down the problem with trap-clip.c on win32,
and it wasn't really related to the win32 code at all.
Note that _cairo_surface_get_extents() is possibly dependent
on the clip ... this has always been the case and was intended to be
the case, though it isn't entirely clear from the function docs.
All the code calling _cairo_surface_get_extents() expects this, but the
problem is that the call in _cairo_clip_intersect_mask() is calling
_cairo_surface_get_extents() on a surface *where the clip isn't
up-to-date*. We actually set the clip on the surface lazily ... and
only update it before actually drawing. The clip in trap-clip.c ends
up being a clip from a previous grid square and has no intersection
with the current code.
Adding this updating code in cairo_gstate_clip() as in the attached
patch fixes the problem, but might exact an unnecessary performance
penalty. It might be better to do it instead in
_cairo_clip_intersect_mask() right before calling get_extents().
The issue in self-copy may be entirely different ... I haven't looked
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 846 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20051208/00cac5cb/cairo-clip-restore.bin
More information about the cairo