Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Issue 23643003: ImageBuffer-less SVG masking and clipping. (Closed)

Created:
7 years, 3 months ago by f(malita)
Modified:
7 years, 3 months ago
CC:
blink-reviews, jamesr, eae+blinkwatch, leviw+renderwatch, danakj, blink-layers+watch_chromium.org, dglazkov+blink, Rik, jchaffraix+rendering, pdr, Stephen Chennney, jeez, reed1
Visibility:
Public.

Description

ImageBuffer-less SVG masking and clipping. This CL refactors the SVG clipping and masking logic using Skia saveLayer() operations instead of explicitly allocated ImageBuffers. The masking process involves two layers: * a mask layer, where the mask shapes are drawn and which is composited into the backdrop layer using regular SrcOver transfer mode. * a content layer, where the content to-be-masked is drawn and which is composited into the mask layer using SrcIn transfer mode. The sequence of operations: - saveLayer(SrcOver) - draw mask shapes - saveLayer(SrcIn) - draw content - restoreLayer(SrcIn) (content gets masked by the mask layer content) - restoreLayer(SrcOver) (the now-masked content is blended into the backdrop) For luminance masks, a custom Skia transfer mode wrapper (SkLumaMaskXfermode) is used instead of regular SrcIn. If needed, mask color space conversion is handled using an SkTableColorFilter. As far as the number of allocated off-screen buffers goes, the two approaches are equivalent: 2 SK layers vs. 1 SK layer + 1 ImageBuffer previously. But the new implementation has several advantages: * off-screen buffer allocation is now handled by Skia at rasterization time, when the true resolution is known - this fixes various problems related to impl-side painting on HiDPI devices (due to mask rasterization at record time). * masks are drawn directly into the target canvas, using the coordinate system already in place - this avoids pixel snapping artifacts due to integral ImageBuffer sizing. * reduced memory utilization - we are no longer holding SVG mask/clip bitmaps indefinitely in Blink. * color space conversion and luminance calculation are handled more efficiently using native Skia constructs instead of additional ImageBuffer data copies/traversals. * general code cleanup - GraphicsContext no longer needs to track an imgbuffer clip as part of its state, and several related utility methods can be removed. One possible downside: we are losing the ability to cache mask ImageBuffers in Blink, which may have a negative performance impact under certain conditions (static mask reused frequently due to constantly re-painting a dynamic target). There are plans to add caching capabilities in Skia to compensate for this. 23 pixel tests require rebaselining due to minor blending/rounding differences. R=pdr@chromium.org,schenney@chromium.org,dschulze@chromium.org,senorblanco@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=156928

Patch Set 1 #

Patch Set 2 : Self review. #

Patch Set 3 : Removed Linux rebaselines. #

Total comments: 26

Patch Set 4 : Updated per review comments. #

Total comments: 3

Patch Set 5 : Rebased + minor cleanup. #

Patch Set 6 : Re-uploading set 5 (last upload crashed) #

Patch Set 7 : Fix the Win build. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+339 lines, -368 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 2 chunks +27 lines, -1 line 0 comments Download
M Source/core/platform/graphics/CrossfadeGeneratedImage.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/core/platform/graphics/GraphicsContext.h View 1 2 3 5 chunks +6 lines, -9 lines 0 comments Download
M Source/core/platform/graphics/GraphicsContext.cpp View 1 2 3 4 9 chunks +33 lines, -65 lines 0 comments Download
M Source/core/platform/graphics/GraphicsContextState.h View 1 2 3 4 chunks +3 lines, -8 lines 0 comments Download
M Source/core/platform/graphics/GraphicsContextTest.cpp View 1 2 3 8 chunks +10 lines, -21 lines 0 comments Download
M Source/core/platform/graphics/GraphicsTypes.h View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/platform/graphics/ImageBuffer.h View 1 2 3 2 chunks +2 lines, -4 lines 0 comments Download
M Source/core/platform/graphics/ImageBuffer.cpp View 1 2 3 4 chunks +49 lines, -47 lines 0 comments Download
M Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp View 1 chunk +2 lines, -11 lines 0 comments Download
M Source/core/rendering/InlineFlowBox.cpp View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/rendering/RenderBox.cpp View 1 2 3 4 3 chunks +3 lines, -3 lines 0 comments Download
M Source/core/rendering/RenderBoxModelObject.cpp View 1 2 3 4 2 chunks +3 lines, -3 lines 0 comments Download
M Source/core/rendering/RenderInline.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/RenderLayer.cpp View 1 2 3 3 chunks +10 lines, -2 lines 0 comments Download
M Source/core/rendering/RenderObject.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/svg/RenderSVGResourceClipper.h View 1 2 3 3 chunks +14 lines, -5 lines 0 comments Download
M Source/core/rendering/svg/RenderSVGResourceClipper.cpp View 1 2 3 6 chunks +75 lines, -70 lines 0 comments Download
M Source/core/rendering/svg/RenderSVGResourceMasker.h View 1 3 chunks +3 lines, -7 lines 0 comments Download
M Source/core/rendering/svg/RenderSVGResourceMasker.cpp View 1 2 3 2 chunks +46 lines, -67 lines 0 comments Download
M Source/core/rendering/svg/RenderSVGResourcePattern.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/svg/SVGRenderingContext.h View 1 2 3 4 6 chunks +11 lines, -4 lines 0 comments Download
M Source/core/rendering/svg/SVGRenderingContext.cpp View 1 2 3 4 6 chunks +29 lines, -30 lines 0 comments Download
M Source/core/svg/graphics/SVGImage.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M Source/core/svg/graphics/filters/SVGFEImage.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/web/tests/TransparencyWinTest.cpp View 1 2 3 4 5 6 3 chunks +3 lines, -3 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
f(malita)
7 years, 3 months ago (2013-08-28 00:05:44 UTC) #1
f(malita)
I removed all image diffs to see if that makes the trybots happy. They can ...
7 years, 3 months ago (2013-08-28 00:11:54 UTC) #2
pdr.
This is fantastic work! https://codereview.chromium.org/23643003/diff/23001/Source/core/platform/graphics/ImageBuffer.cpp File Source/core/platform/graphics/ImageBuffer.cpp (right): https://codereview.chromium.org/23643003/diff/23001/Source/core/platform/graphics/ImageBuffer.cpp#newcode272 Source/core/platform/graphics/ImageBuffer.cpp:272: DEFINE_STATIC_LOCAL(Vector<uint8_t>, linearRgbLUT, ()); Since you ...
7 years, 3 months ago (2013-08-28 03:32:35 UTC) #3
krit
On 2013/08/28 00:05:44, Florin Malita wrote: Really great work. That means SVG masking will be ...
7 years, 3 months ago (2013-08-28 09:36:26 UTC) #4
f(malita)
On 2013/08/28 09:36:26, krit wrote: > On 2013/08/28 00:05:44, Florin Malita wrote: > > Really ...
7 years, 3 months ago (2013-08-28 13:26:46 UTC) #5
Stephen White
https://codereview.chromium.org/23643003/diff/23001/Source/core/platform/graphics/ImageBuffer.cpp File Source/core/platform/graphics/ImageBuffer.cpp (right): https://codereview.chromium.org/23643003/diff/23001/Source/core/platform/graphics/ImageBuffer.cpp#newcode336 Source/core/platform/graphics/ImageBuffer.cpp:336: PassRefPtr<SkColorFilter> ImageBuffer::createColorSpaceFilter(ColorSpace srcColorSpace, Maybe at some point we can ...
7 years, 3 months ago (2013-08-28 14:11:10 UTC) #6
f(malita)
https://codereview.chromium.org/23643003/diff/23001/Source/core/platform/graphics/ImageBuffer.cpp File Source/core/platform/graphics/ImageBuffer.cpp (right): https://codereview.chromium.org/23643003/diff/23001/Source/core/platform/graphics/ImageBuffer.cpp#newcode272 Source/core/platform/graphics/ImageBuffer.cpp:272: DEFINE_STATIC_LOCAL(Vector<uint8_t>, linearRgbLUT, ()); On 2013/08/28 03:32:36, pdr wrote: > ...
7 years, 3 months ago (2013-08-28 19:54:38 UTC) #7
Stephen White
I'm OK with this, but will leave for others. https://codereview.chromium.org/23643003/diff/43001/Source/core/platform/graphics/GraphicsContext.cpp File Source/core/platform/graphics/GraphicsContext.cpp (right): https://codereview.chromium.org/23643003/diff/43001/Source/core/platform/graphics/GraphicsContext.cpp#newcode425 Source/core/platform/graphics/GraphicsContext.cpp:425: ...
7 years, 3 months ago (2013-08-28 20:16:12 UTC) #8
f(malita)
https://codereview.chromium.org/23643003/diff/43001/Source/core/platform/graphics/GraphicsContext.cpp File Source/core/platform/graphics/GraphicsContext.cpp (right): https://codereview.chromium.org/23643003/diff/43001/Source/core/platform/graphics/GraphicsContext.cpp#newcode425 Source/core/platform/graphics/GraphicsContext.cpp:425: saveLayer(skBounds, &layerPaint, saveFlags); On 2013/08/28 20:16:12, Stephen White wrote: ...
7 years, 3 months ago (2013-08-28 20:24:03 UTC) #9
pdr.
On 2013/08/28 20:24:03, Florin Malita wrote: > https://codereview.chromium.org/23643003/diff/43001/Source/core/platform/graphics/GraphicsContext.cpp > File Source/core/platform/graphics/GraphicsContext.cpp (right): > > https://codereview.chromium.org/23643003/diff/43001/Source/core/platform/graphics/GraphicsContext.cpp#newcode425 ...
7 years, 3 months ago (2013-08-28 23:42:35 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/fmalita@chromium.org/23643003/47001
7 years, 3 months ago (2013-08-29 14:03:52 UTC) #11
commit-bot: I haz the power
Retried try job too often on blink_presubmit for step(s) presubmit http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=blink_presubmit&number=6206
7 years, 3 months ago (2013-08-29 14:16:52 UTC) #12
pfeldman
Source/web rubber stamp lgtm
7 years, 3 months ago (2013-08-29 14:24:43 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/fmalita@chromium.org/23643003/47001
7 years, 3 months ago (2013-08-29 14:26:43 UTC) #14
commit-bot: I haz the power
7 years, 3 months ago (2013-08-29 16:52:21 UTC) #15
Message was sent while issue was closed.
Change committed as 156928

Powered by Google App Engine
This is Rietveld 408576698