diff options
author | Robert Phillips <robertphillips@google.com> | 2017-01-23 15:30:35 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-24 12:23:28 +0000 |
commit | bc7a4fb06780f9829b4b21470fe6f0503d2297cd (patch) | |
tree | d8a2460df05c73909530a3316cdc8b6192d5c55e /include | |
parent | ad24145e41b473012a900818933291541e80815c (diff) |
Make GrYUVEffect take GrTextureProxies
This opens the door for swapping all the effects over to taking GrTextureProxies.
Change-Id: I3b03ba93a68f9945c9a8fee008fd170ed57616eb
Reviewed-on: https://skia-review.googlesource.com/7344
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrCoordTransform.h | 26 | ||||
-rw-r--r-- | include/gpu/GrProcessor.h | 8 |
2 files changed, 32 insertions, 2 deletions
diff --git a/include/gpu/GrCoordTransform.h b/include/gpu/GrCoordTransform.h index 5c16c89679..a4d7d3565d 100644 --- a/include/gpu/GrCoordTransform.h +++ b/include/gpu/GrCoordTransform.h @@ -14,6 +14,8 @@ #include "GrTypes.h" #include "GrShaderVar.h" +class GrTextureProxy; + /** * A class representing a linear transformation of local coordinates. GrFragnentProcessors * these transformations, and the GrGeometryProcessor implements the transformation. @@ -22,7 +24,9 @@ class GrCoordTransform : SkNoncopyable { public: GrCoordTransform() : fTexture(nullptr) - , fNormalize(false) { + , fNormalize(false) + , fReverseY(false) + , fPrecision(kDefault_GrSLPrecision) { SkDEBUGCODE(fInProcessor = false); } @@ -37,17 +41,31 @@ public: this->reset(SkMatrix::I(), texture, filter); } + GrCoordTransform(GrContext* context, GrTextureProxy* proxy, + GrSamplerParams::FilterMode filter) { + SkASSERT(proxy); + SkDEBUGCODE(fInProcessor = false); + this->reset(context, SkMatrix::I(), proxy, filter); + } + /** * Create a transformation from a matrix. The precision is inferred from the texture size and * filter. The texture origin also implies whether a y-reversal should be performed. */ GrCoordTransform(const SkMatrix& m, const GrTexture* texture, GrSamplerParams::FilterMode filter) { - SkDEBUGCODE(fInProcessor = false); SkASSERT(texture); + SkDEBUGCODE(fInProcessor = false); this->reset(m, texture, filter); } + GrCoordTransform(GrContext* context, const SkMatrix& m, GrTextureProxy* proxy, + GrSamplerParams::FilterMode filter) { + SkASSERT(proxy); + SkDEBUGCODE(fInProcessor = false); + this->reset(context, m, proxy, filter); + } + /** * Create a transformation that applies the matrix to a coord set. */ @@ -56,9 +74,13 @@ public: this->reset(m, precision); } + // MDB TODO: rm the GrTexture* flavor of reset void reset(const SkMatrix&, const GrTexture*, GrSamplerParams::FilterMode filter, bool normalize = true); + void reset(GrContext* context, const SkMatrix&, GrTextureProxy*, + GrSamplerParams::FilterMode filter, bool normalize = true); + void reset(const SkMatrix& m, GrSLPrecision precision = kDefault_GrSLPrecision) { SkASSERT(!fInProcessor); fMatrix = m; diff --git a/include/gpu/GrProcessor.h b/include/gpu/GrProcessor.h index f933c9a9f7..a8e31f2c86 100644 --- a/include/gpu/GrProcessor.h +++ b/include/gpu/GrProcessor.h @@ -22,6 +22,8 @@ class GrContext; class GrCoordTransform; class GrInvariantOutput; +class GrTextureProvider; +class GrTextureProxy; /** * Used by processors to build their keys. It incorporates each per-processor key into a larger @@ -209,6 +211,12 @@ public: SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode, GrShaderFlags visibility = kFragment_GrShaderFlag); + // MDB TODO: ultimately we shouldn't need the texProvider parameter + explicit TextureSampler(GrTextureProvider*, sk_sp<GrTextureProxy>, + GrSamplerParams::FilterMode = GrSamplerParams::kNone_FilterMode, + SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode, + GrShaderFlags visibility = kFragment_GrShaderFlag); + void reset(GrTexture*, const GrSamplerParams&, GrShaderFlags visibility = kFragment_GrShaderFlag); void reset(GrTexture*, |