aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTextureAdjuster.cpp
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/GrTextureAdjuster.cpp
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/GrTextureAdjuster.cpp')
-rw-r--r--src/gpu/GrTextureAdjuster.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp
index 546ea67b60..9c34cca569 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -67,10 +67,9 @@ sk_sp<GrTextureProxy> GrTextureAdjuster::refTextureProxyCopy(const CopyParams& c
return copy;
}
-sk_sp<GrTextureProxy> GrTextureAdjuster::refTextureProxySafeForParams(
- const GrSamplerParams& params,
- SkIPoint* outOffset,
- SkScalar scaleAdjust[2]) {
+sk_sp<GrTextureProxy> GrTextureAdjuster::refTextureProxySafeForParams(const GrSamplerState& params,
+ SkIPoint* outOffset,
+ SkScalar scaleAdjust[2]) {
sk_sp<GrTextureProxy> proxy = this->originalProxyRef();
CopyParams copyParams;
const SkIRect* contentArea = this->contentAreaOrNull();
@@ -80,12 +79,12 @@ sk_sp<GrTextureProxy> GrTextureAdjuster::refTextureProxySafeForParams(
return nullptr;
}
- if (contentArea && GrSamplerParams::kMipMap_FilterMode == params.filterMode()) {
+ if (contentArea && GrSamplerState::Filter::kMipMap == params.filter()) {
// If we generate a MIP chain for texture it will read pixel values from outside the content
// area.
copyParams.fWidth = contentArea->width();
copyParams.fHeight = contentArea->height();
- copyParams.fFilter = GrSamplerParams::kBilerp_FilterMode;
+ copyParams.fFilter = GrSamplerState::Filter::kBilerp;
} else if (!fContext->getGpu()->isACopyNeededForTextureParams(proxy.get(), params, &copyParams,
scaleAdjust)) {
if (outOffset) {
@@ -110,7 +109,7 @@ std::unique_ptr<GrFragmentProcessor> GrTextureAdjuster::createFragmentProcessor(
const SkRect& origConstraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrSamplerParams::FilterMode* filterOrNullForBicubic,
+ const GrSamplerState::Filter* filterOrNullForBicubic,
SkColorSpace* dstColorSpace) {
SkMatrix textureMatrix = origTextureMatrix;
const SkIRect* contentArea = this->contentAreaOrNull();
@@ -125,12 +124,13 @@ std::unique_ptr<GrFragmentProcessor> GrTextureAdjuster::createFragmentProcessor(
}
SkRect domain;
- GrSamplerParams params;
+ GrSamplerState samplerState;
if (filterOrNullForBicubic) {
- params.setFilterMode(*filterOrNullForBicubic);
+ samplerState.setFilterMode(*filterOrNullForBicubic);
}
SkScalar scaleAdjust[2] = { 1.0f, 1.0f };
- sk_sp<GrTextureProxy> proxy(this->refTextureProxySafeForParams(params, nullptr, scaleAdjust));
+ sk_sp<GrTextureProxy> proxy(
+ this->refTextureProxySafeForParams(samplerState, nullptr, scaleAdjust));
if (!proxy) {
return nullptr;
}
@@ -153,8 +153,8 @@ std::unique_ptr<GrFragmentProcessor> GrTextureAdjuster::createFragmentProcessor(
// We only expect MIP maps to require a tight copy.
SkASSERT(filterOrNullForBicubic &&
- GrSamplerParams::kMipMap_FilterMode == *filterOrNullForBicubic);
- static const GrSamplerParams::FilterMode kBilerp = GrSamplerParams::kBilerp_FilterMode;
+ GrSamplerState::Filter::kMipMap == *filterOrNullForBicubic);
+ static const GrSamplerState::Filter kBilerp = GrSamplerState::Filter::kBilerp;
domainMode =
DetermineDomainMode(*constraintRect, filterConstraint, coordsLimitedToConstraintRect,
proxy.get(),