Bug 539356 - Part 13 - Only repaint widgets that have had changes since the last paint. r=roc

This commit is contained in:
Matt Woodrow 2012-06-30 15:06:12 +12:00
parent 574dba78d6
commit 4dffec4e63
3 changed files with 15 additions and 1 deletions

View File

@ -4663,6 +4663,10 @@ nsIFrame::SchedulePaint(PRUint32 aFlags)
pres = displayRoot->PresContext();
}
pres->PresShell()->ScheduleViewManagerFlush(aFlags);
nsIWidget *widget = GetNearestWidget();
if (widget) {
widget->SetNeedsPaint(true);
}
}
Layer*

View File

@ -378,7 +378,8 @@ void nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
// damage is applied based on the final widget geometry
if (aFlushDirtyRegion) {
nsIWidget *widget = aView->GetWidget();
if (widget) {
if (widget && widget->NeedsPaint()) {
widget->SetNeedsPaint(false);
#ifdef DEBUG_INVALIDATIONS
printf("---- PAINT START ----PresShell(%p), nsView(%p), nsIWidget(%p)\n", mPresShell, aView, widget);
#endif

View File

@ -387,6 +387,7 @@ class nsIWidget : public nsISupports {
nsIWidget()
: mLastChild(nsnull)
, mPrevSibling(nsnull)
, mNeedsPaint(false)
{}
@ -1570,6 +1571,13 @@ class nsIWidget : public nsISupports {
*/
virtual bool WidgetPaintsBackground() { return false; }
void SetNeedsPaint(bool aNeedsPaint) { mNeedsPaint = aNeedsPaint; }
bool NeedsPaint() {
if (!mNeedsPaint) {
return false;
}
return true;
}
protected:
// keep the list of children. We also keep track of our siblings.
@ -1582,6 +1590,7 @@ protected:
nsIWidget* mLastChild;
nsCOMPtr<nsIWidget> mNextSibling;
nsIWidget* mPrevSibling;
bool mNeedsPaint;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIWidget, NS_IWIDGET_IID)