Make the backbuffer transitory based on a pref. This does not have any effect unless you set (layout.transitory.backbuffer", true) bug 95952 sr=attinasi r=alexsavulov

git-svn-id: svn://10.0.0.236/trunk@109319 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kmcclusk%netscape.com
2001-11-30 04:12:36 +00:00
parent 303a5331d9
commit a91bf4a68d
2 changed files with 22 additions and 2 deletions

View File

@@ -54,6 +54,7 @@
#include "nsIEventQueueService.h"
#include "nsIServiceManager.h"
#include "nsGUIEvent.h"
#include "nsIPref.h"
static NS_DEFINE_IID(kBlenderCID, NS_BLENDER_CID);
static NS_DEFINE_IID(kRegionCID, NS_REGION_CID);
@@ -270,6 +271,7 @@ nsSize nsViewManager::gLargestRequestedSize = nsSize(0, 0);
// Weakly held references to all of the view managers
nsVoidArray* nsViewManager::gViewManagers = nsnull;
PRUint32 nsViewManager::gLastUserEventTime = 0;
PRBool nsViewManager::gTransitoryBackbuffer = PR_FALSE;
nsViewManager::nsViewManager()
{
@@ -470,6 +472,11 @@ NS_IMETHODIMP nsViewManager::Init(nsIDeviceContext* aContext, nscoord aX, nscoor
NS_ASSERTION(nsnull != mEventQueue, "event queue is null");
}
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID));
if (prefs) {
prefs->GetBoolPref("layout.transitory.backbuffer", &gTransitoryBackbuffer);
}
return rv;
}
@@ -682,6 +689,12 @@ void nsViewManager::Refresh(nsView *aView, nsIRenderingContext *aContext, nsIReg
mRecursiveRefreshPending = PR_FALSE;
}
if ((gTransitoryBackbuffer) && (mDrawingSurface)) {
//Destroy backbuffer drawing surface
localcx->DestroyDrawingSurface(mDrawingSurface);
mDrawingSurface = nsnull;
}
#ifdef NS_VM_PERF_METRICS
MOZ_TIMER_DEBUGLOG(("Stop: nsViewManager::Refresh(region), this=%p\n", this));
MOZ_TIMER_STOP(mWatch);
@@ -1709,7 +1722,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
PRUint32 updateFlags = NS_VMREFRESH_DOUBLE_BUFFER;
PRBool doDefault = PR_TRUE;
//printf("refreshing: view: %x, %d, %d, %d, %d\n", view, damrect.x, damrect.y, damrect.width, damrect.height);
// printf("refreshing: view: %x, %d, %d, %d, %d\n", view, damrect.x, damrect.y, damrect.width, damrect.height);
// Refresh the view
if (mRefreshEnabled) {
nsIComponentManager* componentManager = nsnull;
@@ -2557,7 +2570,13 @@ const nsVoidArray* nsViewManager::GetViewManagerArray()
nsDrawingSurface nsViewManager::GetDrawingSurface(nsIRenderingContext &aContext, nsRect& aBounds)
{
nsRect newBounds;
GetDrawingSurfaceSize(aBounds, newBounds);
if (gTransitoryBackbuffer) {
newBounds = aBounds;
} else {
GetDrawingSurfaceSize(aBounds, newBounds);
}
if ((nsnull == mDrawingSurface)
|| (mDSBounds.width != newBounds.width)

View File

@@ -427,6 +427,7 @@ private:
//list of view managers
static nsVoidArray *gViewManagers;
static PRBool gTransitoryBackbuffer;
//compositor regions
nsIRegion *mOpaqueRgn;