From 81444fbc22d09c92f6c577254c6c82dfa9967391 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Tue, 21 Mar 2017 09:14:35 -0400 Subject: [PATCH] rename makeCopyForTextureParams to isACopyNeededForTextureParams I thought the old name was misleading split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors) Change-Id: I8c5fc6de487b50c9ec37843ff7501b52140dde00 Reviewed-on: https://skia-review.googlesource.com/9961 Reviewed-by: Brian Salomon Commit-Queue: Robert Phillips --- src/gpu/GrGpu.cpp | 7 ++++--- src/gpu/GrGpu.h | 25 ++++++++++++++----------- src/gpu/GrTextureAdjuster.cpp | 4 ++-- src/gpu/GrTextureMaker.cpp | 4 ++-- src/gpu/gl/GrGLGpu.cpp | 7 ++++--- src/gpu/gl/GrGLGpu.h | 6 +++--- 6 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 298e002..40988c3 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -57,9 +57,10 @@ void GrGpu::disconnect(DisconnectType) {} //////////////////////////////////////////////////////////////////////////////// -bool GrGpu::makeCopyForTextureParams(int width, int height, const GrSamplerParams& textureParams, - GrTextureProducer::CopyParams* copyParams, - SkScalar scaleAdjust[2]) const { +bool GrGpu::isACopyNeededForTextureParams(int width, int height, + const GrSamplerParams& textureParams, + GrTextureProducer::CopyParams* copyParams, + SkScalar scaleAdjust[2]) const { const GrCaps& caps = *this->caps(); if (textureParams.isTiled() && !caps.npotTextureTileSupport() && (!SkIsPow2(width) || !SkIsPow2(height))) { diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index 128b139..1e28345 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -473,21 +473,22 @@ public: // Determines whether a texture will need to be rescaled in order to be used with the // GrSamplerParams. This variation is called when the caller will create a new texture using the // resource provider from a non-texture src (cpu-backed image, ...). - bool makeCopyForTextureParams(int width, int height, const GrSamplerParams&, - GrTextureProducer::CopyParams*, SkScalar scaleAdjust[2]) const; + bool isACopyNeededForTextureParams(int width, int height, const GrSamplerParams&, + GrTextureProducer::CopyParams*, + SkScalar scaleAdjust[2]) 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 // GrResourceProvider::wrap methods. - bool makeCopyForTextureParams(GrTexture* texture, const GrSamplerParams& params, - GrTextureProducer::CopyParams* copyParams, - SkScalar scaleAdjust[2]) const { - if (this->makeCopyForTextureParams(texture->width(), texture->height(), params, - copyParams, scaleAdjust)) { + bool isACopyNeededForTextureParams(GrTexture* texture, const GrSamplerParams& params, + GrTextureProducer::CopyParams* copyParams, + SkScalar scaleAdjust[2]) const { + if (this->isACopyNeededForTextureParams(texture->width(), texture->height(), params, + copyParams, scaleAdjust)) { return true; } - return this->onMakeCopyForTextureParams(texture, params, copyParams, scaleAdjust); + return this->onIsACopyNeededForTextureParams(texture, params, copyParams, scaleAdjust); } // This is only to be used in GL-specific tests. @@ -549,9 +550,11 @@ private: virtual gr_instanced::InstancedRendering* onCreateInstancedRendering() = 0; - virtual bool onMakeCopyForTextureParams(GrTexture* texture, const GrSamplerParams&, - GrTextureProducer::CopyParams*, - SkScalar scaleAdjust[2]) const { return false; } + virtual bool onIsACopyNeededForTextureParams(GrTexture* texture, const GrSamplerParams&, + GrTextureProducer::CopyParams*, + SkScalar scaleAdjust[2]) const { + return false; + } virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, size_t rowBytes, GrPixelConfig readConfig, DrawPreference*, diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp index a85100a..5dc7148 100644 --- a/src/gpu/GrTextureAdjuster.cpp +++ b/src/gpu/GrTextureAdjuster.cpp @@ -110,8 +110,8 @@ GrTexture* GrTextureAdjuster::refTextureSafeForParams(const GrSamplerParams& par copyParams.fWidth = contentArea->width(); copyParams.fHeight = contentArea->height(); copyParams.fFilter = GrSamplerParams::kBilerp_FilterMode; - } else if (!fContext->getGpu()->makeCopyForTextureParams(texture, params, ©Params, - scaleAdjust)) { + } else if (!fContext->getGpu()->isACopyNeededForTextureParams(texture, params, ©Params, + scaleAdjust)) { if (outOffset) { if (contentArea) { outOffset->set(contentArea->fLeft, contentArea->fRight); diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp index bd0840b..06a8f27 100644 --- a/src/gpu/GrTextureMaker.cpp +++ b/src/gpu/GrTextureMaker.cpp @@ -26,8 +26,8 @@ GrTexture* GrTextureMaker::refTextureForParams(const GrSamplerParams& params, *texColorSpace = this->getColorSpace(dstColorSpace); } - if (!fContext->getGpu()->makeCopyForTextureParams(this->width(), this->height(), params, - ©Params, scaleAdjust)) { + if (!fContext->getGpu()->isACopyNeededForTextureParams(this->width(), this->height(), params, + ©Params, scaleAdjust)) { return this->refOriginalTexture(willBeMipped, dstColorSpace); } GrUniqueKey copyKey; diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index b24f197..f7b32c2 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -4421,9 +4421,10 @@ GrGLAttribArrayState* GrGLGpu::HWVertexArrayState::bindInternalVertexArray(GrGLG return attribState; } -bool GrGLGpu::onMakeCopyForTextureParams(GrTexture* texture, const GrSamplerParams& textureParams, - GrTextureProducer::CopyParams* copyParams, - SkScalar scaleAdjust[2]) const { +bool GrGLGpu::onIsACopyNeededForTextureParams(GrTexture* texture, + const GrSamplerParams& textureParams, + GrTextureProducer::CopyParams* copyParams, + SkScalar scaleAdjust[2]) const { if (textureParams.isTiled() || GrSamplerParams::kMipMap_FilterMode == textureParams.filterMode()) { GrGLTexture* glTexture = static_cast(texture); diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h index fa42533..6e0d900 100644 --- a/src/gpu/gl/GrGLGpu.h +++ b/src/gpu/gl/GrGLGpu.h @@ -189,9 +189,9 @@ private: bool renderTarget, GrGLTexture::TexParams* initialTexParams, const SkTArray& texels); - bool onMakeCopyForTextureParams(GrTexture*, const GrSamplerParams&, - GrTextureProducer::CopyParams*, - SkScalar scaleAdjust[2]) const override; + bool onIsACopyNeededForTextureParams(GrTexture*, const GrSamplerParams&, + GrTextureProducer::CopyParams*, + SkScalar scaleAdjust[2]) const override; // Checks whether glReadPixels can be called to get pixel values in readConfig from the // render target. -- 2.7.4