aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTextureProducer.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-09-07 12:36:34 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-07 16:58:31 +0000
commit2bbdcc44c63974f29f3743bb58d929601a3f65c6 (patch)
treed420f298f606b061054e56866d1930ab84f00ed5 /src/gpu/GrTextureProducer.h
parent4df0092eac6e9bb5afc516773a0c618630193dc6 (diff)
Rework GrSamplerParams to be more compact and use its own wrap mode enum.
The main change is to make GrSamplerParams smaller by making its enums have byte-sized underlying types. The rest is cosmetic. Change-Id: Ib71ea50612d24619a85e463826c6b8dfb9b445e3 Reviewed-on: https://skia-review.googlesource.com/43200 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrTextureProducer.h')
-rw-r--r--src/gpu/GrTextureProducer.h37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/gpu/GrTextureProducer.h b/src/gpu/GrTextureProducer.h
index ccc0dae2ee..7d056640cc 100644
--- a/src/gpu/GrTextureProducer.h
+++ b/src/gpu/GrTextureProducer.h
@@ -8,17 +8,23 @@
#ifndef GrTextureProducer_DEFINED
#define GrTextureProducer_DEFINED
-#include "GrSamplerParams.h"
#include "GrResourceKey.h"
+#include "GrSamplerState.h"
+#include "SkImageInfo.h"
+class GrContext;
class GrColorSpaceXform;
+class GrFragmentProcessor;
class GrTexture;
class GrTextureProxy;
+class SkColorSpace;
+class SkMatrix;
+struct SkRect;
/**
* Different GPUs and API extensions have different requirements with respect to what texture
* sampling parameters may be used with textures of various types. This class facilitates making
- * texture compatible with a given GrSamplerParams. There are two immediate subclasses defined
+ * texture compatible with a given GrSamplerState. There are two immediate subclasses defined
* below. One is a base class for sources that are inherently texture-backed (e.g. a texture-backed
* SkImage). It supports subsetting the original texture. The other is for use cases where the
* source can generate a texture that represents some content (e.g. cpu pixels, SkPicture, ...).
@@ -26,9 +32,9 @@ class GrTextureProxy;
class GrTextureProducer : public SkNoncopyable {
public:
struct CopyParams {
- GrSamplerParams::FilterMode fFilter;
- int fWidth;
- int fHeight;
+ GrSamplerState::Filter fFilter;
+ int fWidth;
+ int fHeight;
};
enum FilterConstraint {
@@ -61,7 +67,7 @@ public:
const SkRect& constraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrSamplerParams::FilterMode* filterOrNullForBicubic,
+ const GrSamplerState::Filter* filterOrNullForBicubic,
SkColorSpace* dstColorSpace) = 0;
virtual ~GrTextureProducer() {}
@@ -87,7 +93,7 @@ protected:
if (origKey.isValid()) {
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
GrUniqueKey::Builder builder(copyKey, origKey, kDomain, 3);
- builder[0] = copyParams.fFilter;
+ builder[0] = static_cast<uint32_t>(copyParams.fFilter);
builder[1] = copyParams.fWidth;
builder[2] = copyParams.fHeight;
}
@@ -121,14 +127,13 @@ protected:
static sk_sp<GrTextureProxy> CopyOnGpu(GrContext*, sk_sp<GrTextureProxy> inputProxy,
const SkIRect* subset, const CopyParams& copyParams);
- static DomainMode DetermineDomainMode(
- const SkRect& constraintRect,
- FilterConstraint filterConstraint,
- bool coordsLimitedToConstraintRect,
- GrTextureProxy*,
- const SkIRect* textureContentArea,
- const GrSamplerParams::FilterMode* filterModeOrNullForBicubic,
- SkRect* domainRect);
+ static DomainMode DetermineDomainMode(const SkRect& constraintRect,
+ FilterConstraint filterConstraint,
+ bool coordsLimitedToConstraintRect,
+ GrTextureProxy*,
+ const SkIRect* textureContentArea,
+ const GrSamplerState::Filter* filterModeOrNullForBicubic,
+ SkRect* domainRect);
static std::unique_ptr<GrFragmentProcessor> CreateFragmentProcessorForDomainAndFilter(
sk_sp<GrTextureProxy> proxy,
@@ -136,7 +141,7 @@ protected:
const SkMatrix& textureMatrix,
DomainMode,
const SkRect& domain,
- const GrSamplerParams::FilterMode* filterOrNullForBicubic);
+ const GrSamplerState::Filter* filterOrNullForBicubic);
private:
const int fWidth;