diff options
author | 2015-10-22 13:20:20 -0700 | |
---|---|---|
committer | 2015-10-22 13:20:20 -0700 | |
commit | c9b5f8b1522e72449d704d30ed6aee4fc6211ee8 (patch) | |
tree | 2076a03c9e01fe3146e64755f54684abd3ea9497 /include/gpu | |
parent | 6ae30fbbafe9aa9596922ac96ecaae0278b7be65 (diff) |
tunnel down texture-size-constraint to imagefilters
BUG=skia:
Review URL: https://codereview.chromium.org/1421493003
Diffstat (limited to 'include/gpu')
-rw-r--r-- | include/gpu/GrTextureProvider.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/gpu/GrTextureProvider.h b/include/gpu/GrTextureProvider.h index 44c8cbc657..5635583d80 100644 --- a/include/gpu/GrTextureProvider.h +++ b/include/gpu/GrTextureProvider.h @@ -9,6 +9,7 @@ #define GrTextureProvider_DEFINED #include "GrTexture.h" +#include "SkImageFilter.h" class SK_API GrTextureProvider { public: @@ -69,6 +70,31 @@ public: */ GrTexture* createApproxTexture(const GrSurfaceDesc&); + enum SizeConstraint { + kExact_SizeConstraint, + kApprox_SizeConstraint, + }; + + GrTexture* createTexture(const GrSurfaceDesc& desc, SizeConstraint constraint) { + switch (constraint) { + case kExact_SizeConstraint: + return this->createTexture(desc, true); + case kApprox_SizeConstraint: + return this->createApproxTexture(desc); + } + sk_throw(); + return nullptr; + } + + static SizeConstraint FromImageFilter(SkImageFilter::SizeConstraint constraint) { + if (SkImageFilter::kExact_SizeConstraint == constraint) { + return kExact_SizeConstraint; + } else { + SkASSERT(SkImageFilter::kApprox_SizeConstraint == constraint); + return kApprox_SizeConstraint; + } + } + /** Legacy function that no longer should be used. */ enum ScratchTexMatch { kExact_ScratchTexMatch, |