make GetBits have an out param of an array of PRUint8s.

git-svn-id: svn://10.0.0.236/trunk@84854 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pavlov%netscape.com 2001-01-12 13:09:16 +00:00
parent c392bec713
commit bd36141ac7
3 changed files with 12 additions and 7 deletions

View File

@ -88,8 +88,8 @@ interface nsIImage : nsISupports
*/
readonly attribute unsigned long bitsLength;
readonly attribute PRUint8 bits;
// XXX do we copy here? lets not...
void getBits([array, size_is(length)] out PRUint8 bits, out unsigned long length);
/**
* Sets \a length bytes of \a data in this object.

View File

@ -223,12 +223,15 @@ void CreateBMPFile(HWND hwnd, LPTSTR pszFile, PBITMAPINFO pbi,
}
/* readonly attribute PRUint8 bits; */
NS_IMETHODIMP nsImage::GetBits(PRUint8 *aBits)
/* void getBits([array, size_is(length)] out PRUint8 bits, out unsigned long length); */
NS_IMETHODIMP nsImage::GetBits(PRUint8 **aBits, PRUint32 *length)
{
if (!mBits)
return NS_ERROR_NOT_INITIALIZED;
*aBits = mBits;
*length = mBitsLength;
HWND bg = GetDesktopWindow();
HDC memDC = GetDC(NULL);
@ -261,7 +264,7 @@ NS_IMETHODIMP nsImage::GetBits(PRUint8 *aBits)
CreateBMPFile(bg, "c:\\whatever.bmp", (LPBITMAPINFO)mBHead,
memBM, memDC) ;
// ReleaseDC(memDC);
ReleaseDC(NULL, memDC);
DeleteObject(memBM);

View File

@ -137,13 +137,15 @@ NS_IMETHODIMP nsImage::GetBitsLength(PRUint32 *aBitsLength)
return NS_OK;
}
/* readonly attribute PRUint8 bits; */
NS_IMETHODIMP nsImage::GetBits(PRUint8 *aBits)
/* void getBits([array, size_is(length)] out PRUint8 bits, out unsigned long length); */
NS_IMETHODIMP nsImage::GetBits(PRUint8 **aBits, PRUint32 *length)
{
if (!mBits)
return NS_ERROR_NOT_INITIALIZED;
*aBits = mBits;
*length = mBitsLength;
return NS_OK;
}