RESOLVED FIXED Bug 82564
[chromium] Remove SkCanvas::LayerIter use from OpaqueRegionSkia
https://bugs.webkit.org/show_bug.cgi?id=82564
Summary [chromium] Remove SkCanvas::LayerIter use from OpaqueRegionSkia
Dana Jansens
Reported 2012-03-28 19:56:19 PDT
[chromium] Remove SkCanvas::LayerIter use from OpaqueRegionSkia
Attachments
Patch (23.41 KB, patch)
2012-03-28 20:19 PDT, Dana Jansens
no flags
Patch (23.60 KB, patch)
2012-03-29 15:05 PDT, Dana Jansens
no flags
Patch (23.56 KB, patch)
2012-03-29 19:25 PDT, Dana Jansens
no flags
Patch (28.34 KB, patch)
2012-03-30 15:12 PDT, Dana Jansens
no flags
Patch (28.41 KB, patch)
2012-04-02 17:22 PDT, Dana Jansens
no flags
Dana Jansens
Comment 1 2012-03-28 20:04:51 PDT
This is required for per-tile-painting in the renderer.
Dana Jansens
Comment 2 2012-03-28 20:17:03 PDT
I attempted to do this a few times before I found the LayerIter and felt like we got very solid with it. But I'm sorry to say that it doesn't work with SkPictureRecord, and it is going to leave the SkCanvas public API so we can't rely on it. But I think I'm in a spot where I can do a better job of this now. :) We have to change any code that does saveLayer() on the canvas underlying the GraphicsContext, to instead do it through the platformContext. And PlatformContextSkia implements imageClipping through the saveLayer()/restore(), so we need to track what it is doing explicitly as well.
Dana Jansens
Comment 3 2012-03-28 20:19:12 PDT
Dana Jansens
Comment 4 2012-03-28 20:20:34 PDT
*** Bug 81723 has been marked as a duplicate of this bug. ***
Stephen White
Comment 5 2012-03-29 14:42:29 PDT
Comment on attachment 134485 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=134485&action=review > Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp:284 > &layerPaint, > static_cast<SkCanvas::SaveFlags>(SkCanvas::kHasAlphaLayer_SaveFlag | > SkCanvas::kFullColorLayer_SaveFlag)); > + platformContext()->didSaveLayer(layerPaint); Couldn't this call platformContext()->saveLayer() (and skip the "did" here)? > Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp:292 > + platformContext()->didRestoreLayer(); > platformContext()->canvas()->restore(); Same here: couldn't this call platformContext()->restore()?
Dana Jansens
Comment 6 2012-03-29 14:44:22 PDT
Comment on attachment 134485 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=134485&action=review >> Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp:284 >> + platformContext()->didSaveLayer(layerPaint); > > Couldn't this call platformContext()->saveLayer() (and skip the "did" here)? yes! i added that later.. good idea, will do.
Dana Jansens
Comment 7 2012-03-29 15:05:53 PDT
Dana Jansens
Comment 8 2012-03-29 19:25:05 PDT
Created attachment 134712 [details] Patch While it is not in practice now null, the SkPaint* for saveLayer() could be null, so fixing this patch to work correctly in the face of that. FYI I'm working on a followup to use SKDrawLoopers more intelligently instead of just bailing. I say this cuz it's going to mess up the stack in this patch, but it's a similar idea so fair to do this first I think.
Stephen White
Comment 9 2012-03-30 08:35:00 PDT
Comment on attachment 134712 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=134712&action=review > Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp:107 > + SkRect m_previousImageBufferClipRect; > + SkRect m_totalImageBufferClipRect; > + SkRect m_previousImageBufferOpaqueRect; > + SkRect m_totalImageBufferOpaqueRect; Since this seems to be specific to the opaque region tracker, perhaps it should be moved there?
Dana Jansens
Comment 10 2012-03-30 15:12:44 PDT
Dana Jansens
Comment 11 2012-03-30 15:22:31 PDT
- Added the bounds to the PlatformContextSkia::saveLayer() method. - Save the SkPaints in the stack in OpaqueRegionSkia. - Moved the data for the image clip/mask into the OpaqueRegionSkia stack. - Fixed the logic around preservesOpaque and added a unit test to verify it.
Stephen White
Comment 12 2012-04-02 17:08:03 PDT
Comment on attachment 134897 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=134897&action=review > Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp:234 > + m_opaqueRegion.pushCanvasLayer(paint); Shouldn't this be guarded by if (m_trackOpaqueRegion)? > Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp:242 > + m_opaqueRegion.pushCanvasLayer(paint); Same as above. > Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp:248 > + m_opaqueRegion.popCanvasLayer(); Same as above. > Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp:277 > + SkRect opaqueRect = bitmap->isOpaque() ? m_state->m_clip : SkRect::MakeEmpty(); > + m_opaqueRegion.setImageMask(opaqueRect); Same as above.
Dana Jansens
Comment 13 2012-04-02 17:22:08 PDT
Created attachment 135239 [details] Patch done x4 !
Stephen White
Comment 14 2012-04-02 17:23:33 PDT
Comment on attachment 135239 [details] Patch OK. r=me
WebKit Review Bot
Comment 15 2012-04-02 20:31:41 PDT
Comment on attachment 135239 [details] Patch Clearing flags on attachment: 135239 Committed r112980: <http://trac.webkit.org/changeset/112980>
WebKit Review Bot
Comment 16 2012-04-02 20:31:46 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.