[Webkit-unassigned] [Bug 60757] [CAIRO] Don't copy the surface before drawing it into the context in ShareableBitmap::paint()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri May 13 12:19:43 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=60757





--- Comment #5 from Martin Robinson <mrobinson at webkit.org>  2011-05-13 12:19:43 PST ---
(In reply to comment #4)
> > Notice that in ShareableBitmapCG.cpp (the CG version of this file), the code does a copy of the image. Perhaps that this is just to support self copies though. If that's the case, it would be better to support self-copies by detecting when the target of the context is the same as the ShareableBitmap. Please contect the Apple team to see what the correct behavior is here.
> 
> But we are creating a new surface and copying that new surface, CG copies the already existing image, I think, which is the same than simply create a new surface with the image data.

The documentation for CGBitmapContextCreateImage states: 

The CGImage object returned by this function is created by a copy operation. Subsequent changes to the bitmap graphics context do not affect the contents of the returned image. In some cases the copy operation actually follows copy-on-write semantics, so that the actual physical copy of the bits occur only if the underlying data in the bitmap graphics context is modified. As a consequence, you may want to use the resulting image and release it before you perform additional drawing into the bitmap graphics context. In this way, you can avoid the actual physical copy of the data.

In the case of Cairo, unless you explicitly create a copy of the original surface, all surfaces will be backed by the same block of data. Thus it seems the semantics of the blit could deviate if the ShareableBitmap is painting onto itself.

In my opinion, we should check with the authors of the CG version. If the bitmap will never do a self-paint we can make your optimization, otherwise we can optimize only when the backing surface of the GraphicsContext does not contain the same bytes as the ShareableBitmap.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list