Index: src/gpu/GrTextureParamsAdjuster.h |
diff --git a/src/gpu/GrTextureParamsAdjuster.h b/src/gpu/GrTextureParamsAdjuster.h |
index cad392046643c4c2228997034a6c80d877501ea4..9729779fa32935a6df4d370328dcd6f1e0be9c15 100644 |
--- a/src/gpu/GrTextureParamsAdjuster.h |
+++ b/src/gpu/GrTextureParamsAdjuster.h |
@@ -34,6 +34,38 @@ public: |
int fHeight; |
}; |
+ enum FilterConstraint { |
bsalomon
2015/11/17 23:15:57
this block moved up from subclass and made virtual
|
+ kYes_FilterConstraint, |
+ kNo_FilterConstraint, |
+ }; |
+ |
+ /** |
robertphillips
2015/11/18 13:58:35
Aren't these all supposed to be one pixel right ?
bsalomon
2015/11/18 18:05:38
Done
|
+ * Helper for creating a fragment processor to sample the texture with a given filtering mode. |
+ * It attempts to avoid making texture copies or using domains whenever possible. |
+ * |
+ * @param textureMatrix Matrix used to access the texture. It is applied to |
+ * the local coords. The post-transformed coords should |
+ * be in texel units (rather than normalized) with |
robertphillips
2015/11/18 13:58:35
r' -> r's ?
bsalomon
2015/11/18 18:05:38
Done
|
+ * respect to this Producer' bounds (width()/height()). |
+ * @param constraintRect A rect that represents the area of the texture to be |
+ * sampled. It must be contained in the Producer's bounds |
+ * as defined by width()/height(). |
+ * @param filterConstriant Indicates whether filtering is limited to |
+ * constraintRect. |
+ * @param coordsLimitedToConstraintRect Is it known that textureMatrix*localCoords is bound |
+ * by the portion of the texture indicated by |
+ * constraintRect (without consideration of filter |
+ * width, just the raw coords). |
+ * @param filterOrNullForBicubic If non-null indicates the filter mode. If null means |
+ * use bicubic filtering. |
+ **/ |
+ virtual const GrFragmentProcessor* createFragmentProcessor( |
+ const SkMatrix& textureMatrix, |
+ const SkRect& constraintRect, |
+ FilterConstraint filterConstraint, |
+ bool coordsLimitedToConstraintRect, |
+ const GrTextureParams::FilterMode* filterOrNullForBicubic) = 0; |
+ |
virtual ~GrTextureProducer() {} |
int width() const { return fWidth; } |
@@ -92,37 +124,12 @@ public: |
does not match subset's dimensions then the contents are scaled to fit the copy.*/ |
GrTexture* refTextureSafeForParams(const GrTextureParams&, SkIPoint* outOffset); |
- enum FilterConstraint { |
- kYes_FilterConstraint, |
- kNo_FilterConstraint, |
- }; |
- |
- /** |
- * Helper for creating a fragment processor to sample the texture with a given filtering mode. |
- * It attempts to avoids making a copy of the texture and avoid using a texture domain unless |
- * necessary. |
- * |
- * @param textureMatrix Matrix to apply to local coordinates to compute |
- * texel coordinates. The post-transformed coordinates |
- * should be in texels (relative to this->width() and |
- * this->height()) and not be normalized. |
- * @param constraintRect Subrect of content area to be rendered. The |
- * constraint rect is relative to the content area. |
- * @param filterConstriant Indicates whether filtering is limited to |
- * constraintRect. |
- * @param coordsLimitedToConstraintRect Is it known that textureMatrix*localCoords is bound |
- * by the portion of the texture indicated by |
- * constraintRect (without consideration of filter |
- * width, just the raw coords). |
- * @param filterOrNullForBicubic If non-null indicates the filter mode. If null means |
- * use bicubic filtering. |
- **/ |
const GrFragmentProcessor* createFragmentProcessor( |
- const SkMatrix& textureMatrix, |
- const SkRect& constraintRect, |
- FilterConstraint filterConstraint, |
- bool coordsLimitedToConstraintRect, |
- const GrTextureParams::FilterMode* filterOrNullForBicubic); |
+ const SkMatrix& textureMatrix, |
+ const SkRect& constraintRect, |
+ FilterConstraint, |
+ bool coordsLimitedToConstraintRect, |
+ const GrTextureParams::FilterMode* filterOrNullForBicubic) override; |
protected: |
/** The whole texture is content. */ |
@@ -153,17 +160,25 @@ public: |
/** Returns a texture that is safe for use with the params. If the size of the returned texture |
does not match width()/height() then the contents of the original must be scaled to fit |
the texture. */ |
- GrTexture* refTextureForParams(GrContext*, const GrTextureParams&); |
+ GrTexture* refTextureForParams(const GrTextureParams&); |
+ |
+ const GrFragmentProcessor* createFragmentProcessor( |
+ const SkMatrix& textureMatrix, |
+ const SkRect& constraintRect, |
+ FilterConstraint filterConstraint, |
+ bool coordsLimitedToConstraintRect, |
+ const GrTextureParams::FilterMode* filterOrNullForBicubic) override; |
protected: |
- GrTextureMaker(int width, int height) : INHERITED(width, height) {} |
+ GrTextureMaker(GrContext* context, int width, int height) |
+ : INHERITED(width, height) |
+ , fContext(context) {} |
/** |
- * Return the maker's "original" texture. It is the responsibility of the maker |
- * to make this efficient ... if the texture is being generated, the maker must handle |
- * caching it (if desired). |
+ * Return the maker's "original" texture. It is the responsibility of the maker to handle any |
+ * caching of the original if desired. |
*/ |
- virtual GrTexture* refOriginalTexture(GrContext*) = 0; |
+ virtual GrTexture* refOriginalTexture() = 0; |
/** |
* If we need to copy the producer's original texture, the producer is asked to return a key |
@@ -183,9 +198,13 @@ protected: |
* Subclass may override this if they can handle creating the texture more directly than |
* by copying. |
*/ |
- virtual GrTexture* generateTextureForParams(GrContext*, const CopyParams&); |
+ virtual GrTexture* generateTextureForParams(const CopyParams&); |
+ |
+ GrContext* context() const { return fContext; } |
private: |
+ GrContext* fContext; |
+ |
typedef GrTextureProducer INHERITED; |
}; |