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/SkGpuDevice_drawTexture.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/SkGpuDevice_drawTexture.cpp')
-rw-r--r-- | src/gpu/SkGpuDevice_drawTexture.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp index c861cc919e..c7aeeb1bd7 100644 --- a/src/gpu/SkGpuDevice_drawTexture.cpp +++ b/src/gpu/SkGpuDevice_drawTexture.cpp @@ -114,13 +114,13 @@ static void draw_texture_affine(const SkPaint& paint, const SkMatrix& ctm, const srcToDst.mapRect(&dstRect, srcRect); } auto csxf = GrColorSpaceXform::Make(colorSpace, rtc->getColorSpace()); - GrSamplerParams::FilterMode filter; + GrSamplerState::Filter filter; switch (paint.getFilterQuality()) { case kNone_SkFilterQuality: - filter = GrSamplerParams::kNone_FilterMode; + filter = GrSamplerState::Filter::kNearest; break; case kLow_SkFilterQuality: - filter = GrSamplerParams::kBilerp_FilterMode; + filter = GrSamplerState::Filter::kBilerp; break; case kMedium_SkFilterQuality: case kHigh_SkFilterQuality: @@ -157,9 +157,9 @@ void SkGpuDevice::drawTextureMaker(GrTextureMaker* maker, int imageW, int imageH const SkMatrix& viewMatrix, const SkPaint& paint) { if (can_use_draw_texture_affine(paint, viewMatrix, constraint)) { sk_sp<SkColorSpace> cs; - // We've done enough checks above to allow us to pass ClampNoFilter() and not check for + // We've done enough checks above to allow us to pass ClampNearest() and not check for // scaling adjustments. - auto proxy = maker->refTextureProxyForParams(GrSamplerParams::ClampNoFilter(), + auto proxy = maker->refTextureProxyForParams(GrSamplerState::ClampNearest(), fRenderTargetContext->getColorSpace(), &cs, nullptr); if (!proxy) { @@ -246,10 +246,9 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer, bool canUseTextureCoordsAsLocalCoords = !use_shader(producer->isAlphaOnly(), paint) && !mf; bool doBicubic; - GrSamplerParams::FilterMode fm = - GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), viewMatrix, srcToDstMatrix, - &doBicubic); - const GrSamplerParams::FilterMode* filterMode = doBicubic ? nullptr : &fm; + GrSamplerState::Filter fm = GrSkFilterQualityToGrFilterMode( + paint.getFilterQuality(), viewMatrix, srcToDstMatrix, &doBicubic); + const GrSamplerState::Filter* filterMode = doBicubic ? nullptr : &fm; GrTextureProducer::FilterConstraint constraintMode; if (SkCanvas::kFast_SrcRectConstraint == constraint) { @@ -264,7 +263,7 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer, bool coordsAllInsideSrcRect = !paint.isAntiAlias() && !mf; // Check for optimization to drop the src rect constraint when on bilerp. - if (filterMode && GrSamplerParams::kBilerp_FilterMode == *filterMode && + if (filterMode && GrSamplerState::Filter::kBilerp == *filterMode && GrTextureAdjuster::kYes_FilterConstraint == constraintMode && coordsAllInsideSrcRect) { SkMatrix combinedMatrix; combinedMatrix.setConcat(viewMatrix, srcToDstMatrix); |