| Index: src/gpu/GrTextureParamsAdjuster.h
|
| diff --git a/src/gpu/GrTextureParamsAdjuster.h b/src/gpu/GrTextureParamsAdjuster.h
|
| index cad392046643c4c2228997034a6c80d877501ea4..ed9f142af0f6d4e7ce36626906042df0fb7fc42f 100644
|
| --- a/src/gpu/GrTextureParamsAdjuster.h
|
| +++ b/src/gpu/GrTextureParamsAdjuster.h
|
| @@ -34,6 +34,38 @@ public:
|
| int fHeight;
|
| };
|
|
|
| + enum FilterConstraint {
|
| + kYes_FilterConstraint,
|
| + kNo_FilterConstraint,
|
| + };
|
| +
|
| + /**
|
| + * 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
|
| + * respect to this Producer's 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,25 +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&);
|
|
|
| -protected:
|
| - GrTextureMaker(int width, int height) : INHERITED(width, height) {}
|
| + const GrFragmentProcessor* createFragmentProcessor(
|
| + const SkMatrix& textureMatrix,
|
| + const SkRect& constraintRect,
|
| + FilterConstraint filterConstraint,
|
| + bool coordsLimitedToConstraintRect,
|
| + const GrTextureParams::FilterMode* filterOrNullForBicubic) override;
|
|
|
| - /**
|
| - * 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).
|
| - */
|
| - virtual GrTexture* refOriginalTexture(GrContext*) = 0;
|
| +protected:
|
| + GrTextureMaker(GrContext* context, int width, int height)
|
| + : INHERITED(width, height)
|
| + , fContext(context) {}
|
|
|
| /**
|
| - * If we need to copy the producer's original texture, the producer is asked to return a key
|
| - * that identifies its original + the CopyParms parameter. If the maker does not want to cache
|
| - * the stretched version (e.g. the producer is volatile), this should simply return without
|
| - * initializing the copyKey.
|
| + * Return the maker's "original" texture. It is the responsibility of the maker to handle any
|
| + * caching of the original if desired.
|
| */
|
| - virtual void makeCopyKey(const CopyParams&, GrUniqueKey* copyKey) = 0;
|
| + virtual GrTexture* refOriginalTexture() = 0;
|
|
|
| /**
|
| * Return a new (uncached) texture that is the stretch of the maker's original.
|
| @@ -183,9 +190,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;
|
| };
|
|
|
|
|