diff options
author | Brian Salomon <bsalomon@google.com> | 2017-09-07 12:36:34 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-07 16:58:31 +0000 |
commit | 2bbdcc44c63974f29f3743bb58d929601a3f65c6 (patch) | |
tree | d420f298f606b061054e56866d1930ab84f00ed5 /src/gpu/effects/GrBitmapTextGeoProc.cpp | |
parent | 4df0092eac6e9bb5afc516773a0c618630193dc6 (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/effects/GrBitmapTextGeoProc.cpp')
-rw-r--r-- | src/gpu/effects/GrBitmapTextGeoProc.cpp | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp index d87f7c06a0..c2cf8ebc22 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.cpp +++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp @@ -122,16 +122,15 @@ private: /////////////////////////////////////////////////////////////////////////////// -GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, - sk_sp<GrTextureProxy> proxy, - const GrSamplerParams& params, GrMaskFormat format, +GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, sk_sp<GrTextureProxy> proxy, + const GrSamplerState& params, GrMaskFormat format, const SkMatrix& localMatrix, bool usesLocalCoords) - : fColor(color) - , fLocalMatrix(localMatrix) - , fUsesLocalCoords(usesLocalCoords) - , fTextureSampler(std::move(proxy), params) - , fInColor(nullptr) - , fMaskFormat(format) { + : fColor(color) + , fLocalMatrix(localMatrix) + , fUsesLocalCoords(usesLocalCoords) + , fTextureSampler(std::move(proxy), params) + , fInColor(nullptr) + , fMaskFormat(format) { this->initClassID<GrBitmapTextGeoProc>(); fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType, kHigh_GrSLPrecision); @@ -161,22 +160,17 @@ GrGLSLPrimitiveProcessor* GrBitmapTextGeoProc::createGLSLInstance(const GrShader GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrBitmapTextGeoProc); #if GR_TEST_UTILS + sk_sp<GrGeometryProcessor> GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; sk_sp<GrTextureProxy> proxy = d->textureProxy(texIdx); - static const SkShader::TileMode kTileModes[] = { - SkShader::kClamp_TileMode, - SkShader::kRepeat_TileMode, - SkShader::kMirror_TileMode, - }; - SkShader::TileMode tileModes[] = { - kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], - kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], - }; - GrSamplerParams params(tileModes, d->fRandom->nextBool() ? GrSamplerParams::kBilerp_FilterMode - : GrSamplerParams::kNone_FilterMode); + GrSamplerState::WrapMode wrapModes[2]; + GrTest::TestWrapModes(d->fRandom, wrapModes); + GrSamplerState samplerState(wrapModes, d->fRandom->nextBool() + ? GrSamplerState::Filter::kBilerp + : GrSamplerState::Filter::kNearest); GrMaskFormat format = kARGB_GrMaskFormat; // init to avoid warning switch (d->fRandom->nextULessThan(3)) { @@ -191,8 +185,8 @@ sk_sp<GrGeometryProcessor> GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* break; } - return GrBitmapTextGeoProc::Make(GrRandomColor(d->fRandom), std::move(proxy), - params, format, GrTest::TestMatrix(d->fRandom), + return GrBitmapTextGeoProc::Make(GrRandomColor(d->fRandom), std::move(proxy), samplerState, + format, GrTest::TestMatrix(d->fRandom), d->fRandom->nextBool()); } #endif |