This commit is contained in:
dcone 1998-06-17 20:03:40 +00:00
Родитель d410f5fb1d
Коммит 210d6c9960
2 изменённых файлов: 43 добавлений и 22 удалений

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

@ -55,11 +55,41 @@ nsresult nsImageUnix :: Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,nsM
mDepth = aDepth;
mMaskReq = aMaskRequirements;
// create the memory for the image
ComputeMetrics();
mImageBits = new unsigned char[mSizeImage];
return NS_OK;
}
//------------------------------------------------------------
void nsImageUnix::ComputMetrics()
{
mRowBytes = CalcBytesSpan(mWidth);
mSizeImage = mRowBytes * mHeight;
}
//------------------------------------------------------------
PRInt32 nsImageWin :: CalcBytesSpan(PRUint32 aWidth)
{
PRInt32 spanbytes;
spanbytes = (aWidth * mDepth) >> 5;
if (((PRUint32)aWidth * mDepth) & 0x1F)
spanbytes++;
spanbytes <<= 2;
return(spanbytes);
}
//------------------------------------------------------------
// set up the pallete to the passed in color array, RGB only in this array
void nsImageUnix :: ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRect *aUpdateRect)
{
@ -117,15 +147,14 @@ PRBool nsImageUnix::SetAlphaMask(nsIImage *aTheMask)
return(PR_FALSE);
}
//------------------------------------------------------------
nsresult nsImageUnix::Optimize(nsDrawingSurface aDrawingSurface)
{
return(NS_OK);
}
nsIImage * nsImageUnix::DuplicateImage()
{
return(nsnull);
}
//------------------------------------------------------------
void nsImageUnix::CreateImage(nsIDeviceContext * aDeviceContext)
{

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

@ -35,11 +35,10 @@ public:
/**
@see nsIImage.h
*/
virtual PRInt32 GetHeight() { return mWidth; }
virtual PRInt32 GetHeight() { return mHeight; }
virtual PRInt32 GetWidth() { return mDepth; }
virtual PRUint8* GetBits() { return nsnull; }
virtual void* GetBitInfo() { return nsnull; }
virtual PRInt32 GetLineStride() {return 0; }
virtual PRBool Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
virtual PRBool Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
@ -55,9 +54,8 @@ public:
virtual PRInt32 GetAlphaXLoc() {return 0;}
virtual PRInt32 GetAlphaYLoc() {return 0;}
virtual PRInt32 GetAlphaLineStride(){ return 0; }
virtual void CompositeImage(nsIImage *aTheImage,nsPoint *aULLocation,nsBlendQuality aQuality);
virtual nsIImage* DuplicateImage();
virtual void CompositeImage(nsIImage *aTheImage,nsPoint *aULLocation,nsBlendQuality aQuality);
virtual nsIImage* DuplicateImage() {return(nsnull);}
/**
* Return the image size of the Device Independent Bitmap(DIB).
@ -77,27 +75,21 @@ public:
* @return the number of bytes in this span
*/
PRInt32 CalcBytesSpan(PRUint32 aWidth);
PRBool SetAlphaMask(nsIImage *aTheMask);
virtual void SetAlphaLevel(PRInt32 aAlphaLevel) {mAlphaLevel=aAlphaLevel;}
virtual PRInt32 GetAlphaLevel() {return(mAlphaLevel);}
void MoveAlphaMask(PRInt32 aX, PRInt32 aY){}
virtual void SetAlphaLevel(PRInt32 aAlphaLevel) {}
virtual PRInt32 GetAlphaLevel() {return(0);}
private:
void CreateImage(nsIDeviceContext * aDeviceContext);
private:
PRInt16 mAlphaLevel; // an alpha level every pixel uses
PRInt32 mWidth;
PRInt32 mDepth;
PRInt32 mHeight;
nsMaskRequirements mMaskReq;
XImage * mImage ;
PRInt32 mDepth; // bits per pixel
PRInt32 mRowBytes;
Pixmap mThePixMap;
PRUint8 mImageBits;
XImage *mImage ;
};