add applyFilter() to SkImage
Result:
- clients can get a filtered version of an image without having to setup a temp drawing environment
- for some cases, the process is more efficient even than (deprecated) drawSprite, since there is no need to draw/copy the result
Impl:
- made Proxy virtual so we don't need to have an existing device to use it
This, in conjunction with LocalMatrixImageFilter, should allow us to simplify and optimize ApplyImageFilter() in cc/output/gl_renderer.cc
BUG=skia:
Review URL: https://codereview.chromium.org/1390913005
diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h
index 530c044..d5080d7 100644
--- a/src/image/SkImage_Gpu.h
+++ b/src/image/SkImage_Gpu.h
@@ -43,6 +43,12 @@
bool isOpaque() const override;
bool onReadPixels(const SkImageInfo&, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY) const override;
+ SkImage* onApplyFilter(SkImageFilter*, SkIPoint* offset,
+ bool forceResultToOriginalSize) const override;
+
+ SkSurface* onNewSurface(const SkImageInfo& info) const override {
+ return SkSurface::NewRenderTarget(fTexture->getContext(), SkSurface::kNo_Budgeted, info);
+ }
private:
SkAutoTUnref<GrTexture> fTexture;