mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Added new method to control whether ViewManager and ViewManager2 double-buffer when rendering. bug 49743 a=roc+moz@cs.cmu.edu r=peterl@netscape.com
This commit is contained in:
parent
094af23a1f
commit
dd45327b43
@ -497,6 +497,17 @@ public:
|
||||
*/
|
||||
NS_IMETHOD CacheWidgetChanges(PRBool aCache)=0;
|
||||
|
||||
/**
|
||||
* Control double buffering of the display. If double buffering
|
||||
* is enabled the viewmanager is allowed to render to an offscreen
|
||||
* drawing surface before copying to the display in order to prevent
|
||||
* flicker. If it is disabled all rendering will appear directly on the
|
||||
* the display. The display is double buffered by default.
|
||||
* @param aDoubleBuffer PR_TRUE to enable double buffering
|
||||
* PR_FALSE to disable double buffering
|
||||
*/
|
||||
NS_IMETHOD AllowDoubleBuffering(PRBool aDoubleBuffer)=0;
|
||||
|
||||
};
|
||||
|
||||
//when the refresh happens, should it be double buffered?
|
||||
|
@ -391,7 +391,7 @@ nsViewManager::nsViewManager()
|
||||
mX = 0;
|
||||
mY = 0;
|
||||
mCachingWidgetChanges = 0;
|
||||
|
||||
mAllowDoubleBuffering = PR_TRUE;
|
||||
}
|
||||
|
||||
nsViewManager::~nsViewManager()
|
||||
@ -702,6 +702,11 @@ void nsViewManager::Refresh(nsIView *aView, nsIRenderingContext *aContext, nsIRe
|
||||
aUpdateFlags &= ~NS_VMREFRESH_DOUBLE_BUFFER;
|
||||
#endif
|
||||
|
||||
if (PR_FALSE == mAllowDoubleBuffering) {
|
||||
// Turn off double-buffering of the display
|
||||
aUpdateFlags &= ~NS_VMREFRESH_DOUBLE_BUFFER;
|
||||
}
|
||||
|
||||
if (nsnull == aContext)
|
||||
{
|
||||
localcx = getter_AddRefs(CreateRenderingContext(*aView));
|
||||
@ -823,6 +828,11 @@ void nsViewManager::Refresh(nsIView *aView, nsIRenderingContext *aContext, const
|
||||
aUpdateFlags &= ~NS_VMREFRESH_DOUBLE_BUFFER;
|
||||
#endif
|
||||
|
||||
if (PR_FALSE == mAllowDoubleBuffering) {
|
||||
// Turn off double-buffering of the display
|
||||
aUpdateFlags &= ~NS_VMREFRESH_DOUBLE_BUFFER;
|
||||
}
|
||||
|
||||
if (nsnull == aContext)
|
||||
{
|
||||
localcx = getter_AddRefs(CreateRenderingContext(*aView));
|
||||
@ -3619,6 +3629,13 @@ nsViewManager::CacheWidgetChanges(PRBool aCache)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewManager::AllowDoubleBuffering(PRBool aDoubleBuffer)
|
||||
{
|
||||
mAllowDoubleBuffering = aDoubleBuffer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsViewManager::ProcessWidgetChanges(nsIView* aView)
|
||||
{
|
||||
|
@ -159,6 +159,7 @@ public:
|
||||
|
||||
NS_IMETHOD IsCachingWidgetChanges(PRBool* aCaching);
|
||||
NS_IMETHOD CacheWidgetChanges(PRBool aCache);
|
||||
NS_IMETHOD AllowDoubleBuffering(PRBool aDoubleBuffer);
|
||||
protected:
|
||||
virtual ~nsViewManager();
|
||||
|
||||
@ -371,6 +372,7 @@ public:
|
||||
protected:
|
||||
nscoord mX;
|
||||
nscoord mY;
|
||||
PRBool mAllowDoubleBuffering;
|
||||
|
||||
#ifdef NS_VM_PERF_METRICS
|
||||
MOZ_TIMER_DECLARE(mWatch) // Measures compositing+paint time for current document
|
||||
|
@ -156,7 +156,7 @@ nsViewManager2::nsViewManager2()
|
||||
mX = 0;
|
||||
mY = 0;
|
||||
mCachingWidgetChanges = 0;
|
||||
|
||||
mAllowDoubleBuffering = PR_TRUE;
|
||||
}
|
||||
|
||||
nsViewManager2::~nsViewManager2()
|
||||
@ -490,6 +490,11 @@ void nsViewManager2::Refresh(nsIView *aView, nsIRenderingContext *aContext, nsIR
|
||||
aUpdateFlags &= ~NS_VMREFRESH_DOUBLE_BUFFER;
|
||||
#endif
|
||||
|
||||
if (PR_FALSE == mAllowDoubleBuffering) {
|
||||
// Turn off double-buffering of the display
|
||||
aUpdateFlags &= ~NS_VMREFRESH_DOUBLE_BUFFER;
|
||||
}
|
||||
|
||||
if (nsnull == aContext)
|
||||
{
|
||||
localcx = getter_AddRefs(CreateRenderingContext(*aView));
|
||||
@ -611,6 +616,11 @@ void nsViewManager2::Refresh(nsIView *aView, nsIRenderingContext *aContext, cons
|
||||
aUpdateFlags &= ~NS_VMREFRESH_DOUBLE_BUFFER;
|
||||
#endif
|
||||
|
||||
if (PR_FALSE == mAllowDoubleBuffering) {
|
||||
// Turn off double-buffering of the display
|
||||
aUpdateFlags &= ~NS_VMREFRESH_DOUBLE_BUFFER;
|
||||
}
|
||||
|
||||
if (nsnull == aContext)
|
||||
{
|
||||
localcx = getter_AddRefs(CreateRenderingContext(*aView));
|
||||
@ -2860,6 +2870,7 @@ nsViewManager2::IsCachingWidgetChanges(PRBool* aCaching)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewManager2::CacheWidgetChanges(PRBool aCache)
|
||||
{
|
||||
@ -2880,6 +2891,13 @@ nsViewManager2::CacheWidgetChanges(PRBool aCache)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewManager2::AllowDoubleBuffering(PRBool aDoubleBuffer)
|
||||
{
|
||||
mAllowDoubleBuffering = aDoubleBuffer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsViewManager2::ProcessWidgetChanges(nsIView* aView)
|
||||
{
|
||||
|
@ -157,6 +157,7 @@ public:
|
||||
|
||||
NS_IMETHOD IsCachingWidgetChanges(PRBool* aCaching);
|
||||
NS_IMETHOD CacheWidgetChanges(PRBool aCache);
|
||||
NS_IMETHOD AllowDoubleBuffering(PRBool aDoubleBuffer);
|
||||
protected:
|
||||
virtual ~nsViewManager2();
|
||||
|
||||
@ -369,6 +370,7 @@ public:
|
||||
protected:
|
||||
nscoord mX;
|
||||
nscoord mY;
|
||||
PRBool mAllowDoubleBuffering;
|
||||
|
||||
#ifdef NS_VM_PERF_METRICS
|
||||
MOZ_TIMER_DECLARE(mWatch) // Measures compositing+paint time for current document
|
||||
|
Loading…
Reference in New Issue
Block a user