diff options
author | Brian Salomon <bsalomon@google.com> | 2016-11-17 15:17:07 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-17 21:13:18 +0000 |
commit | 514baff8be7f71111aa7bfb9b099a096b31e16ec (patch) | |
tree | 635854f47c42f30de48e739b42eb85aba2f1efb3 /src | |
parent | 7776029b54cc8c21fd6e0c1aa5a3b30e8bb52939 (diff) |
Rename GrTextureParams to GrSamplerParams
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4965
Change-Id: I7d52e81c670e92ca96117284f44b274ce3cc3671
Reviewed-on: https://skia-review.googlesource.com/4965
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src')
63 files changed, 241 insertions, 242 deletions
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp index 8107642783..84cc8d8d14 100644 --- a/src/core/SkGpuBlurUtils.cpp +++ b/src/core/SkGpuBlurUtils.cpp @@ -275,12 +275,12 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context, matrix, domain, GrTextureDomain::kDecal_Mode, - GrTextureParams::kBilerp_FilterMode)); + GrSamplerParams::kBilerp_FilterMode)); paint.addColorFragmentProcessor(std::move(fp)); srcRect.offset(-srcOffset); srcOffset.set(0, 0); } else { - GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode); + GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kBilerp_FilterMode); paint.addColorTextureProcessor(srcTexture.get(), nullptr, matrix, params); } paint.setPorterDuffXPFactory(SkBlendMode::kSrc); @@ -356,7 +356,7 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context, GrPaint paint; paint.setGammaCorrect(dstRenderTargetContext->isGammaCorrect()); // FIXME: this should be mitchell, not bilinear. - GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode); + GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kBilerp_FilterMode); sk_sp<GrTexture> tex(srcRenderTargetContext->asTexture()); paint.addColorTextureProcessor(tex.get(), nullptr, matrix, params); paint.setPorterDuffXPFactory(SkBlendMode::kSrc); diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp index 471dbd6d33..e29124212a 100644 --- a/src/core/SkImageCacherator.cpp +++ b/src/core/SkImageCacherator.cpp @@ -19,7 +19,7 @@ #include "GrGpuResourcePriv.h" #include "GrImageIDTextureAdjuster.h" #include "GrResourceKey.h" -#include "GrTextureParams.h" +#include "GrSamplerParams.h" #include "GrYUVProvider.h" #include "SkGr.h" #include "SkGrPriv.h" @@ -371,7 +371,7 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key /////////////////////////////////////////////////////////////////////////////////////////////////// -GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParams& params, +GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrSamplerParams& params, SkDestinationSurfaceColorMode colorMode, const SkImage* client, SkImage::CachingHint chint) { if (!ctx) { @@ -383,7 +383,7 @@ GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam #else -GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParams&, +GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrSamplerParams&, SkDestinationSurfaceColorMode colorMode, const SkImage* client, SkImage::CachingHint) { return nullptr; diff --git a/src/core/SkImageCacherator.h b/src/core/SkImageCacherator.h index 0e8a953f37..3500206459 100644 --- a/src/core/SkImageCacherator.h +++ b/src/core/SkImageCacherator.h @@ -13,7 +13,7 @@ #include "SkTemplates.h" class GrContext; -class GrTextureParams; +class GrSamplerParams; class GrUniqueKey; class SkBitmap; class SkImage; @@ -50,7 +50,7 @@ public: * * The caller is responsible for calling texture->unref() when they are done. */ - GrTexture* lockAsTexture(GrContext*, const GrTextureParams&, + GrTexture* lockAsTexture(GrContext*, const GrSamplerParams&, SkDestinationSurfaceColorMode colorMode, const SkImage* client, SkImage::CachingHint = SkImage::kAllow_CachingHint); diff --git a/src/core/SkNormalMapSource.cpp b/src/core/SkNormalMapSource.cpp index 25c533cdbf..70d6c4300e 100644 --- a/src/core/SkNormalMapSource.cpp +++ b/src/core/SkNormalMapSource.cpp @@ -18,7 +18,7 @@ #if SK_SUPPORT_GPU #include "GrCoordTransform.h" #include "GrInvariantOutput.h" -#include "GrTextureParams.h" +#include "GrSamplerParams.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "SkGr.h" diff --git a/src/core/SkShadowShader.cpp b/src/core/SkShadowShader.cpp index 9757298e94..db04638f02 100644 --- a/src/core/SkShadowShader.cpp +++ b/src/core/SkShadowShader.cpp @@ -138,7 +138,7 @@ public: // gets deleted when the ShadowFP is destroyed, and frees the GrTexture* fTexture[fNumNonAmbLights] = sk_sp<GrTexture>(shadowMap->asTextureRef(context, - GrTextureParams::ClampNoFilter(), + GrSamplerParams::ClampNoFilter(), SkDestinationSurfaceColorMode::kLegacy)); fDepthMapSampler[fNumNonAmbLights].reset(fTexture[fNumNonAmbLights].get()); this->addTextureSampler(&fDepthMapSampler[fNumNonAmbLights]); diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp index c97eb01257..c25079e816 100644 --- a/src/core/SkSpecialImage.cpp +++ b/src/core/SkSpecialImage.cpp @@ -18,7 +18,7 @@ #if SK_SUPPORT_GPU #include "GrContext.h" #include "GrTexture.h" -#include "GrTextureParams.h" +#include "GrSamplerParams.h" #include "GrTextureProxy.h" #include "SkGr.h" #include "SkGrPriv.h" @@ -102,7 +102,7 @@ sk_sp<SkSpecialImage> SkSpecialImage::makeTextureImage(GrContext* context) { } sk_sp<GrTexture> resultTex( - GrRefCachedBitmapTexture(context, bmp, GrTextureParams::ClampNoFilter(), + GrRefCachedBitmapTexture(context, bmp, GrSamplerParams::ClampNoFilter(), SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware)); if (!resultTex) { return nullptr; @@ -241,7 +241,7 @@ public: sk_sp<GrTexture> onAsTextureRef(GrContext* context) const override { if (context) { return sk_ref_sp( - GrRefCachedBitmapTexture(context, fBitmap, GrTextureParams::ClampNoFilter(), + GrRefCachedBitmapTexture(context, fBitmap, GrSamplerParams::ClampNoFilter(), SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware)); } @@ -253,7 +253,7 @@ public: sk_sp<GrTexture> tex(sk_ref_sp(GrRefCachedBitmapTexture( context, fBitmap, - GrTextureParams::ClampNoFilter(), + GrSamplerParams::ClampNoFilter(), SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware))); sk_sp<GrSurfaceProxy> sProxy = GrSurfaceProxy::MakeWrapped(std::move(tex)); return sk_ref_sp(sProxy->asTextureProxy()); diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp index 4e4dbbe0db..99ce113446 100644 --- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp +++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp @@ -47,12 +47,12 @@ GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor( : fInnerThreshold(innerThreshold) , fOuterThreshold(outerThreshold) , fImageCoordTransform(GrCoordTransform::MakeDivByTextureWHMatrix(texture), texture, - GrTextureParams::kNone_FilterMode) + GrSamplerParams::kNone_FilterMode) , fImageTextureSampler(texture) , fColorSpaceXform(std::move(colorSpaceXform)) , fMaskCoordTransform(make_div_and_translate_matrix(maskTexture, -bounds.x(), -bounds.y()), maskTexture, - GrTextureParams::kNone_FilterMode) + GrSamplerParams::kNone_FilterMode) , fMaskTextureSampler(maskTexture) { this->initClassID<GrAlphaThresholdFragmentProcessor>(); this->addCoordTransform(&fImageCoordTransform); diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp index b8b266045d..8afd009e85 100644 --- a/src/effects/GrCircleBlurFragmentProcessor.cpp +++ b/src/effects/GrCircleBlurFragmentProcessor.cpp @@ -92,7 +92,7 @@ GrCircleBlurFragmentProcessor::GrCircleBlurFragmentProcessor(const SkRect& circl : fCircle(circle) , fSolidRadius(solidRadius) , fTextureRadius(textureRadius) - , fBlurProfileSampler(blurProfile, GrTextureParams::kBilerp_FilterMode) { + , fBlurProfileSampler(blurProfile, GrSamplerParams::kBilerp_FilterMode) { this->initClassID<GrCircleBlurFragmentProcessor>(); this->addTextureSampler(&fBlurProfileSampler); this->setWillReadFragmentPosition(); diff --git a/src/effects/SkColorCubeFilter.cpp b/src/effects/SkColorCubeFilter.cpp index ad35fda8bd..6a15c557c8 100644 --- a/src/effects/SkColorCubeFilter.cpp +++ b/src/effects/SkColorCubeFilter.cpp @@ -209,7 +209,7 @@ private: /////////////////////////////////////////////////////////////////////////////// GrColorCubeEffect::GrColorCubeEffect(GrTexture* colorCube) - : fColorCubeSampler(colorCube, GrTextureParams::kBilerp_FilterMode) { + : fColorCubeSampler(colorCube, GrSamplerParams::kBilerp_FilterMode) { this->initClassID<GrColorCubeEffect>(); this->addTextureSampler(&fColorCubeSampler); } diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index e8767ff9bb..6a8084c1d7 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -485,9 +485,9 @@ GrDisplacementMapEffect::GrDisplacementMapEffect( const SkMatrix& offsetMatrix, GrTexture* color, const SkISize& colorDimensions) - : fDisplacementTransform(offsetMatrix, displacement, GrTextureParams::kNone_FilterMode) + : fDisplacementTransform(offsetMatrix, displacement, GrSamplerParams::kNone_FilterMode) , fDisplacementSampler(displacement) - , fColorTransform(color, GrTextureParams::kNone_FilterMode) + , fColorTransform(color, GrSamplerParams::kNone_FilterMode) , fDomain(GrTextureDomain::MakeTexelDomain(color, SkIRect::MakeSize(colorDimensions)), GrTextureDomain::kDecal_Mode) , fColorSampler(color) diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp index dc28e447ef..d0761d7e32 100644 --- a/src/effects/SkPerlinNoiseShader.cpp +++ b/src/effects/SkPerlinNoiseShader.cpp @@ -926,10 +926,10 @@ sk_sp<GrFragmentProcessor> SkPerlinNoiseShader::asFragmentProcessor(const AsFPAr new PaintingData(fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix); sk_sp<GrTexture> permutationsTexture( GrRefCachedBitmapTexture(args.fContext, paintingData->getPermutationsBitmap(), - GrTextureParams::ClampNoFilter(), args.fColorMode)); + GrSamplerParams::ClampNoFilter(), args.fColorMode)); sk_sp<GrTexture> noiseTexture( GrRefCachedBitmapTexture(args.fContext, paintingData->getNoiseBitmap(), - GrTextureParams::ClampNoFilter(), args.fColorMode)); + GrSamplerParams::ClampNoFilter(), args.fColorMode)); SkMatrix m = *args.fViewMatrix; m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1); diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index 90a785611b..68fd13fdaa 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -474,7 +474,7 @@ sk_sp<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context, SkBitmap b if (-1 == row) { atlas = nullptr; texture.reset( - GrRefCachedBitmapTexture(context, bitmap, GrTextureParams::ClampNoFilter(), + GrRefCachedBitmapTexture(context, bitmap, GrSamplerParams::ClampNoFilter(), SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware)); } else { texture.reset(SkRef(atlas->getTexture())); diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp index 840f652514..a396b3e690 100644 --- a/src/effects/SkXfermodeImageFilter.cpp +++ b/src/effects/SkXfermodeImageFilter.cpp @@ -258,7 +258,7 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::filterImageGPU( GrTextureDomain::MakeTexelDomain(backgroundTex.get(), background->subset()), GrTextureDomain::kDecal_Mode, - GrTextureParams::kNone_FilterMode); + GrSamplerParams::kNone_FilterMode); } else { bgFP = GrConstColorProcessor::Make(GrColor4f::TransparentBlack(), GrConstColorProcessor::kIgnore_InputMode); @@ -277,7 +277,7 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::filterImageGPU( GrTextureDomain::MakeTexelDomain(foregroundTex.get(), foreground->subset()), GrTextureDomain::kDecal_Mode, - GrTextureParams::kNone_FilterMode); + GrSamplerParams::kNone_FilterMode); paint.addColorFragmentProcessor(std::move(foregroundFP)); diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp index fcd0bd3ba9..39f563648b 100644 --- a/src/effects/gradients/SkGradientShader.cpp +++ b/src/effects/gradients/SkGradientShader.cpp @@ -1651,8 +1651,8 @@ GrGradientEffect::GrGradientEffect(const CreateArgs& args) { // We always filter the gradient table. Each table is one row of a texture, always // y-clamp. - GrTextureParams params; - params.setFilterMode(GrTextureParams::kBilerp_FilterMode); + GrSamplerParams params; + params.setFilterMode(GrSamplerParams::kBilerp_FilterMode); params.setTileModeX(args.fTileMode); fRow = fAtlas->lockRow(bitmap); diff --git a/src/gpu/GrCoordTransform.cpp b/src/gpu/GrCoordTransform.cpp index 2da49c43fb..63d91a810f 100644 --- a/src/gpu/GrCoordTransform.cpp +++ b/src/gpu/GrCoordTransform.cpp @@ -11,7 +11,7 @@ #include "GrGpu.h" void GrCoordTransform::reset(const SkMatrix& m, const GrTexture* texture, - GrTextureParams::FilterMode filter) { + GrSamplerParams::FilterMode filter) { SkASSERT(texture); SkASSERT(!fInProcessor); @@ -23,7 +23,7 @@ void GrCoordTransform::reset(const SkMatrix& m, const GrTexture* texture, // coords between 0 to 1 when bi- or tri-lerping and 1 value when nearest filtering. Note that // this still might not be enough when drawing with repeat or mirror-repeat modes but that case // can be arbitrarily bad. - int subPixelThresh = filter > GrTextureParams::kNone_FilterMode ? 4 : 1; + int subPixelThresh = filter > GrSamplerParams::kNone_FilterMode ? 4 : 1; fPrecision = kDefault_GrSLPrecision; if (texture->getContext()) { const GrShaderCaps* caps = texture->getContext()->caps()->shaderCaps(); diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index b775cf0c74..3538b8042f 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -57,7 +57,7 @@ void GrGpu::disconnect(DisconnectType) {} //////////////////////////////////////////////////////////////////////////////// -bool GrGpu::makeCopyForTextureParams(int width, int height, const GrTextureParams& textureParams, +bool GrGpu::makeCopyForTextureParams(int width, int height, const GrSamplerParams& textureParams, GrTextureProducer::CopyParams* copyParams) const { const GrCaps& caps = *this->caps(); if (textureParams.isTiled() && !caps.npotTextureTileSupport() && @@ -65,13 +65,13 @@ bool GrGpu::makeCopyForTextureParams(int width, int height, const GrTextureParam copyParams->fWidth = GrNextPow2(width); copyParams->fHeight = GrNextPow2(height); switch (textureParams.filterMode()) { - case GrTextureParams::kNone_FilterMode: - copyParams->fFilter = GrTextureParams::kNone_FilterMode; + case GrSamplerParams::kNone_FilterMode: + copyParams->fFilter = GrSamplerParams::kNone_FilterMode; break; - case GrTextureParams::kBilerp_FilterMode: - case GrTextureParams::kMipMap_FilterMode: + case GrSamplerParams::kBilerp_FilterMode: + case GrSamplerParams::kMipMap_FilterMode: // We are only ever scaling up so no reason to ever indicate kMipMap. - copyParams->fFilter = GrTextureParams::kBilerp_FilterMode; + copyParams->fFilter = GrSamplerParams::kBilerp_FilterMode; break; } return true; diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index 686820e13f..f88423be66 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -469,16 +469,16 @@ public: virtual void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) = 0; // Determines whether a texture will need to be rescaled in order to be used with the - // GrTextureParams. This variation is called when the caller will create a new texture using the + // GrSamplerParams. This variation is called when the caller will create a new texture using the // texture provider from a non-texture src (cpu-backed image, ...). - bool makeCopyForTextureParams(int width, int height, const GrTextureParams&, + bool makeCopyForTextureParams(int width, int height, const GrSamplerParams&, GrTextureProducer::CopyParams*) const; // Like the above but this variation should be called when the caller is not creating the // original texture but rather was handed the original texture. It adds additional checks // relevant to original textures that were created external to Skia via // GrTextureProvider::wrap methods. - bool makeCopyForTextureParams(GrTexture* texture, const GrTextureParams& params, + bool makeCopyForTextureParams(GrTexture* texture, const GrSamplerParams& params, GrTextureProducer::CopyParams* copyParams) const { if (this->makeCopyForTextureParams(texture->width(), texture->height(), params, copyParams)) { @@ -547,7 +547,7 @@ private: virtual gr_instanced::InstancedRendering* onCreateInstancedRendering() = 0; - virtual bool onMakeCopyForTextureParams(GrTexture* texture, const GrTextureParams&, + virtual bool onMakeCopyForTextureParams(GrTexture* texture, const GrSamplerParams&, GrTextureProducer::CopyParams*) const { return false; } virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp index c6d7f7d60d..d5f8d3d0c1 100644 --- a/src/gpu/GrPaint.cpp +++ b/src/gpu/GrPaint.cpp @@ -38,7 +38,7 @@ void GrPaint::addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& ma void GrPaint::addColorTextureProcessor(GrTexture* texture, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, - const GrTextureParams& params) { + const GrSamplerParams& params) { this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(texture, std::move(colorSpaceXform), matrix, params)); @@ -46,7 +46,7 @@ void GrPaint::addColorTextureProcessor(GrTexture* texture, void GrPaint::addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& matrix, - const GrTextureParams& params) { + const GrSamplerParams& params) { this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(texture, nullptr, matrix, params)); } diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h index cb69756b69..1bff9c6923 100644 --- a/src/gpu/GrPipelineBuilder.h +++ b/src/gpu/GrPipelineBuilder.h @@ -86,14 +86,14 @@ public: void addColorTextureProcessor(GrTexture* texture, const SkMatrix& matrix, - const GrTextureParams& params) { + const GrSamplerParams& params) { this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(texture, nullptr, matrix, params)); } void addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& matrix, - const GrTextureParams& params) { + const GrSamplerParams& params) { this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(texture, nullptr, matrix, params)); } diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp index 77927e4c44..89fc741584 100644 --- a/src/gpu/GrProcessor.cpp +++ b/src/gpu/GrProcessor.cpp @@ -10,7 +10,7 @@ #include "GrGeometryProcessor.h" #include "GrInvariantOutput.h" #include "GrMemoryPool.h" -#include "GrTextureParams.h" +#include "GrSamplerParams.h" #include "GrTexturePriv.h" #include "GrXferProcessor.h" #include "SkSpinlock.h" @@ -155,19 +155,19 @@ bool GrProcessor::hasSameSamplers(const GrProcessor& that) const { GrProcessor::TextureSampler::TextureSampler() {} -GrProcessor::TextureSampler::TextureSampler(GrTexture* texture, const GrTextureParams& params) { +GrProcessor::TextureSampler::TextureSampler(GrTexture* texture, const GrSamplerParams& params) { this->reset(texture, params); } GrProcessor::TextureSampler::TextureSampler(GrTexture* texture, - GrTextureParams::FilterMode filterMode, + GrSamplerParams::FilterMode filterMode, SkShader::TileMode tileXAndY, GrShaderFlags visibility) { this->reset(texture, filterMode, tileXAndY, visibility); } void GrProcessor::TextureSampler::reset(GrTexture* texture, - const GrTextureParams& params, + const GrSamplerParams& params, GrShaderFlags visibility) { SkASSERT(texture); fTexture.set(SkRef(texture), kRead_GrIOType); @@ -177,7 +177,7 @@ void GrProcessor::TextureSampler::reset(GrTexture* texture, } void GrProcessor::TextureSampler::reset(GrTexture* texture, - GrTextureParams::FilterMode filterMode, + GrSamplerParams::FilterMode filterMode, SkShader::TileMode tileXAndY, GrShaderFlags visibility) { SkASSERT(texture); diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp index 9430efb3f2..b5dc81475b 100644 --- a/src/gpu/GrSWMaskHelper.cpp +++ b/src/gpu/GrSWMaskHelper.cpp @@ -192,7 +192,7 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture, GrSimpleTextureEffect::Make(texture, nullptr, maskMatrix, - GrTextureParams::kNone_FilterMode)); + GrSamplerParams::kNone_FilterMode)); sk_sp<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), SkMatrix::I(), diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp index 807fb9b544..ea0ed76517 100644 --- a/src/gpu/GrTexture.cpp +++ b/src/gpu/GrTexture.cpp @@ -70,7 +70,7 @@ GrSurfaceOrigin resolve_origin(const GrSurfaceDesc& desc) { ////////////////////////////////////////////////////////////////////////////// GrTexture::GrTexture(GrGpu* gpu, const GrSurfaceDesc& desc, GrSLType samplerType, - GrTextureParams::FilterMode highestFilterMode, bool wasMipMapDataProvided) + GrSamplerParams::FilterMode highestFilterMode, bool wasMipMapDataProvided) : INHERITED(gpu, desc) , fSamplerType(samplerType) , fHighestFilterMode(highestFilterMode) diff --git a/src/gpu/GrTextureParamsAdjuster.cpp b/src/gpu/GrTextureParamsAdjuster.cpp index fa1fffd2a3..ca273a770f 100644 --- a/src/gpu/GrTextureParamsAdjuster.cpp +++ b/src/gpu/GrTextureParamsAdjuster.cpp @@ -15,7 +15,7 @@ #include "GrGpuResourcePriv.h" #include "GrResourceKey.h" #include "GrTexture.h" -#include "GrTextureParams.h" +#include "GrSamplerParams.h" #include "GrTextureProvider.h" #include "SkCanvas.h" #include "SkGr.h" @@ -52,7 +52,7 @@ static GrTexture* copy_on_gpu(GrTexture* inputTexture, const SkIRect* subset, sy = 1.f / inputTexture->height(); } - if (copyParams.fFilter != GrTextureParams::kNone_FilterMode && subset && + if (copyParams.fFilter != GrSamplerParams::kNone_FilterMode && subset && (subset->width() != copyParams.fWidth || subset->height() != copyParams.fHeight)) { SkRect domain; domain.fLeft = (subset->fLeft + 0.5f) * sx; @@ -61,13 +61,13 @@ static GrTexture* copy_on_gpu(GrTexture* inputTexture, const SkIRect* subset, domain.fBottom = (subset->fBottom - 0.5f) * sy; // This would cause us to read values from outside the subset. Surely, the caller knows // better! - SkASSERT(copyParams.fFilter != GrTextureParams::kMipMap_FilterMode); + SkASSERT(copyParams.fFilter != GrSamplerParams::kMipMap_FilterMode); paint.addColorFragmentProcessor( GrTextureDomainEffect::Make(inputTexture, nullptr, SkMatrix::I(), domain, GrTextureDomain::kClamp_Mode, copyParams.fFilter)); } else { - GrTextureParams params(SkShader::kClamp_TileMode, copyParams.fFilter); + GrSamplerParams params(SkShader::kClamp_TileMode, copyParams.fFilter); paint.addColorTextureProcessor(inputTexture, nullptr, SkMatrix::I(), params); } paint.setPorterDuffXPFactory(SkBlendMode::kSrc); @@ -141,7 +141,7 @@ GrTexture* GrTextureAdjuster::refCopy(const CopyParams& copyParams) { return copy; } -GrTexture* GrTextureAdjuster::refTextureSafeForParams(const GrTextureParams& params, +GrTexture* GrTextureAdjuster::refTextureSafeForParams(const GrSamplerParams& params, SkDestinationSurfaceColorMode colorMode, SkIPoint* outOffset) { GrTexture* texture = this->originalTexture(); @@ -154,12 +154,12 @@ GrTexture* GrTextureAdjuster::refTextureSafeForParams(const GrTextureParams& par return nullptr; } - if (contentArea && GrTextureParams::kMipMap_FilterMode == params.filterMode()) { + if (contentArea && GrSamplerParams::kMipMap_FilterMode == params.filterMode()) { // 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 = GrTextureParams::kBilerp_FilterMode; + copyParams.fFilter = GrSamplerParams::kBilerp_FilterMode; } else if (!context->getGpu()->makeCopyForTextureParams(texture, params, ©Params)) { if (outOffset) { if (contentArea) { @@ -202,7 +202,7 @@ static DomainMode determine_domain_mode( bool coordsLimitedToConstraintRect, int texW, int texH, const SkIRect* textureContentArea, - const GrTextureParams::FilterMode* filterModeOrNullForBicubic, + const GrSamplerParams::FilterMode* filterModeOrNullForBicubic, SkRect* domainRect) { SkASSERT(SkRect::MakeIWH(texW, texH).contains(constraintRect)); @@ -230,17 +230,17 @@ static DomainMode determine_domain_mode( SkScalar filterHalfWidth = 0.f; if (filterModeOrNullForBicubic) { switch (*filterModeOrNullForBicubic) { - case GrTextureParams::kNone_FilterMode: + case GrSamplerParams::kNone_FilterMode: if (coordsLimitedToConstraintRect) { return kNoDomain_DomainMode; } else { filterHalfWidth = 0.f; } break; - case GrTextureParams::kBilerp_FilterMode: + case GrSamplerParams::kBilerp_FilterMode: filterHalfWidth = .5f; break; - case GrTextureParams::kMipMap_FilterMode: + case GrSamplerParams::kMipMap_FilterMode: if (restrictFilterToRect || textureContentArea) { // No domain can save us here. return kTightCopy_DomainMode; @@ -337,7 +337,7 @@ static sk_sp<GrFragmentProcessor> create_fp_for_domain_and_filter( const SkMatrix& textureMatrix, DomainMode domainMode, const SkRect& domain, - const GrTextureParams::FilterMode* filterOrNullForBicubic) { + const GrSamplerParams::FilterMode* filterOrNullForBicubic) { SkASSERT(kTightCopy_DomainMode != domainMode); if (filterOrNullForBicubic) { if (kDomain_DomainMode == domainMode) { @@ -345,7 +345,7 @@ static sk_sp<GrFragmentProcessor> create_fp_for_domain_and_filter( domain, GrTextureDomain::kClamp_Mode, *filterOrNullForBicubic); } else { - GrTextureParams params(SkShader::kClamp_TileMode, *filterOrNullForBicubic); + GrSamplerParams params(SkShader::kClamp_TileMode, *filterOrNullForBicubic); return GrSimpleTextureEffect::Make(texture, std::move(colorSpaceXform), textureMatrix, params); } @@ -367,7 +367,7 @@ sk_sp<GrFragmentProcessor> GrTextureAdjuster::createFragmentProcessor( const SkRect& origConstraintRect, FilterConstraint filterConstraint, bool coordsLimitedToConstraintRect, - const GrTextureParams::FilterMode* filterOrNullForBicubic, + const GrSamplerParams::FilterMode* filterOrNullForBicubic, SkColorSpace* dstColorSpace, SkDestinationSurfaceColorMode colorMode) { @@ -384,7 +384,7 @@ sk_sp<GrFragmentProcessor> GrTextureAdjuster::createFragmentProcessor( } SkRect domain; - GrTextureParams params; + GrSamplerParams params; if (filterOrNullForBicubic) { params.setFilterMode(*filterOrNullForBicubic); } @@ -410,8 +410,8 @@ sk_sp<GrFragmentProcessor> GrTextureAdjuster::createFragmentProcessor( // We only expect MIP maps to require a tight copy. SkASSERT(filterOrNullForBicubic && - GrTextureParams::kMipMap_FilterMode == *filterOrNullForBicubic); - static const GrTextureParams::FilterMode kBilerp = GrTextureParams::kBilerp_FilterMode; + GrSamplerParams::kMipMap_FilterMode == *filterOrNullForBicubic); + static const GrSamplerParams::FilterMode kBilerp = GrSamplerParams::kBilerp_FilterMode; domainMode = determine_domain_mode(*constraintRect, filterConstraint, coordsLimitedToConstraintRect, texture->width(), texture->height(), @@ -429,10 +429,10 @@ sk_sp<GrFragmentProcessor> GrTextureAdjuster::createFragmentProcessor( ////////////////////////////////////////////////////////////////////////////// -GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params, +GrTexture* GrTextureMaker::refTextureForParams(const GrSamplerParams& params, SkDestinationSurfaceColorMode colorMode) { CopyParams copyParams; - bool willBeMipped = params.filterMode() == GrTextureParams::kMipMap_FilterMode; + bool willBeMipped = params.filterMode() == GrSamplerParams::kMipMap_FilterMode; if (!fContext->caps()->mipMapSupport()) { willBeMipped = false; @@ -468,28 +468,28 @@ sk_sp<GrFragmentProcessor> GrTextureMaker::createFragmentProcessor( const SkRect& constraintRect, FilterConstraint filterConstraint, bool coordsLimitedToConstraintRect, - const GrTextureParams::FilterMode* filterOrNullForBicubic, + const GrSamplerParams::FilterMode* filterOrNullForBicubic, SkColorSpace* dstColorSpace, SkDestinationSurfaceColorMode colorMode) { - const GrTextureParams::FilterMode* fmForDetermineDomain = filterOrNullForBicubic; - if (filterOrNullForBicubic && GrTextureParams::kMipMap_FilterMode == *filterOrNullForBicubic && + const GrSamplerParams::FilterMode* fmForDetermineDomain = filterOrNullForBicubic; + if (filterOrNullForBicubic && GrSamplerParams::kMipMap_FilterMode == *filterOrNullForBicubic && kYes_FilterConstraint == filterConstraint) { // TODo: Here we should force a copy restricted to the constraintRect since MIP maps will // read outside the constraint rect. However, as in the adjuster case, we aren't currently // doing that. // We instead we compute the domain as though were bilerping which is only correct if we // only sample level 0. - static const GrTextureParams::FilterMode kBilerp = GrTextureParams::kBilerp_FilterMode; + static const GrSamplerParams::FilterMode kBilerp = GrSamplerParams::kBilerp_FilterMode; fmForDetermineDomain = &kBilerp; } - GrTextureParams params; + GrSamplerParams params; if (filterOrNullForBicubic) { params.reset(SkShader::kClamp_TileMode, *filterOrNullForBicubic); } else { // Bicubic doesn't use filtering for it's texture accesses. - params.reset(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode); + params.reset(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode); } sk_sp<GrTexture> texture(this->refTextureForParams(params, colorMode)); if (!texture) { diff --git a/src/gpu/GrTextureParamsAdjuster.h b/src/gpu/GrTextureParamsAdjuster.h index 1784ab66a7..bf3076ebeb 100644 --- a/src/gpu/GrTextureParamsAdjuster.h +++ b/src/gpu/GrTextureParamsAdjuster.h @@ -8,20 +8,20 @@ #ifndef GrTextureMaker_DEFINED #define GrTextureMaker_DEFINED -#include "GrTextureParams.h" +#include "GrSamplerParams.h" #include "GrResourceKey.h" #include "GrTexture.h" #include "SkTLazy.h" class GrContext; -class GrTextureParams; +class GrSamplerParams; class GrUniqueKey; class SkBitmap; /** * 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 GrTextureParams. There are two immediate subclasses defined + * texture compatible with a given GrSamplerParams. 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, ...). @@ -29,7 +29,7 @@ class SkBitmap; class GrTextureProducer : public SkNoncopyable { public: struct CopyParams { - GrTextureParams::FilterMode fFilter; + GrSamplerParams::FilterMode fFilter; int fWidth; int fHeight; }; @@ -64,7 +64,7 @@ public: const SkRect& constraintRect, FilterConstraint filterConstraint, bool coordsLimitedToConstraintRect, - const GrTextureParams::FilterMode* filterOrNullForBicubic, + const GrSamplerParams::FilterMode* filterOrNullForBicubic, SkColorSpace* dstColorSpace, SkDestinationSurfaceColorMode) = 0; @@ -131,7 +131,7 @@ public: outOffset will be the top-left corner of the subset if a copy is not made. Otherwise, the copy will be tight to the contents and outOffset will be (0, 0). If the copy's size does not match subset's dimensions then the contents are scaled to fit the copy.*/ - GrTexture* refTextureSafeForParams(const GrTextureParams&, SkDestinationSurfaceColorMode, + GrTexture* refTextureSafeForParams(const GrSamplerParams&, SkDestinationSurfaceColorMode, SkIPoint* outOffset); sk_sp<GrFragmentProcessor> createFragmentProcessor( @@ -139,7 +139,7 @@ public: const SkRect& constraintRect, FilterConstraint, bool coordsLimitedToConstraintRect, - const GrTextureParams::FilterMode* filterOrNullForBicubic, + const GrSamplerParams::FilterMode* filterOrNullForBicubic, SkColorSpace* dstColorSpace, SkDestinationSurfaceColorMode) override; @@ -180,14 +180,14 @@ public: /** Returns a texture that is safe for use with the params. If the size of the returned texture does not match width()/height() then the contents of the original must be scaled to fit the texture. */ - GrTexture* refTextureForParams(const GrTextureParams&, SkDestinationSurfaceColorMode); + GrTexture* refTextureForParams(const GrSamplerParams&, SkDestinationSurfaceColorMode); sk_sp<GrFragmentProcessor> createFragmentProcessor( const SkMatrix& textureMatrix, const SkRect& constraintRect, FilterConstraint filterConstraint, bool coordsLimitedToConstraintRect, - const GrTextureParams::FilterMode* filterOrNullForBicubic, + const GrSamplerParams::FilterMode* filterOrNullForBicubic, SkColorSpace* dstColorSpace, SkDestinationSurfaceColorMode) override; diff --git a/src/gpu/GrTexturePriv.h b/src/gpu/GrTexturePriv.h index 8d6057ec3d..d68eb799e8 100644 --- a/src/gpu/GrTexturePriv.h +++ b/src/gpu/GrTexturePriv.h @@ -52,7 +52,7 @@ public: GrSLType samplerType() const { return fTexture->fSamplerType; } /** The filter used is clamped to this value in GrProcessor::TextureSampler. */ - GrTextureParams::FilterMode highestFilterMode() const { return fTexture->fHighestFilterMode; } + GrSamplerParams::FilterMode highestFilterMode() const { return fTexture->fHighestFilterMode; } void setMipColorMode(SkDestinationSurfaceColorMode colorMode) const { fTexture->fMipColorMode = colorMode; diff --git a/src/gpu/GrTextureToYUVPlanes.cpp b/src/gpu/GrTextureToYUVPlanes.cpp index 16aa55b1d5..ff6c707621 100644 --- a/src/gpu/GrTextureToYUVPlanes.cpp +++ b/src/gpu/GrTextureToYUVPlanes.cpp @@ -24,11 +24,11 @@ static bool convert_texture(GrTexture* src, GrRenderTargetContext* dst, int dstW SkScalar xScale = SkIntToScalar(src->width()) / dstW / src->width(); SkScalar yScale = SkIntToScalar(src->height()) / dstH / src->height(); - GrTextureParams::FilterMode filter; + GrSamplerParams::FilterMode filter; if (dstW == src->width() && dstW == src->height()) { - filter = GrTextureParams::kNone_FilterMode; + filter = GrSamplerParams::kNone_FilterMode; } else { - filter = GrTextureParams::kBilerp_FilterMode; + filter = GrSamplerParams::kBilerp_FilterMode; } sk_sp<GrFragmentProcessor> fp( diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 7f88790909..82c7089469 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -747,7 +747,7 @@ static void determine_clipped_src_rect(int width, int height, bool SkGpuDevice::shouldTileImageID(uint32_t imageID, const SkIRect& imageRect, const SkMatrix& viewMatrix, const SkMatrix& srcToDstRect, - const GrTextureParams& params, + const GrSamplerParams& params, const SkRect* srcRectPtr, int maxTileSize, int* tileSize, @@ -804,15 +804,15 @@ bool SkGpuDevice::shouldTileImage(const SkImage* image, const SkRect* srcRectPtr return false; } - GrTextureParams params; + GrSamplerParams params; bool doBicubic; - GrTextureParams::FilterMode textureFilterMode = + GrSamplerParams::FilterMode textureFilterMode = GrSkFilterQualityToGrFilterMode(quality, viewMatrix, srcToDstRect, &doBicubic); int tileFilterPad; if (doBicubic) { tileFilterPad = GrBicubicEffect::kFilterTexelPad; - } else if (GrTextureParams::kNone_FilterMode == textureFilterMode) { + } else if (GrSamplerParams::kNone_FilterMode == textureFilterMode) { tileFilterPad = 0; } else { tileFilterPad = 1; @@ -855,9 +855,9 @@ void SkGpuDevice::drawBitmap(const SkDraw& origDraw, int tileSize; SkIRect clippedSrcRect; - GrTextureParams params; + GrSamplerParams params; bool doBicubic; - GrTextureParams::FilterMode textureFilterMode = + GrSamplerParams::FilterMode textureFilterMode = GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), viewMatrix, SkMatrix::I(), &doBicubic); @@ -865,7 +865,7 @@ void SkGpuDevice::drawBitmap(const SkDraw& origDraw, if (doBicubic) { tileFilterPad = GrBicubicEffect::kFilterTexelPad; - } else if (GrTextureParams::kNone_FilterMode == textureFilterMode) { + } else if (GrSamplerParams::kNone_FilterMode == textureFilterMode) { tileFilterPad = 0; } else { tileFilterPad = 1; @@ -927,7 +927,7 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap, const SkMatrix& dstMatrix, const SkRect& srcRect, const SkIRect& clippedSrcIRect, - const GrTextureParams& params, + const GrSamplerParams& params, const SkPaint& origPaint, SkCanvas::SrcRectConstraint constraint, int tileSize, @@ -979,7 +979,7 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap, SkRect rectToDraw = SkRect::MakeXYWH(offset.fX, offset.fY, tileR.width(), tileR.height()); dstMatrix.mapRect(&rectToDraw); - if (GrTextureParams::kNone_FilterMode != params.filterMode() || bicubic) { + if (GrSamplerParams::kNone_FilterMode != params.filterMode() || bicubic) { SkIRect iClampRect; if (SkCanvas::kFast_SrcRectConstraint == constraint) { @@ -1000,7 +1000,7 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap, if (bitmap.extractSubset(&tmpB, iTileR)) { // now offset it to make it "local" to our tmp bitmap tileR.offset(-offset.fX, -offset.fY); - GrTextureParams paramsTemp = params; + GrSamplerParams paramsTemp = params; // de-optimized this determination bool needsTextureDomain = true; this->drawBitmapTile(tmpB, @@ -1021,7 +1021,7 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap, const SkMatrix& viewMatrix, const SkRect& dstRect, const SkRect& srcRect, - const GrTextureParams& params, + const GrSamplerParams& params, const SkPaint& paint, SkCanvas::SrcRectConstraint constraint, bool bicubic, @@ -1077,7 +1077,7 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap, params.filterMode()); } } else if (bicubic) { - SkASSERT(GrTextureParams::kNone_FilterMode == params.filterMode()); + SkASSERT(GrSamplerParams::kNone_FilterMode == params.filterMode()); SkShader::TileMode tileModes[2] = { params.getTileModeX(), params.getTileModeY() }; fp = GrBicubicEffect::Make(texture.get(), std::move(colorSpaceXform), texMatrix, tileModes); } else { @@ -1113,7 +1113,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap, // draw sprite neither filters nor tiles. texture.reset( - GrRefCachedBitmapTexture(fContext.get(), bitmap, GrTextureParams::ClampNoFilter(), + GrRefCachedBitmapTexture(fContext.get(), bitmap, GrSamplerParams::ClampNoFilter(), SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware)); if (!texture) { return; @@ -1244,9 +1244,9 @@ void SkGpuDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, int tileSize; SkIRect clippedSrcRect; - GrTextureParams params; + GrSamplerParams params; bool doBicubic; - GrTextureParams::FilterMode textureFilterMode = + GrSamplerParams::FilterMode textureFilterMode = GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), *draw.fMatrix, srcToDstMatrix, &doBicubic); @@ -1254,7 +1254,7 @@ void SkGpuDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, if (doBicubic) { tileFilterPad = GrBicubicEffect::kFilterTexelPad; - } else if (GrTextureParams::kNone_FilterMode == textureFilterMode) { + } else if (GrSamplerParams::kNone_FilterMode == textureFilterMode) { tileFilterPad = 0; } else { tileFilterPad = 1; @@ -1281,7 +1281,7 @@ sk_sp<SkSpecialImage> SkGpuDevice::makeSpecial(const SkBitmap& bitmap) { } sk_sp<GrTexture> texture = - GrMakeCachedBitmapTexture(fContext.get(), bitmap, GrTextureParams::ClampNoFilter(), + GrMakeCachedBitmapTexture(fContext.get(), bitmap, GrSamplerParams::ClampNoFilter(), SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware); if (!texture) { return nullptr; @@ -1436,10 +1436,10 @@ void SkGpuDevice::drawProducerNine(const SkDraw& draw, GrTextureProducer* produc bool useFallback = paint.getMaskFilter() || paint.isAntiAlias() || fRenderTargetContext->isUnifiedMultisampled(); bool doBicubic; - GrTextureParams::FilterMode textureFilterMode = + GrSamplerParams::FilterMode textureFilterMode = GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), *draw.fMatrix, SkMatrix::I(), &doBicubic); - if (useFallback || doBicubic || GrTextureParams::kNone_FilterMode != textureFilterMode) { + if (useFallback || doBicubic || GrSamplerParams::kNone_FilterMode != textureFilterMode) { SkLatticeIter iter(producer->width(), producer->height(), center, dst); SkRect srcR, dstR; @@ -1450,7 +1450,7 @@ void SkGpuDevice::drawProducerNine(const SkDraw& draw, GrTextureProducer* produc return; } - static const GrTextureParams::FilterMode kMode = GrTextureParams::kNone_FilterMode; + static const GrSamplerParams::FilterMode kMode = GrSamplerParams::kNone_FilterMode; sk_sp<GrFragmentProcessor> fp( producer->createFragmentProcessor(SkMatrix::I(), SkRect::MakeIWH(producer->width(), producer->height()), @@ -1504,7 +1504,7 @@ void SkGpuDevice::drawProducerLattice(const SkDraw& draw, GrTextureProducer* pro CHECK_SHOULD_DRAW(draw); - static const GrTextureParams::FilterMode kMode = GrTextureParams::kNone_FilterMode; + static const GrSamplerParams::FilterMode kMode = GrSamplerParams::kNone_FilterMode; sk_sp<GrFragmentProcessor> fp( producer->createFragmentProcessor(SkMatrix::I(), SkRect::MakeIWH(producer->width(), producer->height()), diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h index b81da4e0ec..098505074a 100644 --- a/src/gpu/SkGpuDevice.h +++ b/src/gpu/SkGpuDevice.h @@ -169,7 +169,7 @@ private: bool shouldTileImageID(uint32_t imageID, const SkIRect& imageRect, const SkMatrix& viewMatrix, const SkMatrix& srcToDstRectMatrix, - const GrTextureParams& params, + const GrSamplerParams& params, const SkRect* srcRectPtr, int maxTileSize, int* tileSize, @@ -192,7 +192,7 @@ private: const SkMatrix& srcToDstMatrix, const SkRect& srcRect, const SkIRect& clippedSrcRect, - const GrTextureParams& params, + const GrSamplerParams& params, const SkPaint& paint, SkCanvas::SrcRectConstraint, int tileSize, @@ -203,7 +203,7 @@ private: const SkMatrix& viewMatrix, const SkRect& dstRect, const SkRect& srcRect, - const GrTextureParams& params, + const GrSamplerParams& params, const SkPaint& paint, SkCanvas::SrcRectConstraint, bool bicubic, diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp index f232e19906..74afca9beb 100644 --- a/src/gpu/SkGpuDevice_drawTexture.cpp +++ b/src/gpu/SkGpuDevice_drawTexture.cpp @@ -163,10 +163,10 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer, bool canUseTextureCoordsAsLocalCoords = !use_shader(producer->isAlphaOnly(), paint) && !mf; bool doBicubic; - GrTextureParams::FilterMode fm = + GrSamplerParams::FilterMode fm = GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), viewMatrix, srcToDstMatrix, &doBicubic); - const GrTextureParams::FilterMode* filterMode = doBicubic ? nullptr : &fm; + const GrSamplerParams::FilterMode* filterMode = doBicubic ? nullptr : &fm; GrTextureAdjuster::FilterConstraint constraintMode; if (SkCanvas::kFast_SrcRectConstraint == constraint) { @@ -181,7 +181,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 && GrTextureParams::kBilerp_FilterMode == *filterMode && + if (filterMode && GrSamplerParams::kBilerp_FilterMode == *filterMode && GrTextureAdjuster::kYes_FilterConstraint == constraintMode && coordsAllInsideSrcRect) { SkMatrix combinedMatrix; combinedMatrix.setConcat(viewMatrix, srcToDstMatrix); diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index d74e259fef..f1a3caaa2a 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -424,13 +424,13 @@ GrTexture* GrUploadMipMapToTexture(GrContext* ctx, const SkImageInfo& info, } GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap, - const GrTextureParams& params, + const GrSamplerParams& params, SkDestinationSurfaceColorMode colorMode) { return GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params, colorMode); } sk_sp<GrTexture> GrMakeCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap, - const GrTextureParams& params, + const GrSamplerParams& params, SkDestinationSurfaceColorMode colorMode) { GrTexture* tex = GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params, colorMode); return sk_sp<GrTexture>(tex); @@ -806,27 +806,27 @@ bool SkPaintToGrPaintWithTexture(GrContext* context, //////////////////////////////////////////////////////////////////////////////////////////////// -GrTextureParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality paintFilterQuality, +GrSamplerParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality paintFilterQuality, const SkMatrix& viewM, const SkMatrix& localM, bool* doBicubic) { *doBicubic = false; - GrTextureParams::FilterMode textureFilterMode; + GrSamplerParams::FilterMode textureFilterMode; switch (paintFilterQuality) { case kNone_SkFilterQuality: - textureFilterMode = GrTextureParams::kNone_FilterMode; + textureFilterMode = GrSamplerParams::kNone_FilterMode; break; case kLow_SkFilterQuality: - textureFilterMode = GrTextureParams::kBilerp_FilterMode; + textureFilterMode = GrSamplerParams::kBilerp_FilterMode; break; case kMedium_SkFilterQuality: { SkMatrix matrix; matrix.setConcat(viewM, localM); if (matrix.getMinScale() < SK_Scalar1) { - textureFilterMode = GrTextureParams::kMipMap_FilterMode; + textureFilterMode = GrSamplerParams::kMipMap_FilterMode; } else { // Don't trigger MIP level generation unnecessarily. - textureFilterMode = GrTextureParams::kBilerp_FilterMode; + textureFilterMode = GrSamplerParams::kBilerp_FilterMode; } break; } @@ -838,7 +838,7 @@ GrTextureParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality pain } default: // Should be unreachable. If not, fall back to mipmaps. - textureFilterMode = GrTextureParams::kMipMap_FilterMode; + textureFilterMode = GrSamplerParams::kMipMap_FilterMode; break; } diff --git a/src/gpu/SkGrPriv.h b/src/gpu/SkGrPriv.h index bd1d7155e6..bb41aad87e 100644 --- a/src/gpu/SkGrPriv.h +++ b/src/gpu/SkGrPriv.h @@ -20,7 +20,6 @@ class GrRenderTargetContext; class GrFragmentProcessor; class GrPaint; class GrTexture; -class GrTextureParams; class GrUniqueKey; class SkData; class SkPaint; diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp index bea604d702..a9ef6cdb0e 100644 --- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp +++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp @@ -193,7 +193,7 @@ private: flags |= ctm.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0; flags |= fGammaCorrect ? kGammaCorrect_DistanceFieldEffectFlag : 0; - GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBilerp_FilterMode); + GrSamplerParams params(SkShader::kRepeat_TileMode, GrSamplerParams::kBilerp_FilterMode); FlushInfo flushInfo; diff --git a/src/gpu/batches/GrAtlasTextBatch.cpp b/src/gpu/batches/GrAtlasTextBatch.cpp index e9bb7f4db4..fe5c3b92e6 100644 --- a/src/gpu/batches/GrAtlasTextBatch.cpp +++ b/src/gpu/batches/GrAtlasTextBatch.cpp @@ -103,7 +103,7 @@ void GrAtlasTextBatch::onPrepareDraws(Target* target) const { flushInfo.fGeometryProcessor = this->setupDfProcessor(this->viewMatrix(), fFilteredColor, this->color(), texture); } else { - GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode); + GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode); flushInfo.fGeometryProcessor = GrBitmapTextGeoProc::Make(this->color(), texture, params, @@ -249,7 +249,7 @@ sk_sp<GrGeometryProcessor> GrAtlasTextBatch::setupDfProcessor(const SkMatrix& vi SkColor filteredColor, GrColor color, GrTexture* texture) const { - GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode); + GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kBilerp_FilterMode); bool isLCD = this->isLCD(); // set up any flags uint32_t flags = viewMatrix.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0; diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp index 335ef161fc..4ea358ea10 100644 --- a/src/gpu/effects/GrBicubicEffect.cpp +++ b/src/gpu/effects/GrBicubicEffect.cpp @@ -153,7 +153,7 @@ GrBicubicEffect::GrBicubicEffect(GrTexture* texture, const SkMatrix &matrix, const SkShader::TileMode tileModes[2]) : INHERITED(texture, nullptr, matrix, - GrTextureParams(tileModes, GrTextureParams::kNone_FilterMode)) + GrSamplerParams(tileModes, GrSamplerParams::kNone_FilterMode)) , fDomain(GrTextureDomain::IgnoredDomain()) , fColorSpaceXform(std::move(colorSpaceXform)) { this->initClassID<GrBicubicEffect>(); @@ -166,7 +166,7 @@ GrBicubicEffect::GrBicubicEffect(GrTexture* texture, const SkMatrix &matrix, const SkRect& domain) : INHERITED(texture, nullptr, matrix, - GrTextureParams(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode)) + GrSamplerParams(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode)) , fDomain(domain, GrTextureDomain::kClamp_Mode) , fColorSpaceXform(std::move(colorSpaceXform)) { this->initClassID<GrBicubicEffect>(); @@ -212,9 +212,9 @@ sk_sp<GrFragmentProcessor> GrBicubicEffect::TestCreate(GrProcessorTestData* d) { ////////////////////////////////////////////////////////////////////////////// bool GrBicubicEffect::ShouldUseBicubic(const SkMatrix& matrix, - GrTextureParams::FilterMode* filterMode) { + GrSamplerParams::FilterMode* filterMode) { if (matrix.isIdentity()) { - *filterMode = GrTextureParams::kNone_FilterMode; + *filterMode = GrSamplerParams::kNone_FilterMode; return false; } @@ -222,22 +222,22 @@ bool GrBicubicEffect::ShouldUseBicubic(const SkMatrix& matrix, if (!matrix.getMinMaxScales(scales) || scales[0] < SK_Scalar1) { // Bicubic doesn't handle arbitrary minimization well, as src texels can be skipped // entirely, - *filterMode = GrTextureParams::kMipMap_FilterMode; + *filterMode = GrSamplerParams::kMipMap_FilterMode; return false; } // At this point if scales[1] == SK_Scalar1 then the matrix doesn't do any scaling. if (scales[1] == SK_Scalar1) { if (matrix.rectStaysRect() && SkScalarIsInt(matrix.getTranslateX()) && SkScalarIsInt(matrix.getTranslateY())) { - *filterMode = GrTextureParams::kNone_FilterMode; + *filterMode = GrSamplerParams::kNone_FilterMode; } else { // Use bilerp to handle rotation or fractional translation. - *filterMode = GrTextureParams::kBilerp_FilterMode; + *filterMode = GrSamplerParams::kBilerp_FilterMode; } return false; } // When we use the bicubic filtering effect each sample is read from the texture using // nearest neighbor sampling. - *filterMode = GrTextureParams::kNone_FilterMode; + *filterMode = GrSamplerParams::kNone_FilterMode; return true; } diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h index 58bb068d5f..61ce7eb08a 100644 --- a/src/gpu/effects/GrBicubicEffect.h +++ b/src/gpu/effects/GrBicubicEffect.h @@ -93,7 +93,7 @@ public: * kNearest). */ static bool ShouldUseBicubic(const SkMatrix& localCoordsToDevice, - GrTextureParams::FilterMode* filterMode); + GrSamplerParams::FilterMode* filterMode); private: GrBicubicEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkScalar coefficients[16], diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp index 11c7982713..76dc123275 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.cpp +++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp @@ -125,7 +125,7 @@ private: /////////////////////////////////////////////////////////////////////////////// GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture, - const GrTextureParams& params, GrMaskFormat format, + const GrSamplerParams& params, GrMaskFormat format, const SkMatrix& localMatrix, bool usesLocalCoords) : fColor(color) , fLocalMatrix(localMatrix) @@ -160,8 +160,8 @@ GrGLSLPrimitiveProcessor* GrBitmapTextGeoProc::createGLSLInstance(const GrGLSLCa GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrBitmapTextGeoProc); sk_sp<GrGeometryProcessor> GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* d) { - int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : - GrProcessorUnitTest::kAlphaTextureIdx; + int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx + : GrProcessorUnitTest::kAlphaTextureIdx; static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, @@ -171,8 +171,8 @@ sk_sp<GrGeometryProcessor> GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], }; - GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode : - GrTextureParams::kNone_FilterMode); + GrSamplerParams params(tileModes, d->fRandom->nextBool() ? GrSamplerParams::kBilerp_FilterMode + : GrSamplerParams::kNone_FilterMode); GrMaskFormat format = kARGB_GrMaskFormat; // init to avoid warning switch (d->fRandom->nextULessThan(3)) { diff --git a/src/gpu/effects/GrBitmapTextGeoProc.h b/src/gpu/effects/GrBitmapTextGeoProc.h index 7e2df0a6e7..c8fc99b020 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.h +++ b/src/gpu/effects/GrBitmapTextGeoProc.h @@ -16,12 +16,12 @@ class GrInvariantOutput; /** * The output color of this effect is a modulation of the input color and a sample from a texture. - * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input + * It allows explicit specification of the filtering and wrap modes (GrSamplerParams). The input * coords are a custom attribute. */ class GrBitmapTextGeoProc : public GrGeometryProcessor { public: - static sk_sp<GrGeometryProcessor> Make(GrColor color, GrTexture* tex, const GrTextureParams& p, + static sk_sp<GrGeometryProcessor> Make(GrColor color, GrTexture* tex, const GrSamplerParams& p, GrMaskFormat format, const SkMatrix& localMatrix, bool usesLocalCoords) { return sk_sp<GrGeometryProcessor>( @@ -47,7 +47,7 @@ public: GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps) const override; private: - GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& params, + GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrSamplerParams& params, GrMaskFormat format, const SkMatrix& localMatrix, bool usesLocalCoords); GrColor fColor; diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp index 8de6cd26a4..d5476d495c 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -230,7 +230,7 @@ private: GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color, const SkMatrix& viewMatrix, GrTexture* texture, - const GrTextureParams& params, + const GrSamplerParams& params, #ifdef SK_GAMMA_APPLY_TO_A8 float distanceAdjust, #endif @@ -280,8 +280,8 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldA8TextGeoProc::TestCreate(GrProcessorT kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], }; - GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode : - GrTextureParams::kNone_FilterMode); + GrSamplerParams params(tileModes, d->fRandom->nextBool() ? GrSamplerParams::kBilerp_FilterMode + : GrSamplerParams::kNone_FilterMode); uint32_t flags = 0; flags |= d->fRandom->nextBool() ? kSimilarity_DistanceFieldEffectFlag : 0; @@ -479,7 +479,7 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc( GrColor color, const SkMatrix& viewMatrix, GrTexture* texture, - const GrTextureParams& params, + const GrSamplerParams& params, uint32_t flags, bool usesLocalCoords) : fColor(color) @@ -522,8 +522,8 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldPathGeoProc::TestCreate(GrProcessorTes kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], }; - GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode - : GrTextureParams::kNone_FilterMode); + GrSamplerParams params(tileModes, d->fRandom->nextBool() ? GrSamplerParams::kBilerp_FilterMode + : GrSamplerParams::kNone_FilterMode); uint32_t flags = 0; flags |= d->fRandom->nextBool() ? kSimilarity_DistanceFieldEffectFlag : 0; @@ -781,7 +781,7 @@ private: GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc( GrColor color, const SkMatrix& viewMatrix, - GrTexture* texture, const GrTextureParams& params, + GrTexture* texture, const GrSamplerParams& params, DistanceAdjust distanceAdjust, uint32_t flags, bool usesLocalCoords) : fColor(color) @@ -825,8 +825,8 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldLCDTextGeoProc::TestCreate(GrProcessor kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], }; - GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode : - GrTextureParams::kNone_FilterMode); + GrSamplerParams params(tileModes, d->fRandom->nextBool() ? GrSamplerParams::kBilerp_FilterMode + : GrSamplerParams::kNone_FilterMode); DistanceAdjust wa = { 0.0f, 0.1f, -0.1f }; uint32_t flags = kUseLCD_DistanceFieldEffectFlag; flags |= d->fRandom->nextBool() ? kSimilarity_DistanceFieldEffectFlag : 0; diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.h b/src/gpu/effects/GrDistanceFieldGeoProc.h index 68e0a24911..880c4e18dc 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.h +++ b/src/gpu/effects/GrDistanceFieldGeoProc.h @@ -43,14 +43,14 @@ enum GrDistanceFieldEffectFlags { /** * The output color of this effect is a modulation of the input color and a sample from a * distance field texture (using a smoothed step function near 0.5). - * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input + * It allows explicit specification of the filtering and wrap modes (GrSamplerParams). The input * coords are a custom attribute. Gamma correction is handled via a texture LUT. */ class GrDistanceFieldA8TextGeoProc : public GrGeometryProcessor { public: #ifdef SK_GAMMA_APPLY_TO_A8 static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& viewMatrix, - GrTexture* tex, const GrTextureParams& params, + GrTexture* tex, const GrSamplerParams& params, float lum, uint32_t flags, bool usesLocalCoords) { return sk_sp<GrGeometryProcessor>( new GrDistanceFieldA8TextGeoProc(color, viewMatrix, tex, params, lum, flags, @@ -58,7 +58,7 @@ public: } #else static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& viewMatrix, - GrTexture* tex, const GrTextureParams& params, + GrTexture* tex, const GrSamplerParams& params, uint32_t flags, bool usesLocalCoords) { return sk_sp<GrGeometryProcessor>( new GrDistanceFieldA8TextGeoProc(color, viewMatrix, tex, params, flags, @@ -88,7 +88,7 @@ public: private: GrDistanceFieldA8TextGeoProc(GrColor, const SkMatrix& viewMatrix, - GrTexture* texture, const GrTextureParams& params, + GrTexture* texture, const GrSamplerParams& params, #ifdef SK_GAMMA_APPLY_TO_A8 float distanceAdjust, #endif @@ -115,13 +115,13 @@ private: /** * The output color of this effect is a modulation of the input color and a sample from a * distance field texture (using a smoothed step function near 0.5). -* It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input +* It allows explicit specification of the filtering and wrap modes (GrSamplerParams). The input * coords are a custom attribute. No gamma correct blending is applied. Used for paths only. */ class GrDistanceFieldPathGeoProc : public GrGeometryProcessor { public: static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& viewMatrix, - GrTexture* tex, const GrTextureParams& params, + GrTexture* tex, const GrSamplerParams& params, uint32_t flags, bool usesLocalCoords) { return sk_sp<GrGeometryProcessor>( new GrDistanceFieldPathGeoProc(color, viewMatrix, tex, params, flags, usesLocalCoords)); @@ -146,7 +146,7 @@ public: private: GrDistanceFieldPathGeoProc(GrColor, const SkMatrix& viewMatrix, GrTexture* texture, - const GrTextureParams& params, uint32_t flags, + const GrSamplerParams& params, uint32_t flags, bool usesLocalCoords); GrColor fColor; @@ -166,7 +166,7 @@ private: /** * The output color of this effect is a modulation of the input color and samples from a * distance field texture (using a smoothed step function near 0.5), adjusted for LCD displays. - * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input + * It allows explicit specification of the filtering and wrap modes (GrSamplerParams). The input * coords are a custom attribute. Gamma correction is handled via a texture LUT. */ class GrDistanceFieldLCDTextGeoProc : public GrGeometryProcessor { @@ -187,7 +187,7 @@ public: }; static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& viewMatrix, - GrTexture* tex, const GrTextureParams& params, + GrTexture* tex, const GrSamplerParams& params, DistanceAdjust distanceAdjust, uint32_t flags, bool usesLocalCoords) { return sk_sp<GrGeometryProcessor>( @@ -215,7 +215,7 @@ public: private: GrDistanceFieldLCDTextGeoProc(GrColor, const SkMatrix& viewMatrix, - GrTexture* texture, const GrTextureParams& params, + GrTexture* texture, const GrSamplerParams& params, DistanceAdjust wa, uint32_t flags, bool usesLocalCoords); diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp index beb64d582d..1c213a759d 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.cpp +++ b/src/gpu/effects/GrSimpleTextureEffect.cpp @@ -81,8 +81,8 @@ sk_sp<GrFragmentProcessor> GrSimpleTextureEffect::TestCreate(GrProcessorTestData kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], }; - GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode : - GrTextureParams::kNone_FilterMode); + GrSamplerParams params(tileModes, d->fRandom->nextBool() ? GrSamplerParams::kBilerp_FilterMode : + GrSamplerParams::kNone_FilterMode); const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom); auto colorSpaceXform = GrTest::TestColorXform(d->fRandom); diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h index fced736183..ccb590e297 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.h +++ b/src/gpu/effects/GrSimpleTextureEffect.h @@ -14,7 +14,7 @@ class GrInvariantOutput; /** * The output color of this effect is a modulation of the input color and a sample from a texture. - * It allows explicit specification of the filtering and wrap modes (GrTextureParams) and accepts + * It allows explicit specification of the filtering and wrap modes (GrSamplerParams) and accepts * a matrix that is used to compute texture coordinates from local coordinates. */ class GrSimpleTextureEffect : public GrSingleTextureEffect { @@ -25,14 +25,14 @@ public: const SkMatrix& matrix) { return sk_sp<GrFragmentProcessor>( new GrSimpleTextureEffect(tex, std::move(colorSpaceXform), matrix, - GrTextureParams::kNone_FilterMode)); + GrSamplerParams::kNone_FilterMode)); } /* clamp mode */ static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, - GrTextureParams::FilterMode filterMode) { + GrSamplerParams::FilterMode filterMode) { return sk_sp<GrFragmentProcessor>( new GrSimpleTextureEffect(tex, std::move(colorSpaceXform), matrix, filterMode)); } @@ -40,7 +40,7 @@ public: static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, - const GrTextureParams& p) { + const GrSamplerParams& p) { return sk_sp<GrFragmentProcessor>(new GrSimpleTextureEffect(tex, std::move(colorSpaceXform), matrix, p)); } @@ -53,7 +53,7 @@ private: GrSimpleTextureEffect(GrTexture* texture, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, - GrTextureParams::FilterMode filterMode) + GrSamplerParams::FilterMode filterMode) : GrSingleTextureEffect(texture, std::move(colorSpaceXform), matrix, filterMode) { this->initClassID<GrSimpleTextureEffect>(); } @@ -61,7 +61,7 @@ private: GrSimpleTextureEffect(GrTexture* texture, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, - const GrTextureParams& params) + const GrSamplerParams& params) : GrSingleTextureEffect(texture, std::move(colorSpaceXform), matrix, params) { this->initClassID<GrSimpleTextureEffect>(); } diff --git a/src/gpu/effects/GrSingleTextureEffect.cpp b/src/gpu/effects/GrSingleTextureEffect.cpp index 929275e3ad..425e367178 100644 --- a/src/gpu/effects/GrSingleTextureEffect.cpp +++ b/src/gpu/effects/GrSingleTextureEffect.cpp @@ -10,7 +10,7 @@ GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& m) - : fCoordTransform(m, texture, GrTextureParams::kNone_FilterMode) + : fCoordTransform(m, texture, GrSamplerParams::kNone_FilterMode) , fTextureSampler(texture) , fColorSpaceXform(std::move(colorSpaceXform)) { this->addCoordTransform(&fCoordTransform); @@ -20,7 +20,7 @@ GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture, GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& m, - GrTextureParams::FilterMode filterMode) + GrSamplerParams::FilterMode filterMode) : fCoordTransform(m, texture, filterMode) , fTextureSampler(texture, filterMode) , fColorSpaceXform(std::move(colorSpaceXform)) { @@ -31,7 +31,7 @@ GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture, GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& m, - const GrTextureParams& params) + const GrSamplerParams& params) : fCoordTransform(m, texture, params.filterMode()) , fTextureSampler(texture, params) , fColorSpaceXform(std::move(colorSpaceXform)) { diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h index fd1ba9803a..716ad2f294 100644 --- a/src/gpu/effects/GrSingleTextureEffect.h +++ b/src/gpu/effects/GrSingleTextureEffect.h @@ -37,11 +37,11 @@ protected: GrSingleTextureEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkMatrix&); /** clamp mode */ GrSingleTextureEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkMatrix&, - GrTextureParams::FilterMode filterMode); + GrSamplerParams::FilterMode filterMode); GrSingleTextureEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkMatrix&, - const GrTextureParams&); + const GrSamplerParams&); /** * Can be used as a helper to implement subclass onComputeInvariantOutput(). It assumes that diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index a05a793026..51f305115a 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -176,7 +176,7 @@ sk_sp<GrFragmentProcessor> GrTextureDomainEffect::Make(GrTexture* texture, const SkMatrix& matrix, const SkRect& domain, GrTextureDomain::Mode mode, - GrTextureParams::FilterMode filterMode) { + GrSamplerParams::FilterMode filterMode) { static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1}; if (GrTextureDomain::kIgnore_Mode == mode || (GrTextureDomain::kClamp_Mode == mode && domain.contains(kFullRect))) { @@ -193,11 +193,11 @@ GrTextureDomainEffect::GrTextureDomainEffect(GrTexture* texture, const SkMatrix& matrix, const SkRect& domain, GrTextureDomain::Mode mode, - GrTextureParams::FilterMode filterMode) + GrSamplerParams::FilterMode filterMode) : GrSingleTextureEffect(texture, std::move(colorSpaceXform), matrix, filterMode) , fTextureDomain(domain, mode) { SkASSERT(mode != GrTextureDomain::kRepeat_Mode || - filterMode == GrTextureParams::kNone_FilterMode); + filterMode == GrSamplerParams::kNone_FilterMode); this->initClassID<GrTextureDomainEffect>(); } @@ -280,7 +280,7 @@ sk_sp<GrFragmentProcessor> GrTextureDomainEffect::TestCreate(GrProcessorTestData matrix, domain, mode, - bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_FilterMode); + bilerp ? GrSamplerParams::kBilerp_FilterMode : GrSamplerParams::kNone_FilterMode); } /////////////////////////////////////////////////////////////////////////////// @@ -293,7 +293,7 @@ sk_sp<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::Make(GrTe GrDeviceSpaceTextureDecalFragmentProcessor::GrDeviceSpaceTextureDecalFragmentProcessor( GrTexture* texture, const SkIRect& subset, const SkIPoint& deviceSpaceOffset) - : fTextureSampler(texture, GrTextureParams::ClampNoFilter()) + : fTextureSampler(texture, GrSamplerParams::ClampNoFilter()) , fTextureDomain(GrTextureDomain::MakeTexelDomain(texture, subset), GrTextureDomain::kDecal_Mode) { this->addTextureSampler(&fTextureSampler); diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h index d557d178f9..4c3cf22dee 100644 --- a/src/gpu/effects/GrTextureDomain.h +++ b/src/gpu/effects/GrTextureDomain.h @@ -171,7 +171,7 @@ public: const SkMatrix&, const SkRect& domain, GrTextureDomain::Mode, - GrTextureParams::FilterMode filterMode); + GrSamplerParams::FilterMode filterMode); const char* name() const override { return "TextureDomain"; } @@ -192,7 +192,7 @@ private: const SkMatrix&, const SkRect& domain, GrTextureDomain::Mode, - GrTextureParams::FilterMode); + GrSamplerParams::FilterMode); GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; diff --git a/src/gpu/effects/GrYUVEffect.cpp b/src/gpu/effects/GrYUVEffect.cpp index 2fd35138fe..297835773a 100644 --- a/src/gpu/effects/GrYUVEffect.cpp +++ b/src/gpu/effects/GrYUVEffect.cpp @@ -78,13 +78,13 @@ public: yuvMatrix[1].preScale(w[1] / w[0], h[1] / h[0]); yuvMatrix[2] = yuvMatrix[0]; yuvMatrix[2].preScale(w[2] / w[0], h[2] / h[0]); - GrTextureParams::FilterMode uvFilterMode = + GrSamplerParams::FilterMode uvFilterMode = ((sizes[1].fWidth != sizes[0].fWidth) || (sizes[1].fHeight != sizes[0].fHeight) || (sizes[2].fWidth != sizes[0].fWidth) || (sizes[2].fHeight != sizes[0].fHeight)) ? - GrTextureParams::kBilerp_FilterMode : - GrTextureParams::kNone_FilterMode; + GrSamplerParams::kBilerp_FilterMode : + GrSamplerParams::kNone_FilterMode; return sk_sp<GrFragmentProcessor>(new YUVtoRGBEffect( yTexture, uTexture, vTexture, yuvMatrix, uvFilterMode, colorSpace, nv12)); } @@ -152,9 +152,9 @@ public: private: YUVtoRGBEffect(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture, - const SkMatrix yuvMatrix[3], GrTextureParams::FilterMode uvFilterMode, + const SkMatrix yuvMatrix[3], GrSamplerParams::FilterMode uvFilterMode, SkYUVColorSpace colorSpace, bool nv12) - : fYTransform(yuvMatrix[0], yTexture, GrTextureParams::kNone_FilterMode) + : fYTransform(yuvMatrix[0], yTexture, GrSamplerParams::kNone_FilterMode) , fYSampler(yTexture) , fUTransform(yuvMatrix[1], uTexture, uvFilterMode) , fUSampler(uTexture, uvFilterMode) diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index ad5fcf79f3..57376d7609 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -3175,7 +3175,7 @@ static void get_tex_param_swizzle(GrPixelConfig config, } } -void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, bool allowSRGBInputs, +void GrGLGpu::bindTexture(int unitIdx, const GrSamplerParams& params, bool allowSRGBInputs, GrGLTexture* texture) { SkASSERT(texture); @@ -3222,11 +3222,11 @@ void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, bool allow GR_GL_LINEAR, GR_GL_LINEAR }; - GrTextureParams::FilterMode filterMode = params.filterMode(); + GrSamplerParams::FilterMode filterMode = params.filterMode(); - if (GrTextureParams::kMipMap_FilterMode == filterMode) { + if (GrSamplerParams::kMipMap_FilterMode == filterMode) { if (!this->caps()->mipMapSupport() || GrPixelConfigIsCompressed(texture->config())) { - filterMode = GrTextureParams::kBilerp_FilterMode; + filterMode = GrSamplerParams::kBilerp_FilterMode; } } @@ -3243,7 +3243,7 @@ void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, bool allow #ifdef SK_DEBUG // We were supposed to ensure MipMaps were up-to-date and built correctly before getting here. - if (GrTextureParams::kMipMap_FilterMode == filterMode) { + if (GrSamplerParams::kMipMap_FilterMode == filterMode) { SkASSERT(!texture->texturePriv().mipMapsAreDirty()); if (GrPixelConfigIsSRGB(texture->config())) { SkDestinationSurfaceColorMode colorMode = allowSRGBInputs @@ -3342,20 +3342,20 @@ void GrGLGpu::bindTexelBuffer(int unitIdx, GrPixelConfig texelConfig, GrGLBuffer } } -void GrGLGpu::generateMipmaps(const GrTextureParams& params, bool allowSRGBInputs, +void GrGLGpu::generateMipmaps(const GrSamplerParams& params, bool allowSRGBInputs, GrGLTexture* texture) { SkASSERT(texture); // First, figure out if we need mips for this texture at all: - GrTextureParams::FilterMode filterMode = params.filterMode(); + GrSamplerParams::FilterMode filterMode = params.filterMode(); - if (GrTextureParams::kMipMap_FilterMode == filterMode) { + if (GrSamplerParams::kMipMap_FilterMode == filterMode) { if (!this->caps()->mipMapSupport() || GrPixelConfigIsCompressed(texture->config())) { - filterMode = GrTextureParams::kBilerp_FilterMode; + filterMode = GrSamplerParams::kBilerp_FilterMode; } } - if (GrTextureParams::kMipMap_FilterMode != filterMode) { + if (GrSamplerParams::kMipMap_FilterMode != filterMode) { return; } @@ -4177,7 +4177,7 @@ bool GrGLGpu::copySurfaceAsDraw(GrSurface* dst, int w = srcRect.width(); int h = srcRect.height(); - GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode); + GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode); this->bindTexture(0, params, true, srcTex); GrGLIRect dstVP; @@ -4415,7 +4415,7 @@ bool GrGLGpu::generateMipmap(GrGLTexture* texture, bool gammaCorrect) { // Bind the texture, to get things configured for filtering. // We'll be changing our base level further below: this->setTextureUnit(0); - GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode); + GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kBilerp_FilterMode); this->bindTexture(0, params, gammaCorrect, texture); // Vertex data: @@ -4643,14 +4643,14 @@ GrGLAttribArrayState* GrGLGpu::HWVertexArrayState::bindInternalVertexArray(GrGLG return attribState; } -bool GrGLGpu::onMakeCopyForTextureParams(GrTexture* texture, const GrTextureParams& textureParams, +bool GrGLGpu::onMakeCopyForTextureParams(GrTexture* texture, const GrSamplerParams& textureParams, GrTextureProducer::CopyParams* copyParams) const { if (textureParams.isTiled() || - GrTextureParams::kMipMap_FilterMode == textureParams.filterMode()) { + GrSamplerParams::kMipMap_FilterMode == textureParams.filterMode()) { GrGLTexture* glTexture = static_cast<GrGLTexture*>(texture); if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { - copyParams->fFilter = GrTextureParams::kNone_FilterMode; + copyParams->fFilter = GrSamplerParams::kNone_FilterMode; copyParams->fWidth = texture->width(); copyParams->fHeight = texture->height(); return true; diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h index da0eae07df..dff342d823 100644 --- a/src/gpu/gl/GrGLGpu.h +++ b/src/gpu/gl/GrGLGpu.h @@ -57,12 +57,12 @@ public: } // Used by GrGLProgram to configure OpenGL state. - void bindTexture(int unitIdx, const GrTextureParams& params, bool allowSRGBInputs, + void bindTexture(int unitIdx, const GrSamplerParams& params, bool allowSRGBInputs, GrGLTexture* texture); void bindTexelBuffer(int unitIdx, GrPixelConfig, GrGLBuffer*); - void generateMipmaps(const GrTextureParams& params, bool allowSRGBInputs, GrGLTexture* texture); + void generateMipmaps(const GrSamplerParams& params, bool allowSRGBInputs, GrGLTexture* texture); bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, size_t rowBytes, GrPixelConfig readConfig, DrawPreference*, @@ -184,7 +184,7 @@ private: bool renderTarget, GrGLTexture::TexParams* initialTexParams, const SkTArray<GrMipLevel>& texels); - bool onMakeCopyForTextureParams(GrTexture*, const GrTextureParams&, + bool onMakeCopyForTextureParams(GrTexture*, const GrSamplerParams&, GrTextureProducer::CopyParams*) const override; // Checks whether glReadPixels can be called to get pixel values in readConfig from the diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp index 01744521ac..eb28e23cb2 100644 --- a/src/gpu/gl/GrGLTexture.cpp +++ b/src/gpu/gl/GrGLTexture.cpp @@ -30,18 +30,18 @@ static inline GrSLType sampler_type(const GrGLTexture::IDDesc& idDesc, GrPixelCo } } -static inline GrTextureParams::FilterMode highest_filter_mode(const GrGLTexture::IDDesc& idDesc, +static inline GrSamplerParams::FilterMode highest_filter_mode(const GrGLTexture::IDDesc& idDesc, GrPixelConfig config) { if (GrPixelConfigIsSint(config)) { // Integer textures in GL can use GL_NEAREST_MIPMAP_NEAREST. This is a mode we don't support // and don't currently have a use for. - return GrTextureParams::kNone_FilterMode; + return GrSamplerParams::kNone_FilterMode; } if (idDesc.fInfo.fTarget == GR_GL_TEXTURE_RECTANGLE || idDesc.fInfo.fTarget == GR_GL_TEXTURE_EXTERNAL) { - return GrTextureParams::kBilerp_FilterMode; + return GrSamplerParams::kBilerp_FilterMode; } - return GrTextureParams::kMipMap_FilterMode; + return GrSamplerParams::kMipMap_FilterMode; } // Because this class is virtually derived from GrSurface we must explicitly call its constructor. diff --git a/src/gpu/vk/GrVkCopyManager.cpp b/src/gpu/vk/GrVkCopyManager.cpp index 636b650478..6e96822a2e 100644 --- a/src/gpu/vk/GrVkCopyManager.cpp +++ b/src/gpu/vk/GrVkCopyManager.cpp @@ -8,7 +8,7 @@ #include "GrVkCopyManager.h" #include "GrSurface.h" -#include "GrTextureParams.h" +#include "GrSamplerParams.h" #include "GrTexturePriv.h" #include "GrVkCommandBuffer.h" #include "GrVkCopyPipeline.h" @@ -234,7 +234,7 @@ bool GrVkCopyManager::copySurfaceAsDraw(GrVkGpu* gpu, const GrVkDescriptorSet* samplerDS = gpu->resourceProvider().getSamplerDescriptorSet(fSamplerDSHandle); - GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode); + GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode); GrVkSampler* sampler = resourceProv.findOrCreateCompatibleSampler(params, srcTex->texturePriv().maxMipMapLevel()); diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp index e94585f093..9b70c0b6e4 100644 --- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp +++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp @@ -437,9 +437,9 @@ static void prepare_sampled_images(const GrProcessor& processor, GrVkGpu* gpu) { gpu->onResolveRenderTarget(texRT); } - const GrTextureParams& params = sampler.params(); + const GrSamplerParams& params = sampler.params(); // Check if we need to regenerate any mip maps - if (GrTextureParams::kMipMap_FilterMode == params.filterMode()) { + if (GrSamplerParams::kMipMap_FilterMode == params.filterMode()) { if (vkTexture->texturePriv().mipMapsAreDirty()) { gpu->generateMipmap(vkTexture); vkTexture->texturePriv().dirtyMipMaps(false); diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp index 48228e0b41..2d53cd8c8d 100644 --- a/src/gpu/vk/GrVkPipelineState.cpp +++ b/src/gpu/vk/GrVkPipelineState.cpp @@ -310,7 +310,7 @@ void GrVkPipelineState::writeSamplers( SkASSERT(fNumSamplers == textureBindings.count()); for (int i = 0; i < textureBindings.count(); ++i) { - const GrTextureParams& params = textureBindings[i]->params(); + const GrSamplerParams& params = textureBindings[i]->params(); GrVkTexture* texture = static_cast<GrVkTexture*>(textureBindings[i]->texture()); diff --git a/src/gpu/vk/GrVkResourceProvider.cpp b/src/gpu/vk/GrVkResourceProvider.cpp index 5cde9bc6df..81e1738595 100644 --- a/src/gpu/vk/GrVkResourceProvider.cpp +++ b/src/gpu/vk/GrVkResourceProvider.cpp @@ -7,7 +7,7 @@ #include "GrVkResourceProvider.h" -#include "GrTextureParams.h" +#include "GrSamplerParams.h" #include "GrVkCommandBuffer.h" #include "GrVkCopyPipeline.h" #include "GrVkGLSLSampler.h" @@ -164,7 +164,7 @@ GrVkDescriptorPool* GrVkResourceProvider::findOrCreateCompatibleDescriptorPool( return new GrVkDescriptorPool(fGpu, type, count); } -GrVkSampler* GrVkResourceProvider::findOrCreateCompatibleSampler(const GrTextureParams& params, +GrVkSampler* GrVkResourceProvider::findOrCreateCompatibleSampler(const GrSamplerParams& params, uint32_t mipLevels) { GrVkSampler* sampler = fSamplers.find(GrVkSampler::GenerateKey(params, mipLevels)); if (!sampler) { diff --git a/src/gpu/vk/GrVkResourceProvider.h b/src/gpu/vk/GrVkResourceProvider.h index 99724a6a8b..024488a2a7 100644 --- a/src/gpu/vk/GrVkResourceProvider.h +++ b/src/gpu/vk/GrVkResourceProvider.h @@ -25,7 +25,7 @@ class GrPipeline; class GrPrimitiveProcessor; -class GrTextureParams; +class GrSamplerParams; class GrVkCopyPipeline; class GrVkGpu; class GrVkPipeline; @@ -97,9 +97,9 @@ public: // of our cache of GrVkDescriptorPools. GrVkDescriptorPool* findOrCreateCompatibleDescriptorPool(VkDescriptorType type, uint32_t count); - // Finds or creates a compatible GrVkSampler based on the GrTextureParams. + // Finds or creates a compatible GrVkSampler based on the GrSamplerParams. // The refcount is incremented and a pointer returned. - GrVkSampler* findOrCreateCompatibleSampler(const GrTextureParams&, uint32_t mipLevels); + GrVkSampler* findOrCreateCompatibleSampler(const GrSamplerParams&, uint32_t mipLevels); sk_sp<GrVkPipelineState> findOrCreateCompatiblePipelineState(const GrPipeline&, const GrPrimitiveProcessor&, diff --git a/src/gpu/vk/GrVkSampler.cpp b/src/gpu/vk/GrVkSampler.cpp index 799adc9b33..39016344c7 100644 --- a/src/gpu/vk/GrVkSampler.cpp +++ b/src/gpu/vk/GrVkSampler.cpp @@ -22,7 +22,7 @@ static inline VkSamplerAddressMode tile_to_vk_sampler_address(SkShader::TileMode return gWrapModes[tm]; } -GrVkSampler* GrVkSampler::Create(const GrVkGpu* gpu, const GrTextureParams& params, +GrVkSampler* GrVkSampler::Create(const GrVkGpu* gpu, const GrSamplerParams& params, uint32_t mipLevels) { static VkFilter vkMinFilterModes[] = { VK_FILTER_NEAREST, @@ -57,7 +57,7 @@ GrVkSampler* GrVkSampler::Create(const GrVkGpu* gpu, const GrTextureParams& para // level mip). If the filters weren't the same we could set min = 0 and max = 0.25 to force // the minFilter on mip level 0. createInfo.minLod = 0.0f; - bool useMipMaps = GrTextureParams::kMipMap_FilterMode == params.filterMode() && mipLevels > 1; + bool useMipMaps = GrSamplerParams::kMipMap_FilterMode == params.filterMode() && mipLevels > 1; createInfo.maxLod = !useMipMaps ? 0.0f : (float)(mipLevels); createInfo.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK; createInfo.unnormalizedCoordinates = VK_FALSE; @@ -76,7 +76,7 @@ void GrVkSampler::freeGPUData(const GrVkGpu* gpu) const { GR_VK_CALL(gpu->vkInterface(), DestroySampler(gpu->device(), fSampler, nullptr)); } -uint16_t GrVkSampler::GenerateKey(const GrTextureParams& params, uint32_t mipLevels) { +uint16_t GrVkSampler::GenerateKey(const GrSamplerParams& params, uint32_t mipLevels) { const int kTileModeXShift = 2; const int kTileModeYShift = 4; const int kMipLevelShift = 6; diff --git a/src/gpu/vk/GrVkSampler.h b/src/gpu/vk/GrVkSampler.h index 369b1627b3..963060239f 100644 --- a/src/gpu/vk/GrVkSampler.h +++ b/src/gpu/vk/GrVkSampler.h @@ -12,18 +12,18 @@ #include "vk/GrVkDefines.h" -class GrTextureParams; +class GrSamplerParams; class GrVkGpu; class GrVkSampler : public GrVkResource { public: - static GrVkSampler* Create(const GrVkGpu* gpu, const GrTextureParams&, uint32_t mipLevels); + static GrVkSampler* Create(const GrVkGpu* gpu, const GrSamplerParams&, uint32_t mipLevels); VkSampler sampler() const { return fSampler; } // Helpers for hashing GrVkSampler - static uint16_t GenerateKey(const GrTextureParams&, uint32_t mipLevels); + static uint16_t GenerateKey(const GrSamplerParams&, uint32_t mipLevels); static const uint16_t& GetKey(const GrVkSampler& sampler) { return sampler.fKey; } static uint32_t Hash(const uint16_t& key) { return key; } diff --git a/src/gpu/vk/GrVkTexture.cpp b/src/gpu/vk/GrVkTexture.cpp index 3b6108cd52..7f0cf8d1d8 100644 --- a/src/gpu/vk/GrVkTexture.cpp +++ b/src/gpu/vk/GrVkTexture.cpp @@ -24,7 +24,7 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu, const GrVkImageView* view) : GrSurface(gpu, desc) , GrVkImage(info, GrVkImage::kNot_Wrapped) - , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrTextureParams::kMipMap_FilterMode, + , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrSamplerParams::kMipMap_FilterMode, desc.fIsMipMapped) , fTextureView(view) , fLinearTextureView(nullptr) { @@ -39,7 +39,7 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu, GrVkImage::Wrapped wrapped) : GrSurface(gpu, desc) , GrVkImage(info, wrapped) - , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrTextureParams::kMipMap_FilterMode, + , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrSamplerParams::kMipMap_FilterMode, desc.fIsMipMapped) , fTextureView(view) , fLinearTextureView(nullptr) { @@ -54,7 +54,7 @@ GrVkTexture::GrVkTexture(GrVkGpu* gpu, GrVkImage::Wrapped wrapped) : GrSurface(gpu, desc) , GrVkImage(info, wrapped) - , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrTextureParams::kMipMap_FilterMode, + , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrSamplerParams::kMipMap_FilterMode, desc.fIsMipMapped) , fTextureView(view) , fLinearTextureView(nullptr) { diff --git a/src/image/SkImageShader.cpp b/src/image/SkImageShader.cpp index da7bb2fb96..a41b2009d9 100644 --- a/src/image/SkImageShader.cpp +++ b/src/image/SkImageShader.cpp @@ -207,10 +207,10 @@ sk_sp<GrFragmentProcessor> SkImageShader::asFragmentProcessor(const AsFPArgs& ar // This completely ignores the complexity of the drawVertices case where explicit local coords // are provided by the caller. bool doBicubic; - GrTextureParams::FilterMode textureFilterMode = + GrSamplerParams::FilterMode textureFilterMode = GrSkFilterQualityToGrFilterMode(args.fFilterQuality, *args.fViewMatrix, this->getLocalMatrix(), &doBicubic); - GrTextureParams params(tm, textureFilterMode); + GrSamplerParams params(tm, textureFilterMode); sk_sp<GrTexture> texture(as_IB(fImage)->asTextureRef(args.fContext, params, args.fColorMode)); if (!texture) { return nullptr; diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h index 7fbe97deac..09ceb5770a 100644 --- a/src/image/SkImage_Base.h +++ b/src/image/SkImage_Base.h @@ -18,7 +18,7 @@ #include <new> -class GrTextureParams; +class GrSamplerParams; class SkImageCacherator; enum { @@ -55,7 +55,7 @@ public: virtual bool getROPixels(SkBitmap*, CachingHint = kAllow_CachingHint) const = 0; // Caller must call unref when they are done. - virtual GrTexture* asTextureRef(GrContext*, const GrTextureParams&, + virtual GrTexture* asTextureRef(GrContext*, const GrSamplerParams&, SkDestinationSurfaceColorMode) const = 0; virtual sk_sp<SkImage> onMakeSubset(const SkIRect&) const = 0; diff --git a/src/image/SkImage_Generator.cpp b/src/image/SkImage_Generator.cpp index 03dda91e5e..82f395fc95 100644 --- a/src/image/SkImage_Generator.cpp +++ b/src/image/SkImage_Generator.cpp @@ -31,7 +31,7 @@ public: SkData* onRefEncoded(GrContext*) const override; sk_sp<SkImage> onMakeSubset(const SkIRect&) const override; bool getROPixels(SkBitmap*, CachingHint) const override; - GrTexture* asTextureRef(GrContext*, const GrTextureParams&, + GrTexture* asTextureRef(GrContext*, const GrSamplerParams&, SkDestinationSurfaceColorMode) const override; bool onIsLazyGenerated() const override { return true; } @@ -74,7 +74,7 @@ bool SkImage_Generator::getROPixels(SkBitmap* bitmap, CachingHint chint) const { return fCache.lockAsBitmap(bitmap, this, chint); } -GrTexture* SkImage_Generator::asTextureRef(GrContext* ctx, const GrTextureParams& params, +GrTexture* SkImage_Generator::asTextureRef(GrContext* ctx, const GrSamplerParams& params, SkDestinationSurfaceColorMode colorMode) const { return fCache.lockAsTexture(ctx, params, colorMode, this); } diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index c75e36b9d9..84c7b10be1 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -85,7 +85,7 @@ bool SkImage_Gpu::getROPixels(SkBitmap* dst, CachingHint chint) const { return true; } -GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& params, +GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrSamplerParams& params, SkDestinationSurfaceColorMode colorMode) const { GrTextureAdjuster adjuster(this->peekTexture(), this->alphaType(), this->bounds(), this->uniqueID(), this->onImageInfo().colorSpace()); @@ -299,7 +299,7 @@ sk_sp<SkImage> SkImage::MakeFromNV12TexturesCopy(GrContext* ctx, SkYUVColorSpace static sk_sp<SkImage> create_image_from_maker(GrTextureMaker* maker, SkAlphaType at, uint32_t id) { sk_sp<GrTexture> texture( - maker->refTextureForParams(GrTextureParams::ClampNoFilter(), + maker->refTextureForParams(GrSamplerParams::ClampNoFilter(), SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware)); if (!texture) { return nullptr; diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h index 13c1e306dc..19e2944283 100644 --- a/src/image/SkImage_Gpu.h +++ b/src/image/SkImage_Gpu.h @@ -39,7 +39,7 @@ public: } bool getROPixels(SkBitmap*, CachingHint) const override; - GrTexture* asTextureRef(GrContext* ctx, const GrTextureParams& params, + GrTexture* asTextureRef(GrContext* ctx, const GrSamplerParams& params, SkDestinationSurfaceColorMode) const override; sk_sp<SkImage> onMakeSubset(const SkIRect&) const override; diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp index be86a2a6ef..a2b12e41ce 100644 --- a/src/image/SkImage_Raster.cpp +++ b/src/image/SkImage_Raster.cpp @@ -89,7 +89,7 @@ public: SkData* onRefEncoded(GrContext*) const override; bool getROPixels(SkBitmap*, CachingHint) const override; - GrTexture* asTextureRef(GrContext*, const GrTextureParams&, + GrTexture* asTextureRef(GrContext*, const GrSamplerParams&, SkDestinationSurfaceColorMode) const override; sk_sp<SkImage> onMakeSubset(const SkIRect&) const override; @@ -197,7 +197,7 @@ bool SkImage_Raster::getROPixels(SkBitmap* dst, CachingHint) const { return true; } -GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrTextureParams& params, +GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrSamplerParams& params, SkDestinationSurfaceColorMode colorMode) const { #if SK_SUPPORT_GPU if (!ctx) { @@ -239,7 +239,7 @@ bool SkImage_Raster::onPinAsTexture(GrContext* ctx) const { SkASSERT(fPinnedCount == 0); SkASSERT(fPinnedUniqueID == 0); fPinnedTexture.reset( - GrRefCachedBitmapTexture(ctx, fBitmap, GrTextureParams::ClampNoFilter(), + GrRefCachedBitmapTexture(ctx, fBitmap, GrSamplerParams::ClampNoFilter(), SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware)); if (!fPinnedTexture) { return false; |