Fixed up images even more, added calls to get the appropriate bits_per_pixel

This commit is contained in:
rods 1998-06-19 14:47:36 +00:00
Родитель 36e45e1fac
Коммит e7baa01f69
2 изменённых файлов: 25 добавлений и 17 удалений

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

@ -49,7 +49,7 @@ nsImageUnix :: ~nsImageUnix()
}
if(nsnull != mImageBits)
{
//delete[] (PRUint8*)mImageBits;
delete[] (PRUint8*)mImageBits;
mImageBits = nsnull;
}
}
@ -138,7 +138,7 @@ PRInt32 spanbytes;
spanbytes++;
spanbytes <<= 2;
printf("scanbytes: %d\n", spanbytes);
return(spanbytes);
}
@ -167,7 +167,6 @@ PRBool nsImageUnix :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurf
{
nsDrawingSurfaceUnix *unixdrawing =(nsDrawingSurfaceUnix*) aSurface;
printf("Draw::XPutImage %d %d %d %d %d %d\n", aSX,aSY,aDX,aDY,aDWidth,aDHeight);
if (nsnull == mImage)
return PR_FALSE;
@ -186,12 +185,15 @@ PRBool nsImageUnix :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurf
{
nsDrawingSurfaceUnix *unixdrawing =(nsDrawingSurfaceUnix*) aSurface;
printf("Draw::XPutImage2 %d %d %d %d %d %d\n", aX,aY,aX,aY,aWidth,aHeight);
if (nsnull == mImage)
return PR_FALSE;
printf("Draw::XPutImage2 %d %d %d %d %d %d\n", aX,aY,aX,aY,aWidth,aHeight);
XPutImage(unixdrawing->display,unixdrawing->drawable,unixdrawing->gc,mImage,
aX,aY,aX,aY,aWidth,aHeight);
0,0,aX,aY,aWidth,aHeight);
printf("DrawImage 0x%x 0x%x 0x%x \n", unixdrawing->display,
unixdrawing->drawable,
unixdrawing->gc);
return PR_TRUE;
}
@ -232,10 +234,16 @@ void nsImageUnix::CreateImage(nsDrawingSurface aSurface)
if(mImageBits) {
/* Need to support monochrome too */
if (unixdrawing->visual->c_class == TrueColor || unixdrawing->visual->c_class == DirectColor)
if (unixdrawing->visual->c_class == TrueColor ||
unixdrawing->visual->c_class == DirectColor) {
format = ZPixmap;
else
printf("%s\n", (unixdrawing->visual->c_class == TrueColor?"True Color":"DirectColor"));
} else {
format = XYPixmap;
printf("Not True Color\n");
}
printf("Width %d Height %d Visual Depth %d Image Depth %d\n", mWidth, mHeight,
unixdrawing->depth, mDepth);
mImage = ::XCreateImage(unixdrawing->display,
unixdrawing->visual,
@ -243,9 +251,15 @@ void nsImageUnix::CreateImage(nsDrawingSurface aSurface)
format,
0,
(char *)mImageBits,
mWidth,
mHeight,
8,0);
(unsigned int)mWidth,
(unsigned int)mHeight,
32,mRowBytes);
mImage->byte_order = ImageByteOrder(unixdrawing->display);
mImage->bits_per_pixel = unixdrawing->depth;
mImage->bitmap_bit_order = BitmapBitOrder(unixdrawing->display);
mImage->bitmap_unit = 32;
}
return ;
}

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

@ -561,7 +561,6 @@ void nsRenderingContextUnix :: FillRect(nscoord aX, nscoord aY, nscoord aWidth,
h = aHeight;
mTMatrix->TransformCoord(&x,&y,&w,&h);
::XFillRectangle(mRenderingSurface->display,
mRenderingSurface->drawable,
mRenderingSurface->gc,
@ -807,7 +806,6 @@ void nsRenderingContextUnix :: DrawString(const nsString& aString,
void nsRenderingContextUnix :: DrawImage(nsIImage *aImage, nscoord aX, nscoord aY)
{
nscoord width,height;
printf("1-----------------------\n");
width = NS_TO_INT_ROUND(mP2T * aImage->GetWidth());
height = NS_TO_INT_ROUND(mP2T * aImage->GetHeight());
@ -819,7 +817,6 @@ void nsRenderingContextUnix :: DrawImage(nsIImage *aImage, nscoord aX, nscoord a
{
nsRect tr;
printf("2-----------------------\n");
tr.x = aX;
tr.y = aY;
tr.width = aWidth;
@ -831,7 +828,6 @@ void nsRenderingContextUnix :: DrawImage(nsIImage *aImage, const nsRect& aSRect,
{
nsRect sr,dr;
printf("nsRenderingContextUnixStretch :: DrawImage 0x%x\n",aImage);
sr = aSRect;
mTMatrix ->TransformCoord(&sr.x,&sr.y,&sr.width,&sr.height);
@ -846,7 +842,6 @@ void nsRenderingContextUnix :: DrawImage(nsIImage *aImage, const nsRect& aRect)
{
nsRect tr;
printf("nsRenderingContextUnix :: DrawImage 0x%x\n",aImage);
tr = aRect;
mTMatrix->TransformCoord(&tr.x,&tr.y,&tr.width,&tr.height);
@ -860,7 +855,6 @@ nsRect tr;
nsresult nsRenderingContextUnix :: CopyOffScreenBits(nsRect &aBounds)
{
printf("CopyOffScreenBits-----------------------\n");
::XCopyArea(mRenderingSurface->display,
mRenderingSurface->drawable,
mFrontBuffer->drawable,