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

Unified Diff: include/gpu/GrTextureProvider.h

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 | « include/core/SkImageFilter.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrTextureProvider.h
diff --git a/include/gpu/GrTextureProvider.h b/include/gpu/GrTextureProvider.h
index 44c8cbc6578424aaed6a0e3422d9e4915597ee6e..5635583d80fef393a746ae75f32edc0d2a3c8025 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,
« no previous file with comments | « include/core/SkImageFilter.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698