mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
fixed problems with InvertRect
This commit is contained in:
parent
375405b6fb
commit
28ca1635ee
@ -184,6 +184,30 @@ for (y=0;y<dim.h;y++)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawingSurfacePh :: XOR(PRInt32 aX, PRInt32 aY,
|
||||
PRUint32 aWidth, PRUint32 aHeight)
|
||||
{
|
||||
//printf ("XOR: %d, %d %d %d %d\n",mIsOffscreen,aX,aY,aWidth,aHeight);
|
||||
|
||||
int x;
|
||||
int y;
|
||||
unsigned char *ptr;
|
||||
|
||||
PmMemFlush( (PmMemoryContext_t *) mGC, mPixmap ); // get the image
|
||||
ptr = mPixmap->image;
|
||||
|
||||
for (y=aY;y<aY+aHeight;y++)
|
||||
{
|
||||
for (x=aX;x<aX+aWidth;x++)
|
||||
{
|
||||
ptr[3*x+0+(y*mPixmap->bpl)]^=255;
|
||||
ptr[3*x+1+(y*mPixmap->bpl)]^=255;
|
||||
ptr[3*x+2+(y*mPixmap->bpl)]^=255;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
extern void *Mask;
|
||||
NS_IMETHODIMP nsDrawingSurfacePh :: Unlock(void)
|
||||
{
|
||||
@ -340,6 +364,7 @@ PhGC_t *gc=PgGetGC();
|
||||
|
||||
if (mholdGC==nsnull) mholdGC = mGC;
|
||||
|
||||
|
||||
if (gc==mGC)
|
||||
{
|
||||
//printf ("don't set gc\n");
|
||||
@ -350,6 +375,7 @@ PhGC_t *gc=PgGetGC();
|
||||
if (mIsOffscreen)
|
||||
{
|
||||
//printf ("going offscreen: %p\n",mGC); fflush(stdout);
|
||||
PmMemFlush( (PmMemoryContext_t *) mGC, mPixmap ); // get the image
|
||||
PmMemStart( (PmMemoryContext_t *) mGC);
|
||||
// PgSetRegion(mGC->rid);
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
NS_IMETHOD Lock(PRInt32 aX, PRInt32 aY, PRUint32 aWidth, PRUint32 aHeight,
|
||||
void **aBits, PRInt32 *aStride, PRInt32 *aWidthBytes,
|
||||
PRUint32 aFlags);
|
||||
NS_IMETHOD XOR(PRInt32 aX, PRInt32 aY, PRUint32 aWidth, PRUint32 aHeight);
|
||||
NS_IMETHOD Unlock(void);
|
||||
NS_IMETHOD GetDimensions(PRUint32 *aWidth, PRUint32 *aHeight);
|
||||
NS_IMETHOD IsOffscreen(PRBool *aOffScreen);
|
||||
|
@ -1000,6 +1000,7 @@ NS_IMETHODIMP nsRenderingContextPh :: FillRect(nscoord aX, nscoord aY, nscoord a
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
SELECT(mSurface);
|
||||
PgDrawIRect( x, y, x + w - 1, y + h - 1, Pg_DRAW_FILL_STROKE );
|
||||
// PgDrawIRect( x, y, x + w - 1, y + h - 1, Pg_DRAW_FILL );
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1013,19 +1014,31 @@ nsRenderingContextPh :: InvertRect(const nsRect& aRect)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// kedl,july 21, 1999
|
||||
// looks like we crashe on test12 when u try to select; but so does linux
|
||||
// and windows rips on test12.... yippeeeee; otherwise we look great!
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextPh :: InvertRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
int oldcolor;
|
||||
|
||||
// NS_NOTYETIMPLEMENTED("nsRenderingContextPh::InvertRect");
|
||||
printf ("invert rect: %d %d %d %d\n",aX,aY,aWidth,aHeight);
|
||||
|
||||
oldcolor=PgSetFillColor(Pg_INVERT_COLOR);
|
||||
nscoord x,y,w,h;
|
||||
|
||||
x = aX;
|
||||
y = aY;
|
||||
w = aWidth;
|
||||
h = aHeight;
|
||||
|
||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||
SELECT(mSurface);
|
||||
// printf ("invert rect: %d %d %d %d\n",x,y,w,h);
|
||||
|
||||
PgSetFillColor(Pg_INVERT_COLOR);
|
||||
PgSetDrawMode(Pg_DRAWMODE_XOR);
|
||||
FillRect( aX, aY, aWidth, aHeight );
|
||||
PgDrawIRect( x, y, x + w - 1, y + h - 1, Pg_DRAW_FILL );
|
||||
PgSetDrawMode(Pg_DRAWMODE_OPAQUE);
|
||||
PgSetFillColor(oldcolor);
|
||||
|
||||
//good mSurface->XOR(x,y,w,h);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user