Index: src/gpu/GrGpu.h |
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h |
index 3eaa3fc035e27ebc821b16825f26d24443e02f8c..e744ec897a83fc783603a73fdcf65c2acaca34b7 100644 |
--- a/src/gpu/GrGpu.h |
+++ b/src/gpu/GrGpu.h |
@@ -426,11 +426,24 @@ public: |
// draws an outline rectangle for debugging/visualization purposes. |
virtual void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) = 0; |
- // Determines whether a copy of a texture must be made in order to be compatible with |
- // a given GrTextureParams. If so, the width, height and filter used for the copy are |
- // output via the CopyParams. |
+ // 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 |
+ // texture provider from a non-texture src (cpu-backed image, ...). |
bool makeCopyForTextureParams(int width, int height, const GrTextureParams&, |
- GrTextureProducer::CopyParams*) const; |
+ 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, |
+ GrTextureProducer::CopyParams* copyParams) const { |
+ if (this->makeCopyForTextureParams(texture->width(), texture->height(), params, |
+ copyParams)) { |
+ return true; |
+ } |
+ return this->onMakeCopyForTextureParams(texture, params, copyParams); |
+ } |
// This is only to be used in GL-specific tests. |
virtual const GrGLContext* glContextForTesting() const { return nullptr; } |
@@ -506,6 +519,9 @@ private: |
// overridden by backend-specific derived class to perform the draw call. |
virtual void onDraw(const DrawArgs&, const GrNonInstancedVertices&) = 0; |
+ virtual bool onMakeCopyForTextureParams(GrTexture* texture, const GrTextureParams&, |
+ GrTextureProducer::CopyParams*) const { return false; } |
+ |
virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, |
size_t rowBytes, GrPixelConfig readConfig, DrawPreference*, |
ReadPixelTempDrawInfo*) = 0; |