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

Unified Diff: include/gpu/GrSurface.h

Issue 13414006: Remove GrTexture::releaseRenderTarget() and add GrSurface::isSameAs(). (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 | « include/gpu/GrRenderTarget.h ('k') | include/gpu/GrTexture.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrSurface.h
===================================================================
--- include/gpu/GrSurface.h (revision 8517)
+++ include/gpu/GrSurface.h (working copy)
@@ -64,6 +64,22 @@
virtual const GrRenderTarget* asRenderTarget() const = 0;
/**
+ * Checks whether this GrSurface refers to the same GPU object as other. This
+ * catches the case where a GrTexture and GrRenderTarget refer to the same
+ * GPU memory.
+ */
+ bool isSameAs(const GrSurface* other) const {
+ const GrRenderTarget* thisRT = this->asRenderTarget();
+ if (NULL != thisRT) {
+ return thisRT == other->asRenderTarget();
+ } else {
+ const GrTexture* thisTex = this->asTexture();
+ GrAssert(NULL != thisTex); // We must be one or the other
+ return thisTex == other->asTexture();
+ }
+ }
+
+ /**
* Reads a rectangle of pixels from the surface.
* @param left left edge of the rectangle to read (inclusive)
* @param top top edge of the rectangle to read (inclusive)
« no previous file with comments | « include/gpu/GrRenderTarget.h ('k') | include/gpu/GrTexture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698