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

Issue 920513003: Make filters use SkImage instead of SkBitmap

Created:
5 years, 10 months ago by Kimmo Kinnunen
Modified:
5 years, 9 months ago
Reviewers:
bsalomon, reed2, reed1
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Make filters use SkImage instead of SkBitmap Make filters use SkImage instead of SkBitmap. This way rendering of a device can be captured to a read-only snapshot. This replaces the usage of SkBaseDevice::accessBitmap. The SkBaseDevice::accessBitmap suffers from the problem that the returned bitmap refers to the backing store of the device. Thus if the device is further drawn to, the results are expected to be reflected to the reference returned by accessBitmap. This work is work towards making it possible to have render targets that are not neccessarily textures. Rather, when the render target rendering is needed, a snapshot should be taken. BUG=skia:3388

Patch Set 1 #

Patch Set 2 : #

Total comments: 4

Patch Set 3 : #

Patch Set 4 : rebase on top of https://chromiumcodereview.appspot.com/933043006/ #

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : #

Total comments: 2

Patch Set 8 : address review comments #

Patch Set 9 : rebase #

Patch Set 10 : rebase #

Patch Set 11 : rebase after separating drawImageAsSprite #

Patch Set 12 : rebase #

Patch Set 13 : rebase #

Patch Set 14 : rebase #

Patch Set 15 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+879 lines, -575 lines) Patch
M gm/imagefiltersbase.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +9 lines, -9 lines 0 comments Download
M gm/imagefiltersgraph.cpp View 1 2 3 4 2 chunks +11 lines, -7 lines 0 comments Download
M gyp/effects.gyp View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M include/core/SkCanvas.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download
M include/core/SkDevice.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +5 lines, -3 lines 0 comments Download
M include/core/SkImage.h View 1 2 3 4 5 1 chunk +34 lines, -0 lines 0 comments Download
M include/core/SkImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 9 chunks +20 lines, -19 lines 0 comments Download
M include/core/SkMatrixImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -2 lines 0 comments Download
M include/effects/SkBitmapSource.h View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M include/effects/SkBlurImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +6 lines, -4 lines 0 comments Download
M include/effects/SkColorFilterImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -2 lines 0 comments Download
M include/effects/SkComposeImageFilter.h View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M include/effects/SkDisplacementMapEffect.h View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +5 lines, -5 lines 0 comments Download
M include/effects/SkDropShadowImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -1 line 0 comments Download
M include/effects/SkMagnifierImageFilter.h View 1 2 3 4 1 chunk +3 lines, -2 lines 0 comments Download
M include/effects/SkMatrixConvolutionImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +4 lines, -2 lines 0 comments Download
M include/effects/SkMergeImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -2 lines 0 comments Download
M include/effects/SkMorphologyImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +16 lines, -12 lines 0 comments Download
M include/effects/SkOffsetImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -2 lines 0 comments Download
M include/effects/SkPictureImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -2 lines 0 comments Download
M include/effects/SkRectShaderImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -2 lines 0 comments Download
M include/effects/SkTestImageFilters.h View 1 2 1 chunk +3 lines, -2 lines 0 comments Download
M include/effects/SkTileImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -2 lines 0 comments Download
M include/effects/SkXfermodeImageFilter.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +4 lines, -5 lines 0 comments Download
M src/core/SkCanvas.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +15 lines, -34 lines 0 comments Download
M src/core/SkDevice.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download
M src/core/SkDeviceImageFilterProxy.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -2 lines 0 comments Download
M src/core/SkImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 14 chunks +78 lines, -47 lines 0 comments Download
M src/core/SkMatrixImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +12 lines, -8 lines 0 comments Download
M src/effects/SkAlphaThresholdFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 5 chunks +24 lines, -20 lines 0 comments Download
M src/effects/SkBitmapSource.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +16 lines, -6 lines 0 comments Download
M src/effects/SkBlurImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +44 lines, -27 lines 0 comments Download
M src/effects/SkColorFilterImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +10 lines, -6 lines 0 comments Download
M src/effects/SkComposeImageFilter.cpp View 1 2 3 1 chunk +4 lines, -4 lines 0 comments Download
M src/effects/SkDisplacementMapEffect.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +52 lines, -29 lines 0 comments Download
M src/effects/SkDropShadowImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +14 lines, -7 lines 0 comments Download
M src/effects/SkLightingImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +67 lines, -43 lines 0 comments Download
M src/effects/SkMagnifierImageFilter.cpp View 1 2 3 4 5 3 chunks +25 lines, -17 lines 0 comments Download
M src/effects/SkMatrixConvolutionImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +40 lines, -20 lines 0 comments Download
M src/effects/SkMergeImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +12 lines, -14 lines 0 comments Download
M src/effects/SkMorphologyImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 9 chunks +57 lines, -36 lines 0 comments Download
M src/effects/SkOffsetImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +13 lines, -8 lines 0 comments Download
M src/effects/SkPictureImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +14 lines, -5 lines 0 comments Download
M src/effects/SkRectShaderImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +7 lines, -3 lines 0 comments Download
M src/effects/SkTestImageFilters.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +26 lines, -34 lines 0 comments Download
M src/effects/SkTileImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +30 lines, -21 lines 0 comments Download
M src/effects/SkXfermodeImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +47 lines, -30 lines 0 comments Download
M src/gpu/GrLayerHoister.cpp View 1 2 3 4 4 chunks +10 lines, -11 lines 0 comments Download
M src/gpu/SkGpuDevice.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -3 lines 0 comments Download
M src/gpu/SkGpuDevice.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 7 chunks +22 lines, -19 lines 0 comments Download
M src/image/SkImage.cpp View 1 2 3 4 5 1 chunk +31 lines, -0 lines 0 comments Download
M src/pdf/SkPDFDevice.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +7 lines, -4 lines 0 comments Download
M src/utils/SkDeferredCanvas.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -2 lines 0 comments Download
M tests/ImageFilterTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 8 chunks +44 lines, -23 lines 0 comments Download
M tests/PDFPrimitivesTest.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -3 lines 0 comments Download

Messages

Total messages: 13 (3 generated)
Kimmo Kinnunen
Unfortunately didn't manage to get a running version (dm compiles). Did you mean something like ...
5 years, 10 months ago (2015-02-12 13:55:57 UTC) #2
reed1
I like the experiment. As you find misc. clean-ups (e.g. adding const in SkImage.h) consider ...
5 years, 10 months ago (2015-02-12 14:21:53 UTC) #4
bsalomon
Kimmo, you're a brave soul! :) Moving image filters towards surface and image is absolutely ...
5 years, 10 months ago (2015-02-13 14:24:35 UTC) #5
Kimmo Kinnunen
On 2015/02/13 14:24:35, bsalomon wrote: > Kimmo, you're a brave soul! :) > > Moving ...
5 years, 10 months ago (2015-02-16 14:56:38 UTC) #6
Kimmo Kinnunen
On 2015/02/16 14:56:38, Kimmo Kinnunen wrote: > On 2015/02/13 14:24:35, bsalomon wrote: > > Kimmo, ...
5 years, 10 months ago (2015-02-17 14:11:24 UTC) #7
Kimmo Kinnunen
On 2015/02/17 14:11:24, Kimmo Kinnunen wrote: > The other option, eg. making SkImage* SkBaseDevice::newSnapshotImage() and ...
5 years, 10 months ago (2015-02-18 15:14:13 UTC) #8
reed2
I really like the effect of this CL. What is its status? One thing I ...
5 years, 10 months ago (2015-02-24 23:18:14 UTC) #10
Kimmo Kinnunen
On 2015/02/24 23:18:14, reed2 wrote: > I really like the effect of this CL. What ...
5 years, 10 months ago (2015-02-25 13:45:07 UTC) #11
reed1
I see that one somewhat orthogonal change is adding kImage to DrawFilter. I can do ...
5 years, 10 months ago (2015-02-25 16:36:21 UTC) #12
Kimmo Kinnunen
5 years, 10 months ago (2015-02-26 12:24:01 UTC) #13
On 2015/02/25 16:36:21, reed1 wrote:
> I see that one somewhat orthogonal change is adding kImage to DrawFilter. I
can
> do that now, separately, since it makes sense regardless of anything else, it
it
> would reduce the size (a little) of this CL.
> 
> https://codereview.chromium.org/920513003/diff/120001/include/core/SkCanvas.h
> File include/core/SkCanvas.h (right):
> 
>
https://codereview.chromium.org/920513003/diff/120001/include/core/SkCanvas.h...
> include/core/SkCanvas.h:1231: virtual void onDrawSprite(const SkImage&, int
> left, int top, const SkPaint*);
> same nit about shadowing virtuals w/ the same name. onDrawImageAsSprite?
> 
> https://codereview.chromium.org/920513003/diff/120001/include/core/SkDevice.h
> File include/core/SkDevice.h (right):
> 
>
https://codereview.chromium.org/920513003/diff/120001/include/core/SkDevice.h...
> include/core/SkDevice.h:210: virtual void drawSprite(const SkDraw&, const
> SkImage& bitmap,
> naming nit: two virtuals w/ the same name are tricky (shadowing, etc.). Skia
> tries to never do this. Why not drawImageAsSprite() so we still capture the
> semantic that the CTM is to be ignored.
> I see that one somewhat orthogonal change is adding kImage to DrawFilter. I
can
> do that now, separately, since it makes sense regardless of anything else, it
it
> would reduce the size (a little) of this CL.

Ok. I separated that to be able to compile. We can use yours. Mine is at:
https://chromiumcodereview.appspot.com/960783003/



>
https://codereview.chromium.org/920513003/diff/120001/include/core/SkDevice.h...
> include/core/SkDevice.h:210: virtual void drawSprite(const SkDraw&, const
> SkImage& bitmap,
> naming nit: two virtuals w/ the same name are tricky (shadowing, etc.). Skia
> tries to never do this. Why not drawImageAsSprite() so we still capture the
> semantic that the CTM is to be ignored.
 
Done. 
BTW, it's not the ctm that's important, it's the semantic of filters being
applied..

Powered by Google App Engine
This is Rietveld 408576698