minor code cleanups

This commit is contained in:
pavlov%pavlov.net 1999-02-21 17:40:00 +00:00
parent 0c1a88f45d
commit 4dad708332
3 changed files with 17 additions and 20 deletions

View File

@ -33,8 +33,6 @@
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID); static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID);
typedef unsigned char BYTE;
nsDeviceContextGTK::nsDeviceContextGTK() nsDeviceContextGTK::nsDeviceContextGTK()
{ {
NS_INIT_REFCNT(); NS_INIT_REFCNT();
@ -66,9 +64,6 @@ NS_IMETHODIMP nsDeviceContextGTK::Init(nsNativeWidget aNativeWidget)
{ {
GdkVisual *vis; GdkVisual *vis;
for (PRInt32 cnt = 0; cnt < 256; cnt++)
mGammaTable[cnt] = cnt;
mWidget = aNativeWidget; mWidget = aNativeWidget;
// this is used for something odd. who knows // this is used for something odd. who knows

View File

@ -75,11 +75,3 @@ private:
#endif /* nsDeviceContextGTK_h___ */ #endif /* nsDeviceContextGTK_h___ */

View File

@ -88,8 +88,16 @@ nsresult nsImageGTK::Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,nsMask
ComputMetrics(); ComputMetrics();
mImageBits = (PRUint8*) new PRUint8[mSizeImage]; mImageBits = (PRUint8*) new PRUint8[mSizeImage];
if (aMaskRequirements == nsMaskRequirements_kNeeds1Bit)
{ switch(aMaskRequirements)
{
case nsMaskRequirements_kNoMask:
mAlphaBits = nsnull;
mAlphaWidth = 0;
mAlphaHeight = 0;
break;
case nsMaskRequirements_kNeeds1Bit:
mAlphaRowBytes = (aWidth + 7) / 8; mAlphaRowBytes = (aWidth + 7) / 8;
mAlphaDepth = 1; mAlphaDepth = 1;
@ -100,14 +108,16 @@ nsresult nsImageGTK::Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,nsMask
mAlphaWidth = aWidth; mAlphaWidth = aWidth;
mAlphaHeight = aHeight; mAlphaHeight = aHeight;
mAlphaPixmap = gdk_pixmap_new(nsnull, mWidth, mHeight, 1); mAlphaPixmap = gdk_pixmap_new(nsnull, mWidth, mHeight, 1);
break;
} case nsMaskRequirements_kNeeds8Bit:
else
{
mAlphaBits = nsnull; mAlphaBits = nsnull;
mAlphaWidth = 0; mAlphaWidth = 0;
mAlphaHeight = 0; mAlphaHeight = 0;
} g_print("TODO: want an 8bit mask for an image..\n");
break;
}
return NS_OK; return NS_OK;
} }
@ -125,7 +135,7 @@ void nsImageGTK::ComputMetrics()
PRInt32 nsImageGTK::CalcBytesSpan(PRUint32 aWidth) PRInt32 nsImageGTK::CalcBytesSpan(PRUint32 aWidth)
{ {
PRInt32 spanbytes; PRInt32 spanbytes;
spanbytes = (aWidth * mDepth) >> 5; spanbytes = (aWidth * mDepth) >> 5;