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

Unified Diff: include/gpu/GrSurface.h

Issue 13814015: Reland of 8525 with fix for case when GrRT outlives GrTexture. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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
Index: include/gpu/GrSurface.h
===================================================================
--- include/gpu/GrSurface.h (revision 8570)
+++ 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)

Powered by Google App Engine
This is Rietveld 408576698