mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 18:51:28 +00:00
Fixing FillPolygon code in nsRenderingPh.cpp
Adding debug code in nsDrawingSurfacePh to find the crash. r=kedl
This commit is contained in:
parent
413c60e824
commit
e0efca4c1d
@ -301,7 +301,10 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Init( PhGC_t * &aGC, PRUint32 aWidth,
|
||||
dim.w ++;
|
||||
#endif
|
||||
|
||||
printf ("nsDrawingSurfacePh::Init create drawing surface: area=<%d,%d,%d,%d> %p\n",area.pos.x,area.pos.y,area.size.w,area.size.h,image);
|
||||
printf ("nsDrawingSurfacePh::Init create drawing surface: area=<%d,%d,%d,%d> %p\n",area.pos.x,area.pos.y,area.size.w,area.size.h,image);
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsDrawingSurfacePh::Init create drawing surface: area=<%d,%d,%d,%d> %p\n",
|
||||
area.pos.x,area.pos.y,area.size.w,area.size.h,image));
|
||||
|
||||
PhPoint_t translation = { 0, 0 };
|
||||
PmMemoryContext_t *mc;
|
||||
@ -347,7 +350,7 @@ printf ("nsDrawingSurfacePh::Init create drawing surface: area=<%d,%d,%d,%d> %p\
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsDrawingSurfacePh::Init Finished calling PmMemStart\n"));
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsDrawingSurfacePh::Init Finished calling PmMemStart oldDC=<%p> new mc=<%p>\n", oldDC, mc));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -366,18 +369,18 @@ NS_IMETHODIMP nsDrawingSurfacePh :: ReleaseGC( void )
|
||||
|
||||
NS_IMETHODIMP nsDrawingSurfacePh :: Select( void )
|
||||
{
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsDrawingSurfacePh::Select mIsOffscreen=<%d>\n", mIsOffscreen));
|
||||
|
||||
PhGC_t *gc = PgGetGC();
|
||||
|
||||
if (mholdGC==nsnull)
|
||||
mholdGC = mGC;
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsDrawingSurfacePh::Select mIsOffscreen=<%d> mGC=<%p> gc=<%p> mholdGC=<%p>\n", mIsOffscreen, mGC, gc, mholdGC));
|
||||
|
||||
if (gc == mGC)
|
||||
{
|
||||
//printf ("don't set gc\n");
|
||||
return NS_OK; // kirk - this was a 0, I think its the same?
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsDrawingSurfacePh::Select gc == mGC\n"));
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -393,6 +396,8 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Select( void )
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsDrawingSurfacePh::Select PmMemFlush\n"));
|
||||
|
||||
oldDC=PmMemStart( (PmMemoryContext_t *) mGC);
|
||||
if (oldDC == NULL)
|
||||
{
|
||||
@ -402,8 +407,7 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Select( void )
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsDrawingSurfacePh::Select Finished calling PmMemStart\n"));
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsDrawingSurfacePh::Select Finished calling PmMemStart oldDC=<%p> new mc=<%p>\n", oldDC, mGC));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -417,7 +421,7 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Select( void )
|
||||
|
||||
void nsDrawingSurfacePh::Stop(void)
|
||||
{
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsDrawingSurfacePh::Stop mIsOffscreen=<%d>\n", mIsOffscreen));
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsDrawingSurfacePh::Stop mIsOffscreen=<%d> mGC=<%p>\n", mIsOffscreen, mGC));
|
||||
PgFlush();
|
||||
|
||||
if (mIsOffscreen)
|
||||
|
@ -1081,32 +1081,62 @@ NS_IMETHODIMP nsRenderingContextPh :: DrawPolygon(const nsPoint aPoints[], PRInt
|
||||
|
||||
NS_IMETHODIMP nsRenderingContextPh :: FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||
{
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("untested nsRenderingContextPh::FillPolygon\n"));
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("untested nsRenderingContextPh::FillPolygon aNumPoints=%d\n", aNumPoints));
|
||||
|
||||
#if 0
|
||||
return NS_OK;
|
||||
#else
|
||||
PhPoint_t *pts;
|
||||
|
||||
int err;
|
||||
|
||||
if(( pts = new PhPoint_t [aNumPoints] ) != NULL )
|
||||
{
|
||||
PhPoint_t pos = {0,0};
|
||||
PRInt32 i;
|
||||
|
||||
for(i=0;i<aNumPoints;i++)
|
||||
{
|
||||
PRInt32 i,c;
|
||||
int x,y;
|
||||
|
||||
/* Put the first point into pts */
|
||||
x = aPoints[0].x;
|
||||
y = aPoints[0].y;
|
||||
mTMatrix->TransformCoord(&x,&y);
|
||||
pts[0].x = x;
|
||||
pts[0].y = y;
|
||||
|
||||
for(i=1,c=0;i<aNumPoints;i++)
|
||||
{
|
||||
x = aPoints[i].x;
|
||||
y = aPoints[i].y;
|
||||
mTMatrix->TransformCoord(&x,&y);
|
||||
pts[i].x = x;
|
||||
pts[i].y = y;
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("untested nsRenderingContextPh::FillPolygon %d (%d,%d) -> (%d,%d) \n", i, aPoints[i].x, aPoints[i].y, x, y));
|
||||
|
||||
if ((pts[c].x != x) || (pts[c].y != y))
|
||||
{
|
||||
c++;
|
||||
pts[c].x = x;
|
||||
pts[c].y = y;
|
||||
}
|
||||
}
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("untested nsRenderingContextPh::FillPolygon calling SELECT with %d points\n", (c+1) ));
|
||||
|
||||
SELECT(mSurface);
|
||||
PgDrawPolygon( pts, aNumPoints, &pos, Pg_DRAW_FILL_STROKE | Pg_CLOSED );
|
||||
// err=PgDrawPolygon( pts, (c+1), &pos, Pg_DRAW_FILL_STROKE | Pg_CLOSED );
|
||||
err=PgDrawPolygon( pts, (c+1), &pos, Pg_DRAW_FILL_STROKE );
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("untested nsRenderingContextPh::FillPolygon after PgDrawPolgon err=<%d>\n", err));
|
||||
|
||||
delete [] pts;
|
||||
}
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("untested nsRenderingContextPh::FillPolygon before PgFlush \n"));
|
||||
|
||||
PgFLUSH(); //kedl
|
||||
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("untested nsRenderingContextPh::FillPolygon after PgFlush \n"));
|
||||
|
||||
return NS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1627,6 +1657,7 @@ NS_IMETHODIMP nsRenderingContextPh :: CopyOffScreenBits(nsDrawingSurface aSrcSur
|
||||
else
|
||||
destsurf = mOffscreenSurface;
|
||||
|
||||
/* This is really needed.... */
|
||||
if ( (mBufferIsEmpty) && (aCopyFlags != 12))
|
||||
{
|
||||
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsRenderingContextPh::CopyOffScreenBits Buffer empty, skipping.\n"));
|
||||
|
Loading…
Reference in New Issue
Block a user