Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: src/gpu/GrGpu.h

Issue 1594483003: Texturing support for RECTANGLE textures. (Closed) Base URL: https://skia.googlesource.com/skia.git@rectangle
Patch Set: fix float->int warnings Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/rectangletexture.cpp ('k') | src/gpu/GrTextureParamsAdjuster.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « gm/rectangletexture.cpp ('k') | src/gpu/GrTextureParamsAdjuster.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698