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 <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
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 @@
////////////////////////////////////////////////////////////////////////////////
-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 @@
// 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 @@
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 @@
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 @@
*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 @@
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<GrGLTexture*>(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 @@
bool renderTarget, GrGLTexture::TexParams* initialTexParams,
const SkTArray<GrMipLevel>& 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.