aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/DetermineDomainModeTest.cpp28
-rw-r--r--tests/ImageTest.cpp10
-rw-r--r--tests/IntTextureTest.cpp10
-rw-r--r--tests/RectangleTextureTest.cpp6
-rw-r--r--tests/SRGBMipMapTest.cpp7
5 files changed, 29 insertions, 32 deletions
diff --git a/tests/DetermineDomainModeTest.cpp b/tests/DetermineDomainModeTest.cpp
index ee9a694f19..111194f4ad 100644
--- a/tests/DetermineDomainModeTest.cpp
+++ b/tests/DetermineDomainModeTest.cpp
@@ -23,14 +23,13 @@ class GrTextureProducer_TestAccess {
public:
using DomainMode = GrTextureProducer::DomainMode;
- static DomainMode DetermineDomainMode(
- const SkRect& constraintRect,
- GrTextureProducer::FilterConstraint filterConstraint,
- bool coordsLimitedToConstraintRect,
- GrTextureProxy* proxy,
- const SkIRect* textureContentArea,
- const GrSamplerParams::FilterMode* filterModeOrNullForBicubic,
- SkRect* domainRect) {
+ static DomainMode DetermineDomainMode(const SkRect& constraintRect,
+ GrTextureProducer::FilterConstraint filterConstraint,
+ bool coordsLimitedToConstraintRect,
+ GrTextureProxy* proxy,
+ const SkIRect* textureContentArea,
+ const GrSamplerState::Filter* filterModeOrNullForBicubic,
+ SkRect* domainRect) {
return GrTextureProducer::DetermineDomainMode(constraintRect,
filterConstraint,
coordsLimitedToConstraintRect,
@@ -346,15 +345,14 @@ static void proxy_test(skiatest::Reporter* reporter, GrResourceProvider* resourc
GrTextureProducer_TestAccess::DomainMode actualMode, expectedMode;
SkRect actualDomainRect;
- static const GrSamplerParams::FilterMode gModes[] = {
- GrSamplerParams::kNone_FilterMode,
- GrSamplerParams::kBilerp_FilterMode,
- GrSamplerParams::kMipMap_FilterMode,
+ static const GrSamplerState::Filter gModes[] = {
+ GrSamplerState::Filter::kNearest,
+ GrSamplerState::Filter::kBilerp,
+ GrSamplerState::Filter::kMipMap,
};
- static const GrSamplerParams::FilterMode* gModePtrs[] = {
- &gModes[0], &gModes[1], nullptr, &gModes[2]
- };
+ static const GrSamplerState::Filter* gModePtrs[] = {&gModes[0], &gModes[1], nullptr,
+ &gModes[2]};
static const float gHalfFilterWidth[] = { 0.0f, 0.5f, 1.5f, 10000.0f };
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 4ee28035ed..96b5b29405 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -927,19 +927,19 @@ DEF_GPUTEST(SkImage_MakeCrossContextRelease, reporter, /*factory*/) {
// Any context should be able to borrow the texture at this point
sk_sp<SkColorSpace> texColorSpace;
sk_sp<GrTextureProxy> proxy = as_IB(refImg)->asTextureProxyRef(
- ctx, GrSamplerParams::ClampNoFilter(), nullptr, &texColorSpace, nullptr);
+ ctx, GrSamplerState::ClampNearest(), nullptr, &texColorSpace, nullptr);
REPORTER_ASSERT(reporter, proxy);
// But once it's borrowed, no other context should be able to borrow
otherTestContext->makeCurrent();
sk_sp<GrTextureProxy> otherProxy = as_IB(refImg)->asTextureProxyRef(
- otherCtx, GrSamplerParams::ClampNoFilter(), nullptr, &texColorSpace, nullptr);
+ otherCtx, GrSamplerState::ClampNearest(), nullptr, &texColorSpace, nullptr);
REPORTER_ASSERT(reporter, !otherProxy);
// Original context (that's already borrowing) should be okay
testContext->makeCurrent();
sk_sp<GrTextureProxy> proxySecondRef = as_IB(refImg)->asTextureProxyRef(
- ctx, GrSamplerParams::ClampNoFilter(), nullptr, &texColorSpace, nullptr);
+ ctx, GrSamplerState::ClampNearest(), nullptr, &texColorSpace, nullptr);
REPORTER_ASSERT(reporter, proxySecondRef);
// Releae all refs from the original context
@@ -948,8 +948,8 @@ DEF_GPUTEST(SkImage_MakeCrossContextRelease, reporter, /*factory*/) {
// Now we should be able to borrow the texture from the other context
otherTestContext->makeCurrent();
- otherProxy = as_IB(refImg)->asTextureProxyRef(
- otherCtx, GrSamplerParams::ClampNoFilter(), nullptr, &texColorSpace, nullptr);
+ otherProxy = as_IB(refImg)->asTextureProxyRef(otherCtx, GrSamplerState::ClampNearest(),
+ nullptr, &texColorSpace, nullptr);
REPORTER_ASSERT(reporter, otherProxy);
// Release everything
diff --git a/tests/IntTextureTest.cpp b/tests/IntTextureTest.cpp
index 35019b8937..3baded97cb 100644
--- a/tests/IntTextureTest.cpp
+++ b/tests/IntTextureTest.cpp
@@ -249,13 +249,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) {
SkBackingFit::kExact, kS, kS, kRGBA_8888_GrPixelConfig, nullptr);
struct {
- GrSamplerParams::FilterMode fMode;
+ GrSamplerState::Filter fMode;
const char* fName;
- } kNamedFilters[] ={
- { GrSamplerParams::kNone_FilterMode, "filter-none" },
- { GrSamplerParams::kBilerp_FilterMode, "filter-bilerp" },
- { GrSamplerParams::kMipMap_FilterMode, "filter-mipmap" }
- };
+ } kNamedFilters[] = {{GrSamplerState::Filter::kNearest, "filter-none"},
+ {GrSamplerState::Filter::kBilerp, "filter-bilerp"},
+ {GrSamplerState::Filter::kMipMap, "filter-mipmap"}};
for (auto filter : kNamedFilters) {
auto fp = GrSimpleTextureEffect::Make(sContext->asTextureProxyRef(), nullptr, SkMatrix::I(),
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index 08569a766e..25a8b932e7 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -25,9 +25,9 @@ static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* cont
context->makeDeferredRenderTargetContext(SkBackingFit::kExact, rectProxy->width(),
rectProxy->height(), rectProxy->config(),
nullptr));
- for (auto filter : {GrSamplerParams::kNone_FilterMode,
- GrSamplerParams::kBilerp_FilterMode,
- GrSamplerParams::kMipMap_FilterMode}) {
+ for (auto filter : {GrSamplerState::Filter::kNearest,
+ GrSamplerState::Filter::kBilerp,
+ GrSamplerState::Filter::kMipMap}) {
rtContext->clear(nullptr, 0xDDCCBBAA, true);
auto fp = GrSimpleTextureEffect::Make(rectProxy, nullptr, SkMatrix::I(), filter);
GrPaint paint;
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index a661d50647..e10c24885b 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -145,9 +145,10 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
GrNoClip noClip;
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- GrSamplerParams mipMapParams(SkShader::kRepeat_TileMode, GrSamplerParams::kMipMap_FilterMode);
- paint.addColorTextureProcessor(std::move(proxy),
- nullptr, SkMatrix::MakeScale(rtS), mipMapParams);
+ GrSamplerState mipMapSamplerState(GrSamplerState::WrapMode::kRepeat,
+ GrSamplerState::Filter::kMipMap);
+ paint.addColorTextureProcessor(std::move(proxy), nullptr, SkMatrix::MakeScale(rtS),
+ mipMapSamplerState);
// 1) Draw texture to S32 surface (should generate/use sRGB mips)
paint.setGammaCorrect(true);