From 245e23bf94eb70fdf4a028359fb266bea584721c Mon Sep 17 00:00:00 2001 From: "michaelp%netscape.com" Date: Wed, 12 Aug 1998 21:17:52 +0000 Subject: [PATCH] we now allocate a single offscreen buffer. git-svn-id: svn://10.0.0.236/trunk@7872 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/view/src/nsViewManager.cpp | 11 ++++++++++- mozilla/view/src/nsViewManager.h | 8 +++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/mozilla/view/src/nsViewManager.cpp b/mozilla/view/src/nsViewManager.cpp index a836fe03c52..2f608a50d2a 100644 --- a/mozilla/view/src/nsViewManager.cpp +++ b/mozilla/view/src/nsViewManager.cpp @@ -46,10 +46,15 @@ static void vm_timer_callback(nsITimer *aTimer, void *aClosure) vm->Composite(); } +PRUint32 nsViewManager::mVMCount = 0; +nsDrawingSurface nsViewManager::mDrawingSurface = nsnull; +nsRect nsViewManager::mDSBounds = nsRect(0, 0, 0, 0); + static NS_DEFINE_IID(knsViewManagerIID, NS_IVIEWMANAGER_IID); nsViewManager :: nsViewManager() { + mVMCount++; } nsViewManager :: ~nsViewManager() @@ -63,7 +68,11 @@ nsViewManager :: ~nsViewManager() NS_IF_RELEASE(mRootWindow); NS_IF_RELEASE(mDirtyRegion); - if (nsnull != mDrawingSurface) + --mVMCount; + + NS_ASSERTION(!(mVMCount < 0), "underflow of viewmanagers"); + + if ((0 == mVMCount) && (nsnull != mDrawingSurface)) { nsIRenderingContext *rc; diff --git a/mozilla/view/src/nsViewManager.h b/mozilla/view/src/nsViewManager.h index 13aebd7326f..34b4594bf81 100644 --- a/mozilla/view/src/nsViewManager.h +++ b/mozilla/view/src/nsViewManager.h @@ -128,13 +128,15 @@ private: nsIPresContext *mContext; nsIWidget *mRootWindow; - nsRect mDSBounds; - nsDrawingSurface mDrawingSurface; PRTime mLastRefresh; nsIRegion *mDirtyRegion; PRInt32 mTransCnt; PRBool mRefreshEnabled; - + + static PRUint32 mVMCount; //number of viewmanagers + static nsDrawingSurface mDrawingSurface; //single drawing surface + static nsRect mDSBounds; //for all VMs + public: //these are public so that our timer callback can poke them. nsITimer *mTimer;