Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(444)

Issue 5981063: Fix shadow blurs of RGBA bitmaps

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years ago by Stephen White
Modified:
12 years ago
CC:
skia-review_googlegroups.com
Base URL:
http://skia.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Shadow blurs of RGBA bitmaps currently apply the bitmap alpha after blurring, which leads to incorrect results. Instead, we extract the alpha before the blur. There was already a special case for A8 masks; this code simply extends it to ARGB8 masks with transform-only matrices. This restriction is OK for blur masks, which are always drawn 1:1, but could be extended to scaled/rotated masks if required. This patch does the raster case; an upcoming patch will handle the GPU case.

Patch Set 1 #

Total comments: 2

Patch Set 2 : fixes per tom's comments; handle zoom case; cleanup #

Total comments: 2

Patch Set 3 : Don't set fInitialized twice #

Patch Set 4 : Only drawBitmapAsMask() w/RGBA when a mask filter is active #

Patch Set 5 : Handle SkBitmapProcShaders in drawPath() #

Unified diffs Side-by-side diffs Delta from patch set Stats (+116 lines, -34 lines) Patch
M gm/shadows.cpp View 1 2 3 4 4 chunks +55 lines, -5 lines 0 comments Download
M include/core/SkDraw.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M include/core/SkMaskFilter.h View 1 2 3 4 1 chunk +4 lines, -3 lines 0 comments Download
M src/core/SkBlitter_A8.cpp View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
M src/core/SkDraw.cpp View 1 2 3 4 7 chunks +33 lines, -14 lines 0 comments Download
M src/core/SkMaskFilter.cpp View 1 2 3 4 4 chunks +14 lines, -6 lines 0 comments Download
M src/core/SkRasterizer.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/effects/SkLayerRasterizer.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/gpu/SkGpuDevice.cpp View 1 2 3 4 2 chunks +3 lines, -3 lines 0 comments Download

Messages

Total messages: 18
Stephen White
12 years ago (2012-04-04 22:11:59 UTC) #1
TomH
http://codereview.appspot.com/5981063/diff/1/gm/shadows.cpp File gm/shadows.cpp (right): http://codereview.appspot.com/5981063/diff/1/gm/shadows.cpp#newcode44 gm/shadows.cpp:44: canvas.drawRect(SkRect::MakeXYWH(0, 10, 10, 10), p); IIRC we're trying to ...
12 years ago (2012-04-05 14:25:00 UTC) #2
bsalomon
On 2012/04/04 22:11:59, Stephen White wrote: TBH I don't feel qualified to review this change. ...
12 years ago (2012-04-05 14:34:11 UTC) #3
Stephen White
On 2012/04/05 14:34:11, bsalomon wrote: > On 2012/04/04 22:11:59, Stephen White wrote: > > TBH ...
12 years ago (2012-04-05 15:35:34 UTC) #4
bsalomon
On 2012/04/05 15:35:34, Stephen White wrote: > On 2012/04/05 14:34:11, bsalomon wrote: > > On ...
12 years ago (2012-04-05 15:54:57 UTC) #5
Stephen White
http://codereview.appspot.com/5981063/diff/1/gm/shadows.cpp File gm/shadows.cpp (right): http://codereview.appspot.com/5981063/diff/1/gm/shadows.cpp#newcode44 gm/shadows.cpp:44: canvas.drawRect(SkRect::MakeXYWH(0, 10, 10, 10), p); On 2012/04/05 14:25:00, TomH ...
12 years ago (2012-04-05 17:20:10 UTC) #6
Stephen White
On 2012/04/05 15:54:57, bsalomon wrote: > It's a shame we have to copy out the ...
12 years ago (2012-04-05 17:32:18 UTC) #7
Steve VanDeBogart
On 2012/04/05 17:32:18, Stephen White wrote: > On 2012/04/05 15:54:57, bsalomon wrote: > > It's ...
12 years ago (2012-04-05 17:36:48 UTC) #8
reed1
This is a tricky area. drawBitmap(bm, paing) needs to always draw the same as drawRect(bm_bounds, ...
12 years ago (2012-04-10 14:06:20 UTC) #9
Stephen White
On 2012/04/10 14:06:20, reed1 wrote: > This is a tricky area. > > drawBitmap(bm, paing) ...
12 years ago (2012-04-10 15:58:56 UTC) #10
reed1
Yes and no. The invariant I stated doesn't hold, but alpha-only bitmaps are themselves breaking ...
12 years ago (2012-04-10 18:19:00 UTC) #11
Stephen White
On 2012/04/10 18:19:00, reed1 wrote: > Yes and no. > > The invariant I stated ...
12 years ago (2012-04-11 14:44:52 UTC) #12
reed1
We could change skia's architecture to always sample the shader/color when computing the mask, but ...
12 years ago (2012-04-11 14:59:53 UTC) #13
Stephen White
On 2012/04/11 14:59:53, reed1 wrote: > We could change skia's architecture to always sample the ...
12 years ago (2012-04-11 15:46:43 UTC) #14
junov1
http://codereview.appspot.com/5981063/diff/8001/src/core/SkDraw.cpp File src/core/SkDraw.cpp (right): http://codereview.appspot.com/5981063/diff/8001/src/core/SkDraw.cpp#newcode1065 src/core/SkDraw.cpp:1065: for (int y = 0; y < height; y++) ...
12 years ago (2012-04-11 17:16:22 UTC) #15
junov1
http://codereview.appspot.com/5981063/diff/8001/src/core/SkDraw.cpp File src/core/SkDraw.cpp (right): http://codereview.appspot.com/5981063/diff/8001/src/core/SkDraw.cpp#newcode1065 src/core/SkDraw.cpp:1065: for (int y = 0; y < height; y++) ...
12 years ago (2012-04-11 17:24:34 UTC) #16
Stephen White
This version handles SkBitmapProcShader, by deferring the blitter choice and passing the shader through to ...
12 years ago (2012-04-11 20:02:15 UTC) #17
Stephen White
12 years ago (2012-04-11 20:12:32 UTC) #18
On 2012/04/11 20:02:15, Stephen White wrote:

> I do think the change in SkBlitter_A8.cpp is good, and perhaps should be
pulled
> out:  if there's no xfermode, SkA8_Shader_Blitter::blitMask() does nothing!
> (took me a while to figure that one out..)

... although it should probably be doing a blend, instead of a straight copy.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b