mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Removed unused code in view module. bug 62675 sr=roc+moz r=rods@netscape.com
This commit is contained in:
parent
f5de6c5dd8
commit
03143956d6
@ -1794,9 +1794,6 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
|
||||
|
||||
mView->GetWidget(*getter_AddRefs(mWindow));
|
||||
|
||||
//set frame rate to 25 fps
|
||||
mViewManager->SetFrameRate(25);
|
||||
|
||||
// This SetFocus is necessary so the Arrow Key and Page Key events
|
||||
// go to the scrolled view as soon as the Window is created instead of going to
|
||||
// the browser window (this enables keyboard scrolling of the document)
|
||||
|
@ -1794,9 +1794,6 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
|
||||
|
||||
mView->GetWidget(*getter_AddRefs(mWindow));
|
||||
|
||||
//set frame rate to 25 fps
|
||||
mViewManager->SetFrameRate(25);
|
||||
|
||||
// This SetFocus is necessary so the Arrow Key and Page Key events
|
||||
// go to the scrolled view as soon as the Window is created instead of going to
|
||||
// the browser window (this enables keyboard scrolling of the document)
|
||||
|
@ -1794,9 +1794,6 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
|
||||
|
||||
mView->GetWidget(*getter_AddRefs(mWindow));
|
||||
|
||||
//set frame rate to 25 fps
|
||||
mViewManager->SetFrameRate(25);
|
||||
|
||||
// This SetFocus is necessary so the Arrow Key and Page Key events
|
||||
// go to the scrolled view as soon as the Window is created instead of going to
|
||||
// the browser window (this enables keyboard scrolling of the document)
|
||||
|
@ -341,20 +341,6 @@ public:
|
||||
*/
|
||||
NS_IMETHOD GetChild(PRInt32 index, nsIView*& aChild) const = 0;
|
||||
|
||||
/**
|
||||
* Note: This didn't exist in 4.0. This transform might include scaling
|
||||
* but probably not rotation for the first pass.
|
||||
* @param transform new transformation of view
|
||||
*/
|
||||
NS_IMETHOD SetTransform(nsTransform2D &aXForm) = 0;
|
||||
|
||||
/**
|
||||
* Note: This didn't exist in 4.0. This transform might include scaling
|
||||
* but probably not rotation for the first pass.
|
||||
* @result view's transformation
|
||||
*/
|
||||
NS_IMETHOD GetTransform(nsTransform2D &aXForm) const = 0;
|
||||
|
||||
/**
|
||||
* Note: This didn't exist in 4.0. Called to set the opacity of a view.
|
||||
* A value of 0.0 means completely transparent. A value of 1.0 means
|
||||
@ -486,15 +472,6 @@ public:
|
||||
*/
|
||||
NS_IMETHOD GetViewFlags(PRUint32 *aFlags) const = 0;
|
||||
|
||||
/**
|
||||
* Get pointer to temporary data storage used by
|
||||
* the compositor. make no assumptions about the
|
||||
* data returned by this method. oh yeah, and it's a hack.
|
||||
* @param aPoint out paramemter for nsPoint structure
|
||||
* stored in view.
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD GetScratchPoint(nsPoint **aPoint) = 0;
|
||||
|
||||
/**
|
||||
* Used by the compositor for temporary marking of a view during
|
||||
|
@ -82,22 +82,6 @@ public:
|
||||
*/
|
||||
NS_IMETHOD SetRootView(nsIView *aView, nsIWidget* aWidget = nsnull) = 0;
|
||||
|
||||
/**
|
||||
* Get the current framerate i.e. the rate at which timed
|
||||
* refreshes occur. A framerate of 0 indicates that timed refreshes
|
||||
* should not occur. framerate is in terms of frames per second
|
||||
* @result the update rate in terms of frames per second
|
||||
*/
|
||||
NS_IMETHOD GetFrameRate(PRUint32& aRate) = 0;
|
||||
|
||||
/**
|
||||
* Set the current framerate.
|
||||
* @param frameRate new update rate. see GetFrameRate for more info
|
||||
* @result the call may need to create a timer and the success
|
||||
* status will be returned. NS_OK means all is well
|
||||
*/
|
||||
NS_IMETHOD SetFrameRate(PRUint32 frameRate) = 0;
|
||||
|
||||
/**
|
||||
* Get the dimensions of the root window. The dimensions are in
|
||||
* twips
|
||||
|
@ -78,7 +78,6 @@ nsView :: nsView()
|
||||
MOZ_COUNT_CTOR(nsView);
|
||||
|
||||
mVis = nsViewVisibility_kShow;
|
||||
mXForm = nsnull;
|
||||
mVFlags = 0;
|
||||
mOpacity = 1.0f;
|
||||
mViewManager = nsnull;
|
||||
@ -105,12 +104,6 @@ nsView :: ~nsView()
|
||||
} while (nsnull != kid);
|
||||
}
|
||||
|
||||
if (mXForm != nsnull)
|
||||
{
|
||||
delete mXForm;
|
||||
mXForm = nsnull;
|
||||
}
|
||||
|
||||
if (nsnull != mViewManager)
|
||||
{
|
||||
nsIView *rootView;
|
||||
@ -871,26 +864,6 @@ NS_IMETHODIMP nsView :: GetChild(PRInt32 index, nsIView *&aChild) const
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsView :: SetTransform(nsTransform2D &aXForm)
|
||||
{
|
||||
if (nsnull == mXForm)
|
||||
mXForm = new nsTransform2D(&aXForm);
|
||||
else
|
||||
*mXForm = aXForm;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsView :: GetTransform(nsTransform2D &aXForm) const
|
||||
{
|
||||
if (nsnull != mXForm)
|
||||
aXForm = *mXForm;
|
||||
else
|
||||
aXForm.SetToIdentity();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsView :: SetOpacity(float opacity)
|
||||
{
|
||||
mOpacity = opacity;
|
||||
@ -1149,12 +1122,6 @@ NS_IMETHODIMP nsView::GetDirtyRegion(nsIRegion *&aRegion) const
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsView::GetScratchPoint(nsPoint **aPoint)
|
||||
{
|
||||
NS_ASSERTION((aPoint != nsnull), "no point");
|
||||
*aPoint = &mScratchPoint;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsView::SetCompositorFlags(PRUint32 aFlags)
|
||||
{
|
||||
|
@ -89,8 +89,6 @@ public:
|
||||
NS_IMETHOD RemoveChild(nsIView *child);
|
||||
NS_IMETHOD GetChildCount(PRInt32 &aCount) const;
|
||||
NS_IMETHOD GetChild(PRInt32 index, nsIView*& aChild) const;
|
||||
NS_IMETHOD SetTransform(nsTransform2D &aXForm);
|
||||
NS_IMETHOD GetTransform(nsTransform2D &aXForm) const;
|
||||
NS_IMETHOD SetOpacity(float opacity);
|
||||
NS_IMETHOD GetOpacity(float &aOpacity) const;
|
||||
NS_IMETHOD HasTransparency(PRBool &aTransparent) const;
|
||||
@ -110,7 +108,6 @@ public:
|
||||
NS_IMETHOD SetViewFlags(PRUint32 aFlags);
|
||||
NS_IMETHOD ClearViewFlags(PRUint32 aFlags);
|
||||
NS_IMETHOD GetViewFlags(PRUint32 *aFlags) const;
|
||||
NS_IMETHOD GetScratchPoint(nsPoint **aPoint);
|
||||
NS_IMETHOD SetCompositorFlags(PRUint32 aFlags);
|
||||
NS_IMETHOD GetCompositorFlags(PRUint32 *aFlags);
|
||||
NS_IMETHOD GetExtents(nsRect *aExtents);
|
||||
@ -153,12 +150,10 @@ protected:
|
||||
PRInt32 mNumKids;
|
||||
nsRect mBounds;
|
||||
nsViewClip mChildClip;
|
||||
nsTransform2D *mXForm;
|
||||
float mOpacity;
|
||||
PRUint32 mVFlags;
|
||||
nsIRegion* mDirtyRegion;
|
||||
nsPoint mScratchPoint;
|
||||
PRUint32 mCompositorFlags;
|
||||
PRUint32 mCompositorFlags;
|
||||
|
||||
// Bug #19416
|
||||
PRBool mShouldIgnoreSetPosition;
|
||||
|
@ -43,7 +43,6 @@ static NS_DEFINE_IID(kRegionCID, NS_REGION_CID);
|
||||
static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID);
|
||||
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
|
||||
#define UPDATE_QUANTUM 1000 / 40
|
||||
|
||||
/**
|
||||
A note about platform assumptions:
|
||||
@ -184,46 +183,6 @@ nsViewManager::PostInvalidateEvent()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
|
||||
|
||||
static void vm_timer_callback(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
nsViewManager *vm = (nsViewManager *)aClosure;
|
||||
|
||||
printf("ViewManager2 timer callback\n");
|
||||
|
||||
//restart the timer
|
||||
|
||||
if (vm->mTrueFrameRate == vm->mFrameRate)
|
||||
{
|
||||
PRUint32 fr = vm->mFrameRate;
|
||||
|
||||
vm->mFrameRate = 0;
|
||||
vm->SetFrameRate(fr);
|
||||
}
|
||||
//printf("timer composite...\n");
|
||||
#ifndef XP_MAC
|
||||
//XXX temporary: The Mac doesn't need the timer to repaint but
|
||||
// obviously this is not the good method to disable the thing.
|
||||
// It's that way for now because the proper solutions
|
||||
// (set UPDATE_QUANTUM to 0, or simply not create the timer)
|
||||
// don't work for now. We'll fix that and then disable the
|
||||
// Mac timers as we should.
|
||||
vm->Composite();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void blinkRect(nsIRenderingContext* context, const nsRect& r)
|
||||
{
|
||||
context->InvertRect(r);
|
||||
::PR_Sleep(::PR_MillisecondsToInterval(100));
|
||||
context->InvertRect(r);
|
||||
}
|
||||
#endif
|
||||
|
||||
class nsZPlaceholderView : public nsIView
|
||||
{
|
||||
public:
|
||||
@ -369,8 +328,6 @@ public:
|
||||
{ NS_ASSERTION(PR_FALSE, "Unimplemented"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetViewFlags(PRUint32 *aFlags) const
|
||||
{ NS_ASSERTION(PR_FALSE, "Unimplemented"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetScratchPoint(nsPoint **aPoint)
|
||||
{ NS_ASSERTION(PR_FALSE, "Unimplemented"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD SetCompositorFlags(PRUint32 aFlags)
|
||||
{ NS_ASSERTION(PR_FALSE, "Unimplemented"); return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
NS_IMETHOD GetCompositorFlags(PRUint32 *aFlags)
|
||||
@ -473,12 +430,6 @@ nsViewManager::nsViewManager()
|
||||
|
||||
nsViewManager::~nsViewManager()
|
||||
{
|
||||
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
|
||||
if (nsnull != mTimer) {
|
||||
mTimer->Cancel(); //XXX this should not be necessary. MMP
|
||||
}
|
||||
#endif
|
||||
|
||||
// Revoke pending invalidate events
|
||||
if (mPendingInvalidateEvent) {
|
||||
NS_ASSERTION(nsnull != mEventQueue,"Event queue is null");
|
||||
@ -612,12 +563,8 @@ NS_IMETHODIMP nsViewManager::Init(nsIDeviceContext* aContext, nscoord aX, nscoor
|
||||
mContext->GetAppUnitsToDevUnits(mTwipsToPixels);
|
||||
mContext->GetDevUnitsToAppUnits(mPixelsToTwips);
|
||||
|
||||
mFrameRate = 0;
|
||||
mTrueFrameRate = 0;
|
||||
mTransCnt = 0;
|
||||
|
||||
rv = SetFrameRate(UPDATE_QUANTUM);
|
||||
|
||||
mLastRefresh = PR_IntervalNow();
|
||||
|
||||
mRefreshEnabled = PR_TRUE;
|
||||
@ -693,44 +640,6 @@ NS_IMETHODIMP nsViewManager :: SetRootView(nsIView *aView, nsIWidget* aWidget)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::GetFrameRate(PRUint32 &aRate)
|
||||
{
|
||||
aRate = mTrueFrameRate;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::SetFrameRate(PRUint32 aFrameRate)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (aFrameRate != mFrameRate)
|
||||
{
|
||||
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
|
||||
if (nsnull != mTimer)
|
||||
{
|
||||
mTimer->Cancel(); //XXX this should not be necessary. MMP
|
||||
}
|
||||
#endif
|
||||
|
||||
mFrameRate = aFrameRate;
|
||||
mTrueFrameRate = aFrameRate;
|
||||
|
||||
if (mFrameRate != 0)
|
||||
{
|
||||
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
|
||||
mTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
|
||||
|
||||
if (NS_OK == rv)
|
||||
mTimer->Init(vm_timer_callback, this, 1000 / mFrameRate);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::GetWindowDimensions(nscoord *width, nscoord *height)
|
||||
{
|
||||
if (nsnull != mRootView)
|
||||
@ -1640,7 +1549,6 @@ NS_IMETHODIMP nsViewManager::Composite()
|
||||
mRootWindow->Update();
|
||||
|
||||
mUpdateCnt = 0;
|
||||
PauseTimer();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -1818,13 +1726,7 @@ NS_IMETHODIMP nsViewManager::UpdateView(nsIView *aView, const nsRect &aRect, PRU
|
||||
// See if we should do an immediate refresh or wait
|
||||
if (aUpdateFlags & NS_VMREFRESH_IMMEDIATE) {
|
||||
Composite();
|
||||
} else if ((mTrueFrameRate > 0) && !(aUpdateFlags & NS_VMREFRESH_NO_SYNC)) {
|
||||
// or if a sync paint is allowed and it's time for the compositor to
|
||||
// do a refresh
|
||||
PRInt32 deltams = PR_IntervalToMilliseconds(PR_IntervalNow() - mLastRefresh);
|
||||
if (deltams > (1000 / (PRInt32)mTrueFrameRate))
|
||||
Composite();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2841,17 +2743,9 @@ NS_IMETHODIMP nsViewManager::EnableRefresh(PRUint32 aUpdateFlags)
|
||||
}
|
||||
|
||||
if (aUpdateFlags & NS_VMREFRESH_IMMEDIATE) {
|
||||
|
||||
if (mTrueFrameRate > 0)
|
||||
{
|
||||
PRInt32 deltams = PR_IntervalToMilliseconds(PR_IntervalNow() - mLastRefresh);
|
||||
|
||||
if (deltams > (1000 / (PRInt32)mTrueFrameRate))
|
||||
Composite();
|
||||
}
|
||||
Composite();
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -3558,17 +3452,6 @@ PRBool nsViewManager::IsClipView(nsIView* aView)
|
||||
return (rv == NS_OK && clipView != nsnull);
|
||||
}
|
||||
|
||||
void nsViewManager::PauseTimer(void)
|
||||
{
|
||||
PRUint32 oldframerate = mTrueFrameRate;
|
||||
SetFrameRate(0);
|
||||
mTrueFrameRate = oldframerate;
|
||||
}
|
||||
|
||||
void nsViewManager::RestartTimer(void)
|
||||
{
|
||||
SetFrameRate(mTrueFrameRate);
|
||||
}
|
||||
|
||||
nsIView* nsViewManager::GetWidgetView(nsIView *aView) const
|
||||
{
|
||||
|
@ -51,12 +51,6 @@ struct DisplayZTreeNode;
|
||||
#endif
|
||||
|
||||
|
||||
// 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();
|
||||
@ -70,9 +64,6 @@ public:
|
||||
NS_IMETHOD GetRootView(nsIView *&aView);
|
||||
NS_IMETHOD SetRootView(nsIView *aView, nsIWidget* aWidget=nsnull);
|
||||
|
||||
NS_IMETHOD GetFrameRate(PRUint32 &aRate);
|
||||
NS_IMETHOD SetFrameRate(PRUint32 frameRate);
|
||||
|
||||
NS_IMETHOD GetWindowDimensions(nscoord *width, nscoord *height);
|
||||
NS_IMETHOD SetWindowDimensions(nscoord width, nscoord height);
|
||||
|
||||
@ -366,17 +357,9 @@ private:
|
||||
nsIRenderingContext *mWhiteCX;
|
||||
|
||||
nsISupportsArray *mCompositeListeners;
|
||||
|
||||
public:
|
||||
//these are public so that our timer callback can poke them.
|
||||
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
#endif
|
||||
nsIView *mRootView;
|
||||
PRUint32 mFrameRate;
|
||||
PRUint32 mTrueFrameRate;
|
||||
|
||||
|
||||
protected:
|
||||
nsIView *mRootView;
|
||||
nscoord mX;
|
||||
nscoord mY;
|
||||
PRBool mAllowDoubleBuffering;
|
||||
|
@ -42,8 +42,6 @@ static NS_DEFINE_IID(kRegionCID, NS_REGION_CID);
|
||||
static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID);
|
||||
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
|
||||
#define UPDATE_QUANTUM 1000 / 40
|
||||
|
||||
|
||||
//#define NO_DOUBLE_BUFFER
|
||||
|
||||
@ -151,44 +149,6 @@ nsViewManager2::PostInvalidateEvent()
|
||||
}
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
PRUint32 fr = vm->mFrameRate;
|
||||
|
||||
vm->mFrameRate = 0;
|
||||
vm->SetFrameRate(fr);
|
||||
}
|
||||
//printf("timer composite...\n");
|
||||
#ifndef XP_MAC
|
||||
//XXX temporary: The Mac doesn't need the timer to repaint but
|
||||
// obviously this is not the good method to disable the thing.
|
||||
// It's that way for now because the proper solutions
|
||||
// (set UPDATE_QUANTUM to 0, or simply not create the timer)
|
||||
// don't work for now. We'll fix that and then disable the
|
||||
// Mac timers as we should.
|
||||
vm->Composite();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void blinkRect(nsIRenderingContext* context, const nsRect& r)
|
||||
{
|
||||
context->InvertRect(r);
|
||||
::PR_Sleep(::PR_MillisecondsToInterval(100));
|
||||
context->InvertRect(r);
|
||||
}
|
||||
#endif
|
||||
|
||||
PRInt32 nsViewManager2::mVMCount = 0;
|
||||
nsDrawingSurface nsViewManager2::mDrawingSurface = nsnull;
|
||||
@ -239,12 +199,6 @@ nsViewManager2::nsViewManager2()
|
||||
|
||||
nsViewManager2::~nsViewManager2()
|
||||
{
|
||||
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
|
||||
if (nsnull != mTimer) {
|
||||
mTimer->Cancel(); //XXX this should not be necessary. MMP
|
||||
}
|
||||
#endif
|
||||
|
||||
// Revoke pending invalidate events
|
||||
if (mPendingInvalidateEvent) {
|
||||
NS_ASSERTION(nsnull != mEventQueue,"Event queue is null");
|
||||
@ -403,12 +357,8 @@ NS_IMETHODIMP nsViewManager2::Init(nsIDeviceContext* aContext, nscoord aX, nscoo
|
||||
mContext->GetAppUnitsToDevUnits(mTwipsToPixels);
|
||||
mContext->GetDevUnitsToAppUnits(mPixelsToTwips);
|
||||
|
||||
mFrameRate = 0;
|
||||
mTrueFrameRate = 0;
|
||||
mTransCnt = 0;
|
||||
|
||||
rv = SetFrameRate(UPDATE_QUANTUM);
|
||||
|
||||
mLastRefresh = PR_IntervalNow();
|
||||
|
||||
mRefreshEnabled = PR_TRUE;
|
||||
@ -482,43 +432,6 @@ NS_IMETHODIMP nsViewManager2 :: SetRootView(nsIView *aView, nsIWidget* aWidget)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager2::GetFrameRate(PRUint32 &aRate)
|
||||
{
|
||||
aRate = mTrueFrameRate;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager2::SetFrameRate(PRUint32 aFrameRate)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (aFrameRate != mFrameRate)
|
||||
{
|
||||
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
|
||||
if (nsnull != mTimer)
|
||||
{
|
||||
mTimer->Cancel(); //XXX this should not be necessary. MMP
|
||||
}
|
||||
#endif
|
||||
|
||||
mFrameRate = aFrameRate;
|
||||
mTrueFrameRate = aFrameRate;
|
||||
|
||||
if (mFrameRate != 0)
|
||||
{
|
||||
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
|
||||
mTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
|
||||
|
||||
if (NS_OK == rv)
|
||||
mTimer->Init(vm_timer_callback, this, 1000 / mFrameRate);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager2::GetWindowDimensions(nscoord *width, nscoord *height)
|
||||
{
|
||||
@ -1207,7 +1120,6 @@ NS_IMETHODIMP nsViewManager2::Composite()
|
||||
mRootWindow->Update();
|
||||
|
||||
mUpdateCnt = 0;
|
||||
PauseTimer();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -1271,9 +1183,7 @@ NS_IMETHODIMP nsViewManager2::UpdateView(nsIView *aView, const nsRect &aRect, PR
|
||||
// Find the nearest view (including this view) that has a widget
|
||||
nsIView *widgetView = GetWidgetView(aView);
|
||||
if (nsnull != widgetView) {
|
||||
if (0 == mUpdateCnt)
|
||||
RestartTimer();
|
||||
|
||||
|
||||
mUpdateCnt++;
|
||||
|
||||
#if 0
|
||||
@ -1315,13 +1225,7 @@ NS_IMETHODIMP nsViewManager2::UpdateView(nsIView *aView, const nsRect &aRect, PR
|
||||
// See if we should do an immediate refresh or wait
|
||||
if (aUpdateFlags & NS_VMREFRESH_IMMEDIATE) {
|
||||
Composite();
|
||||
} else if ((mTrueFrameRate > 0) && !(aUpdateFlags & NS_VMREFRESH_NO_SYNC)) {
|
||||
// or if a sync paint is allowed and it's time for the compositor to
|
||||
// do a refresh
|
||||
PRInt32 deltams = PR_IntervalToMilliseconds(PR_IntervalNow() - mLastRefresh);
|
||||
if (deltams > (1000 / (PRInt32)mTrueFrameRate))
|
||||
Composite();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -2304,14 +2208,7 @@ NS_IMETHODIMP nsViewManager2::EnableRefresh(PRUint32 aUpdateFlags)
|
||||
}
|
||||
|
||||
if (aUpdateFlags & NS_VMREFRESH_IMMEDIATE) {
|
||||
|
||||
if (mTrueFrameRate > 0)
|
||||
{
|
||||
PRInt32 deltams = PR_IntervalToMilliseconds(PR_IntervalNow() - mLastRefresh);
|
||||
|
||||
if (deltams > (1000 / (PRInt32)mTrueFrameRate))
|
||||
Composite();
|
||||
}
|
||||
Composite();
|
||||
}
|
||||
|
||||
|
||||
@ -2804,18 +2701,6 @@ PRBool nsViewManager2::IsClipView(nsIView* aView)
|
||||
return (rv == NS_OK && clipView != nsnull);
|
||||
}
|
||||
|
||||
void nsViewManager2::PauseTimer(void)
|
||||
{
|
||||
PRUint32 oldframerate = mTrueFrameRate;
|
||||
SetFrameRate(0);
|
||||
mTrueFrameRate = oldframerate;
|
||||
}
|
||||
|
||||
void nsViewManager2::RestartTimer(void)
|
||||
{
|
||||
SetFrameRate(mTrueFrameRate);
|
||||
}
|
||||
|
||||
nsIView* nsViewManager2::GetWidgetView(nsIView *aView) const
|
||||
{
|
||||
while (aView != nsnull) {
|
||||
|
@ -48,13 +48,6 @@ struct DisplayListElement2;
|
||||
#include "nsTimer.h"
|
||||
#endif
|
||||
|
||||
|
||||
// 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();
|
||||
@ -68,9 +61,6 @@ public:
|
||||
NS_IMETHOD GetRootView(nsIView *&aView);
|
||||
NS_IMETHOD SetRootView(nsIView *aView, nsIWidget* aWidget=nsnull);
|
||||
|
||||
NS_IMETHOD GetFrameRate(PRUint32 &aRate);
|
||||
NS_IMETHOD SetFrameRate(PRUint32 frameRate);
|
||||
|
||||
NS_IMETHOD GetWindowDimensions(nscoord *width, nscoord *height);
|
||||
NS_IMETHOD SetWindowDimensions(nscoord width, nscoord height);
|
||||
|
||||
@ -206,9 +196,6 @@ private:
|
||||
PRBool DoesViewHaveNativeWidget(nsIView* aView);
|
||||
PRBool IsClipView(nsIView* aView);
|
||||
|
||||
void PauseTimer(void);
|
||||
void RestartTimer(void);
|
||||
|
||||
// Utilities
|
||||
|
||||
/**
|
||||
@ -366,17 +353,9 @@ private:
|
||||
|
||||
nsISupportsArray *mCompositeListeners;
|
||||
|
||||
public:
|
||||
//these are public so that our timer callback can poke them.
|
||||
#ifdef NS_VIEWMANAGER_NEEDS_TIMER
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
#endif
|
||||
protected:
|
||||
nsRect mDirtyRect;
|
||||
nsIView *mRootView;
|
||||
PRUint32 mFrameRate;
|
||||
PRUint32 mTrueFrameRate;
|
||||
|
||||
protected:
|
||||
nscoord mX;
|
||||
nscoord mY;
|
||||
PRBool mAllowDoubleBuffering;
|
||||
|
Loading…
Reference in New Issue
Block a user