зеркало из https://github.com/mozilla/pjs.git
The locking and unlocking controls some optimization of the image.. like the DIB. r=kmmclusk sr=buster
This commit is contained in:
Родитель
4a2c951744
Коммит
df16aebcb0
|
@ -62,6 +62,8 @@ nsImageWin :: nsImageWin()
|
|||
|
||||
mNaturalWidth = 0;
|
||||
mNaturalHeight = 0;
|
||||
mIsLocked = PR_FALSE;
|
||||
mDIBTemp = PR_FALSE;
|
||||
|
||||
//CleanUp(PR_TRUE);
|
||||
CleanUpDDB();
|
||||
|
@ -1078,7 +1080,7 @@ UINT palType;
|
|||
if (mImageBits != nsnull) {
|
||||
delete [] mImageBits;
|
||||
mImageBits = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1194,30 +1196,40 @@ PRInt16 numPaletteColors;
|
|||
NS_IMETHODIMP
|
||||
nsImageWin::LockImagePixels(PRBool aMaskPixels)
|
||||
{
|
||||
/*
|
||||
if (!mHBitmap)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
... and do Windows locking of image pixels here, if necessary
|
||||
*/
|
||||
/* if (!mHBitmap) return NS_ERROR_NOT_INITIALIZED;
|
||||
... and do Windows locking of image pixels here, if necessary */
|
||||
|
||||
mIsLocked = PR_TRUE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* Unlock the pixels
|
||||
* Unlock the pixels, optimize this nsImageWin
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsImageWin::UnlockImagePixels(PRBool aMaskPixels)
|
||||
{
|
||||
/*
|
||||
if (!mHBitmap)
|
||||
mIsLocked = PR_FALSE;
|
||||
// if memory was allocated temporarily by GetBits, it can now be deleted safely
|
||||
if (mDIBTemp == PR_TRUE) {
|
||||
// get rid of this memory
|
||||
if (mImageBits != nsnull) {
|
||||
delete [] mImageBits;
|
||||
mImageBits = nsnull;
|
||||
}
|
||||
|
||||
mDIBTemp = PR_FALSE;
|
||||
}
|
||||
|
||||
/* if (!mHBitmap)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (aMaskPixels && !mAlphamHBitmap)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
... and do Windows unlocking of image pixels here, if necessary
|
||||
*/
|
||||
... and do Windows unlocking of image pixels here, if necessary */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
/** ---------------------------------------------------
|
||||
|
@ -1268,7 +1280,8 @@ nsRect destRect;
|
|||
|
||||
/**
|
||||
* Get a pointer to the bits for the pixelmap. Will convert to DIB if
|
||||
* only stored in optimized HBITMAP form.
|
||||
* only stored in optimized HBITMAP form. Using this routine will
|
||||
* set the mDIBTemp flag to true so the next unlock will destroy this memory
|
||||
*
|
||||
* @return address of the DIB pixel array
|
||||
*/
|
||||
|
@ -1276,8 +1289,11 @@ nsRect destRect;
|
|||
PRUint8*
|
||||
nsImageWin::GetBits()
|
||||
{
|
||||
if ( !mImageBits )
|
||||
// if mImageBits did not exist.. then
|
||||
if ( !mImageBits ) {
|
||||
ConvertDDBtoDIB(GetWidth(), GetHeight());
|
||||
mDIBTemp = PR_TRUE; // only set to true if the DIB is being created here as temporary
|
||||
}
|
||||
|
||||
return mImageBits;
|
||||
|
||||
|
|
|
@ -246,13 +246,15 @@ private:
|
|||
PRBool mIsOptimized; // Did we convert our DIB to a HBITMAP
|
||||
nsColorMap* mColorMap; // Redundant with mColorTable, but necessary
|
||||
|
||||
PRInt32 mDecodedX1; //Keeps track of what part of image
|
||||
PRInt32 mDecodedY1; // has been decoded.
|
||||
PRInt32 mDecodedX1; //Keeps track of what part of image
|
||||
PRInt32 mDecodedY1; // has been decoded.
|
||||
PRInt32 mDecodedX2;
|
||||
PRInt32 mDecodedY2;
|
||||
PRInt32 mDecodedY2;
|
||||
PRBool mIsLocked; // variable to keep track of the locking
|
||||
PRBool mDIBTemp; // boolean to let us know if DIB was created as temp
|
||||
|
||||
PRInt32 mNaturalWidth;
|
||||
PRInt32 mNaturalHeight;
|
||||
PRInt32 mNaturalWidth;
|
||||
PRInt32 mNaturalHeight;
|
||||
|
||||
// alpha layer members
|
||||
PRUint8 *mAlphaBits; // alpha layer if we made one
|
||||
|
@ -260,13 +262,12 @@ private:
|
|||
PRInt16 mARowBytes; // number of bytes per row in the image for tha alpha
|
||||
PRInt16 mAlphaWidth; // alpha layer width
|
||||
PRInt16 mAlphaHeight; // alpha layer height
|
||||
//nsPoint mLocation; // alpha mask location
|
||||
PRInt8 mImageCache; // place to save off the old image for fast animation
|
||||
PRInt16 mAlphaLevel; // an alpha level every pixel uses
|
||||
HBITMAP mHBitmap; // the GDI bitmaps
|
||||
LPBITMAPINFOHEADER mBHead; // BITMAPINFOHEADER
|
||||
|
||||
static ALPHABLENDPROC gAlphaBlend; // AlphaBlend function pointer
|
||||
static ALPHABLENDPROC gAlphaBlend; // AlphaBlend function pointer
|
||||
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче