Bug 570625, part 7: Add gfxXlibSurface::ReleasePixmap() to undo TakePixmap(). sr=roc
authorChris Jones <jones.chris.g@gmail.com>
Tue, 14 Sep 2010 00:23:08 -0500
changeset 54107 2ee052cc1e969286a20790afbf50d8e60709c107
parent 54106 ae373f6a1e29519cfd0021db010be9b379822f25
child 54108 8c9d8e1a66db80af5d2e2dca09fb092de526436c
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs570625
milestone2.0b6pre
Bug 570625, part 7: Add gfxXlibSurface::ReleasePixmap() to undo TakePixmap(). sr=roc
gfx/thebes/gfxXlibSurface.h
--- a/gfx/thebes/gfxXlibSurface.h
+++ b/gfx/thebes/gfxXlibSurface.h
@@ -95,16 +95,25 @@ public:
 
     // take ownership of a passed-in Pixmap, calling XFreePixmap on it
     // when the gfxXlibSurface is destroyed.
     void TakePixmap() {
         NS_ASSERTION(!mPixmapTaken, "I already own the Pixmap!");
         mPixmapTaken = PR_TRUE;
     }
 
+    // Release ownership of this surface's Pixmap.  This is only valid
+    // on gfxXlibSurfaces for which the user called TakePixmap(), or
+    // on those created by a Create() factory method.
+    Drawable ReleasePixmap() {
+        NS_ASSERTION(mPixmapTaken, "I don't own the Pixmap!");
+        mPixmapTaken = PR_FALSE;
+        return mDrawable;
+    }
+
     // Find a visual and colormap pair suitable for rendering to this surface.
     PRBool GetColormapAndVisual(Colormap* colormap, Visual **visual);
 
 protected:
     // if TakePixmap() has been called on this
     PRBool mPixmapTaken;
     
     Display *mDisplay;