Added debug code to try and track down extra draws..

r=kedl
This commit is contained in:
Jerry.Kirk%Nexwarecorp.com 1999-11-29 21:37:43 +00:00
Родитель 59e1d2caa9
Коммит 9974c09f4e
2 изменённых файлов: 48 добавлений и 22 удалений

Просмотреть файл

@ -51,6 +51,8 @@ static nsIWidget *gRollupWidget = nsnull;
/* Enable this to queue widget damage, this should be ON by default */
#define ENABLE_DAMAGE_QUEUE
/* Enable this causing extra redraw when the RELEASE is called */
#define ENABLE_DAMAGE_QUEUE_HOLDOFF
/* Initialize Static nsWidget class members */
@ -787,7 +789,7 @@ NS_METHOD nsWidget::Invalidate(PRBool aIsSynchronous)
NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 this=<%p> rect=(%ld,%ld,%ld,%ld) IsSync=<%d>\n", this, aRect.x, aRect.y, aRect.width, aRect.height, aIsSynchronous));
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 this=<%p> dmg rect=(%ld,%ld,%ld,%ld) IsSync=<%d>\n", this, aRect.x, aRect.y, aRect.width, aRect.height, aIsSynchronous));
if (!mWidget)
{
@ -798,6 +800,7 @@ NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
if (!PtWidgetIsRealized(mWidget))
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 - mWidget is not realized\n"));
return NS_OK;
// return NS_ERROR_FAILURE;
}
@ -809,11 +812,13 @@ NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
if ( GetParentClippedArea(rect) == PR_TRUE )
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 before Clipped rect=(%d,%d,%d,%d) mBounds=(%d,%d)\n", rect.x, rect.y, rect.width, rect.height, mBounds.x, mBounds.y));
/* convert back widget coords */
rect.x -= mBounds.x;
rect.y -= mBounds.y;
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 Clipped rect=(%i,%i,%i,%i)\n", rect.x - mBounds.x, rect.y - mBounds.y, rect.width, rect.height ));
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 Clipped rect=(%i,%i,%i,%i)\n", rect.x, rect.y, rect.width, rect.height ));
mUpdateArea->Union(aRect.x, aRect.y, aRect.width, aRect.height);
@ -2069,13 +2074,14 @@ void nsWidget::UpdateWidgetDamage()
RemoveDamagedWidget( mWidget );
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged 1 \n"));
if (mUpdateArea->IsEmpty())
{
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged skipping update because mUpdateArea IsEmpty() this=<%p>\n", this));
return;
}
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged 2 \n"));
PhRect_t extent;
PhArea_t area;
@ -2085,17 +2091,25 @@ void nsWidget::UpdateWidgetDamage()
nsRect temp_rect;
PtWidgetArea( mWidget, &area );
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged 3 \n"));
if (PtWidgetIsClass(mWidget, PtWindow))
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::UpdateWidgetDamaged mWidget=<%p> is a PtWindow, set x,y=0\n", mWidget));
area.pos.x = area.pos.y = 0;
}
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged 4 \n"));
if (NS_FAILED(mUpdateArea->GetRects(&regionRectSet)))
{
NS_ASSERTION(0,"nsWidget::UpdateWidgetDamaged Error mUpdateArea->GetRects returned NULL");
return;
}
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged 5 \n"));
#if 0
int Global_Widget_Hold_Count;
Global_Widget_Hold_Count = PtContainerHold(mWidget);
@ -2103,10 +2117,17 @@ void nsWidget::UpdateWidgetDamage()
#endif
len = regionRectSet->mRectsLen;
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::UpdateWidgetDamaged %d rects to damage\n", len));
for (i=0;i<len;++i)
{
nsRegionRect *r = &(regionRectSet->mRects[i]);
temp_rect.SetRect(r->x, r->y, r->width, r->height);
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::UpdateWidgetDamaged temp_rect=(%d,%d,%d,%d)\n", r->x, r->y, r->width, r->height));
if( GetParentClippedArea(temp_rect))
{
@ -2178,9 +2199,11 @@ void nsWidget::RemoveDamagedWidget(PtWidget_t *aWidget)
Global_Widget_Hold_Count = PtRelease();
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::RemoveDamagedWidget PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, this));
#endif
if( mWorkProcID )
PtAppRemoveWorkProc( nsnull, mWorkProcID );
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::RemoveDamagedWidget finished removing last item\n"));
}
}
}

Просмотреть файл

@ -973,6 +973,7 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage )
/* Print out the Photon Damage tiles */
PhTile_t *top = damage;
int index=0;
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc Damage Tiles List:\n"));
do {
PhRect_t rect = top->rect;
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc photon damage %d rect=<%d,%d,%d,%d> next=<%p>\n", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next));
@ -995,32 +996,30 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage )
return;
}
#if 0
if ( !pWin->mParent )
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc aborted because pWin->mParent is NULL!\n"));
NS_ASSERTION(pWin->mParent, "nsWindow::RawDrawFunc aborted because pWin->mParent is NULL!");
return;
}
#endif
#if 1
if (PtWidgetBrotherInFront(pWidget) != NULL)
{
NS_ASSERTION(0, "nsWindow::RawDrawFunc Brother In Front is not NULL!");
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc Brother In Front is not NULL\n"));
}
else
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc Brother In Front is NULL\n"));
}
#endif
#if 1
if ( PtWidgetIsClass(pWidget, PtRawDrawContainer))
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc pWidget is aRawDrawCon\n"));
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc pWidget is a RawDrawContainer\n"));
}
else
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc aborted because Brother In Front is not NULL\n"));
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc aborted because pWidget is not a RawDrawContainer\n"));
return;
}
}
#endif
#if 1
// This prevents redraws while any window is resizing, ie there are
@ -1036,8 +1035,8 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage )
if ( pWin->mEventCallback )
{
PhRect_t rect;
PhArea_t area;
PhPoint_t offset;
PhArea_t area = {{0,0},{0,0}};
PhPoint_t offset = {0,0};
nsRect nsDmg;
// Ok... I ~think~ the damage rect is in window coordinates and is not neccessarily clipped to
@ -1047,9 +1046,11 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage )
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc area=<%d,%d,%d,%d>\n", area.pos.x, area.pos.y, area.size.w, area.size.h));
PtWidgetOffset( pWidget, &offset );
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc offset=<%d,%d>\n", offset.x, offset.y));
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc mBounds=<%d,%d,%d,%d>\n", pWin->mBounds.x, pWin->mBounds.y, pWin->mBounds.width, pWin->mBounds.height));
offset.x += area.pos.x;
offset.y += area.pos.y;
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc area+offset=<%d,%d,%d,%d>\n", area.pos.x, area.pos.y, area.size.w, area.size.h));
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc offset+area =<%d,%d>\n", offset.x, offset.y));
#if 0
@ -1071,13 +1072,15 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc area+offset=<%d,%d,%d,%d>
}
#endif
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc damage rect = <%d,%d,%d,%d>\n", rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y));
// Convert damage rect to widget's coordinates...
rect.ul.x -= offset.x;
rect.ul.y -= offset.y;
rect.lr.x -= offset.x;
rect.lr.y -= offset.y;
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc damage rect + offset <%d,%d,%d,%d> next=<%p>\n", rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, damage->next));
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc damage rect-offset <%d,%d,%d,%d> next=<%p>\n", rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, damage->next));
// If the damage tile is not within our bounds, do nothing
if(( rect.ul.x >= area.size.w ) || ( rect.ul.y >= area.size.h ) || ( rect.lr.x < 0 ) || ( rect.lr.y < 0 ))
@ -1765,7 +1768,7 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY)
/* If I am a top-level window my origin should always be 0,0 */
if ( (mWindowType == eWindowType_dialog) ||
(mWindowType == eWindowType_popup) ||
// (mWindowType == eWindowType_popup) ||
(mWindowType == eWindowType_toplevel) )
{
//printf("HACK HACK: forcing bounds to 0,0 for toplevel window\n");