#ifdef'ed out timer used to flush paints. It is not needed b=31407 r=attanasi@netscape.com

Changed mVMCount from PRUint32 to PRInt32 to make ASSERTION checking for a negative value in mWMCount valid
b=11674 r=attanasi@netscape.com
This commit is contained in:
kmcclusk%netscape.com 2000-03-17 22:27:26 +00:00
parent 145c5e5ee3
commit 806bd65dd6
4 changed files with 50 additions and 8 deletions

View File

@ -64,9 +64,12 @@ struct DisplayListElement {
PRUint32 mFlags;
};
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
static void vm_timer_callback(nsITimer *aTimer, void *aClosure)
{
nsViewManager *vm = (nsViewManager *)aClosure;
printf("ViewManager timer callback\n");
//restart the timer
@ -88,6 +91,7 @@ static void vm_timer_callback(nsITimer *aTimer, void *aClosure)
vm->Composite();
#endif
}
#endif
#if 0
static void blinkRect(nsIRenderingContext* context, const nsRect& r)
@ -98,7 +102,7 @@ static void blinkRect(nsIRenderingContext* context, const nsRect& r)
}
#endif
PRUint32 nsViewManager::mVMCount = 0;
PRInt32 nsViewManager::mVMCount = 0;
nsDrawingSurface nsViewManager::mDrawingSurface = nsnull;
nsRect nsViewManager::mDSBounds = nsRect(0, 0, 0, 0);
@ -120,11 +124,13 @@ nsViewManager :: nsViewManager()
nsViewManager :: ~nsViewManager()
{
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
if (nsnull != mTimer)
{
mTimer->Cancel(); //XXX this should not be necessary. MMP
NS_RELEASE(mTimer);
}
#endif
NS_IF_RELEASE(mRootWindow);
@ -263,8 +269,9 @@ NS_IMETHODIMP nsViewManager :: Init(nsIDeviceContext* aContext)
return NS_ERROR_ALREADY_INITIALIZED;
}
mContext = aContext;
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
mTimer = nsnull;
#endif
mFrameRate = 0;
mTrueFrameRate = 0;
mTransCnt = 0;
@ -344,21 +351,26 @@ NS_IMETHODIMP nsViewManager :: SetFrameRate(PRUint32 aFrameRate)
if (aFrameRate != mFrameRate)
{
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
//XXX: Reimplement using a repeating timer
if (nsnull != mTimer)
{
mTimer->Cancel(); //XXX this should not be necessary. MMP
NS_RELEASE(mTimer);
}
#endif
mFrameRate = aFrameRate;
mTrueFrameRate = aFrameRate;
if (mFrameRate != 0)
{
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
rv = NS_NewTimer(&mTimer);
if (NS_OK == rv)
mTimer->Init(vm_timer_callback, this, 1000 / mFrameRate);
#endif
}
else
rv = NS_OK;
@ -2854,8 +2866,7 @@ nsresult nsViewManager::GetVisibleRect(nsRect& aVisibleRect)
// Determine the visible rect in the scrolled view's coordinate space.
// The size of the visible area is the clip view size
const nsIView* clipView;
nsRect visibleRect;
scrollingView->GetScrollPosition(aVisibleRect.x, aVisibleRect.y);
scrollingView->GetClipView(&clipView);
clipView->GetDimensions(&aVisibleRect.width, &aVisibleRect.height);

View File

@ -37,6 +37,12 @@
class nsISupportsArray;
// Dont want to get rid of timer code, because we may want to use it
// if we go to a implementation where we have invalidates that have been queued
// within the view manager, instead of doing invalidates on the widget.
// The timer would be used to cause the paints to happen.
//#define NS_VIEWMANAGER_NEEDS_TIMER 1
class nsViewManager : public nsIViewManager {
public:
nsViewManager();
@ -225,7 +231,7 @@ private:
nsIScrollableView *mRootScrollable;
//from here to public should be static and locked... MMP
static PRUint32 mVMCount; //number of viewmanagers
static PRInt32 mVMCount; //number of viewmanagers
static nsDrawingSurface mDrawingSurface; //single drawing surface
static nsRect mDSBounds; //for all VMs
@ -253,7 +259,9 @@ private:
public:
//these are public so that our timer callback can poke them.
#if NS_VIEWMANAGER_NEEDS_TIMER
nsITimer *mTimer;
#endif
nsRect mDirtyRect;
nsIView *mRootView;
PRUint32 mFrameRate;

View File

@ -39,6 +39,7 @@ static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID);
#define UPDATE_QUANTUM 1000 / 40
//#define NO_DOUBLE_BUFFER
// display list flags
@ -63,10 +64,15 @@ struct DisplayListElement2 {
inline nscoord max(nscoord x, nscoord y) { return (x > y ? x : y); }
inline nscoord min(nscoord x, nscoord y) { return (x < y ? x : y); }
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
static void vm_timer_callback(nsITimer *aTimer, void *aClosure)
{
nsViewManager2 *vm = (nsViewManager2 *)aClosure;
printf("ViewManager2 timer callback\n");
//restart the timer
if (vm->mTrueFrameRate == vm->mFrameRate)
@ -87,6 +93,7 @@ static void vm_timer_callback(nsITimer *aTimer, void *aClosure)
vm->Composite();
#endif
}
#endif
#if 0
static void blinkRect(nsIRenderingContext* context, const nsRect& r)
@ -97,7 +104,7 @@ static void blinkRect(nsIRenderingContext* context, const nsRect& r)
}
#endif
PRUint32 nsViewManager2::mVMCount = 0;
PRInt32 nsViewManager2::mVMCount = 0;
nsDrawingSurface nsViewManager2::mDrawingSurface = nsnull;
nsRect nsViewManager2::mDSBounds = nsRect(0, 0, 0, 0);
@ -119,10 +126,12 @@ nsViewManager2::nsViewManager2()
nsViewManager2::~nsViewManager2()
{
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
if (nsnull != mTimer) {
mTimer->Cancel(); //XXX this should not be necessary. MMP
NS_RELEASE(mTimer);
}
#endif
NS_IF_RELEASE(mRootWindow);
@ -260,7 +269,9 @@ NS_IMETHODIMP nsViewManager2::Init(nsIDeviceContext* aContext)
mContext->GetAppUnitsToDevUnits(mTwipsToPixels);
mContext->GetDevUnitsToAppUnits(mPixelsToTwips);
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
mTimer = nsnull;
#endif
mFrameRate = 0;
mTrueFrameRate = 0;
mTransCnt = 0;
@ -340,21 +351,25 @@ NS_IMETHODIMP nsViewManager2::SetFrameRate(PRUint32 aFrameRate)
if (aFrameRate != mFrameRate)
{
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
if (nsnull != mTimer)
{
mTimer->Cancel(); //XXX this should not be necessary. MMP
NS_RELEASE(mTimer);
}
#endif
mFrameRate = aFrameRate;
mTrueFrameRate = aFrameRate;
if (mFrameRate != 0)
{
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
rv = NS_NewTimer(&mTimer);
if (NS_OK == rv)
mTimer->Init(vm_timer_callback, this, 1000 / mFrameRate);
#endif
}
else
rv = NS_OK;
@ -2463,7 +2478,6 @@ nsresult nsViewManager2::GetVisibleRect(nsRect& aVisibleRect)
// Determine the visible rect in the scrolled view's coordinate space.
// The size of the visible area is the clip view size
const nsIView* clipView;
nsRect visibleRect;
scrollingView->GetScrollPosition(aVisibleRect.x, aVisibleRect.y);
scrollingView->GetClipView(&clipView);

View File

@ -38,6 +38,13 @@
class nsISupportsArray;
struct DisplayListElement2;
// Dont want to get rid of timer code, because we may want to use it
// if we go to a implementation where we have invalidates that have been queued
// within the view manager, instead of doing invalidates on the widget.
// The timer would be used to cause the paints to happen.
//#define NS_VIEWMANAGER_NEEDS_TIMER 1
class nsViewManager2 : public nsIViewManager {
public:
nsViewManager2();
@ -245,7 +252,7 @@ private:
nsIScrollableView *mRootScrollable;
//from here to public should be static and locked... MMP
static PRUint32 mVMCount; //number of viewmanagers
static PRInt32 mVMCount; //number of viewmanagers
static nsDrawingSurface mDrawingSurface; //single drawing surface
static nsRect mDSBounds; //for all VMs
@ -273,7 +280,9 @@ private:
public:
//these are public so that our timer callback can poke them.
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
nsITimer *mTimer;
#endif
nsRect mDirtyRect;
nsIView *mRootView;
PRUint32 mFrameRate;