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

Unified Diff: src/core/SkImageFilter.cpp

Issue 1421493003: tunnel down texture-size-constraint to imagefilters (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix formating Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkLocalMatrixImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index d7af4e65d0656c13572683b08a429c52f13f87ad..fef88fdf37286702b0c0b047d2da008e8936e10a 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -263,10 +263,21 @@ bool SkImageFilter::filterImage(Proxy* proxy, const SkBitmap& src,
}
bool SkImageFilter::filterInput(int index, Proxy* proxy, const SkBitmap& src,
- const Context& context,
- SkBitmap* result, SkIPoint* offset) const {
+ const Context& origCtx,
+ SkBitmap* result, SkIPoint* offset,
+ bool relaxSizeConstraint) const {
SkImageFilter* input = this->getInput(index);
- return !input || input->filterImage(proxy, src, context, result, offset);
+ if (!input) {
+ return true;
+ }
+
+ SizeConstraint constraint = origCtx.sizeConstraint();
+ if (relaxSizeConstraint && (kExact_SizeConstraint == constraint)) {
+ constraint = kApprox_SizeConstraint;
+ }
+ Context ctx(origCtx.ctm(), origCtx.clipBounds(), origCtx.cache(), constraint);
+
+ return input->filterImage(proxy, src, ctx, result, offset);
}
bool SkImageFilter::filterBounds(const SkIRect& src, const SkMatrix& ctm,
@@ -347,7 +358,8 @@ bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Cont
desc.fHeight = bounds.height();
desc.fConfig = kRGBA_8888_GrPixelConfig;
- SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
+ SkAutoTUnref<GrTexture> dst(context->textureProvider()->createTexture(desc,
+ GrTextureProvider::FromImageFilter(ctx.sizeConstraint())));
if (!dst) {
return false;
}
@@ -466,8 +478,9 @@ void SkImageFilter::WrapTexture(GrTexture* texture, int width, int height, SkBit
}
bool SkImageFilter::filterInputGPU(int index, SkImageFilter::Proxy* proxy,
- const SkBitmap& src, const Context& ctx,
- SkBitmap* result, SkIPoint* offset) const {
+ const SkBitmap& src, const Context& origCtx,
+ SkBitmap* result, SkIPoint* offset,
+ bool relaxSizeConstraint) const {
SkImageFilter* input = this->getInput(index);
if (!input) {
return true;
@@ -477,6 +490,12 @@ bool SkImageFilter::filterInputGPU(int index, SkImageFilter::Proxy* proxy,
// called are restored before we return to the caller.
GrContext* context = src.getTexture()->getContext();
+ SizeConstraint constraint = origCtx.sizeConstraint();
+ if (relaxSizeConstraint && (kExact_SizeConstraint == constraint)) {
+ constraint = kApprox_SizeConstraint;
+ }
+ Context ctx(origCtx.ctm(), origCtx.clipBounds(), origCtx.cache(), constraint);
+
if (input->canFilterImageGPU()) {
return input->filterImageGPU(proxy, src, ctx, result, offset);
} else {
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkLocalMatrixImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698