Fix bug 113406: make Mac image code able to deal with wide images. r=ccarlen, sr=bryner.

This commit is contained in:
sfraser%netscape.com 2004-03-02 04:01:13 +00:00
Родитель 474f65d61e
Коммит 5a0028c3b3
3 изменённых файлов: 418 добавлений и 598 удалений

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

@ -76,7 +76,7 @@ public:
NS_IMETHOD ConvertFromPICT ( PicHandle inPicture ) = 0; NS_IMETHOD ConvertFromPICT ( PicHandle inPicture ) = 0;
// Get the PixMap for this image // Get the PixMap for this image
NS_IMETHOD GetPixMap ( PixMap** aPixMap ) = 0; NS_IMETHOD GetGWorldPtr ( GWorldPtr* aGWorld ) = 0;
//Convert to the os-native icon format. Most used to put icons //Convert to the os-native icon format. Most used to put icons
//onto windows and menus. The outIcon will be allocated, the caller //onto windows and menus. The outIcon will be allocated, the caller

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -55,7 +55,7 @@ public:
@see nsIImage.h @see nsIImage.h
*/ */
virtual nsresult Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, nsMaskRequirements aMaskRequirements); virtual nsresult Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, nsMaskRequirements aMaskRequirements);
virtual PRInt32 GetBytesPix() { return mBytesPerPixel; } virtual PRInt32 GetBytesPix() { return mBytesPerPixel; } // this is unused
virtual PRBool GetIsRowOrderTopToBottom() { return PR_TRUE; } virtual PRBool GetIsRowOrderTopToBottom() { return PR_TRUE; }
virtual PRInt32 GetWidth() { return mWidth; } virtual PRInt32 GetWidth() { return mWidth; }
@ -63,10 +63,10 @@ public:
virtual PRUint8* GetBits(); virtual PRUint8* GetBits();
virtual PRInt32 GetLineStride() { return mRowBytes; } virtual PRInt32 GetLineStride() { return mRowBytes; }
virtual PRBool GetHasAlphaMask() { return mMaskBitsHandle != nsnull; } virtual PRBool GetHasAlphaMask() { return mMaskGWorld != nsnull; }
virtual PRUint8* GetAlphaBits(); virtual PRUint8* GetAlphaBits();
virtual PRInt32 GetAlphaLineStride() { return mARowBytes; } virtual PRInt32 GetAlphaLineStride() { return mAlphaRowBytes; }
virtual void ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRect *aUpdateRect); virtual void ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRect *aUpdateRect);
virtual nsresult Optimize(nsIDeviceContext* aContext); virtual nsresult Optimize(nsIDeviceContext* aContext);
@ -102,7 +102,7 @@ public:
NS_IMETHOD UnlockImagePixels(PRBool aMaskPixels); NS_IMETHOD UnlockImagePixels(PRBool aMaskPixels);
NS_IMETHOD GetPixMap(PixMap** outPixMap); NS_IMETHOD GetGWorldPtr(GWorldPtr* aGWorld);
// Convert to and from the os-native PICT format. Most likely // Convert to and from the os-native PICT format. Most likely
// used for clipboard. // used for clipboard.
@ -139,25 +139,23 @@ protected:
PRInt32 aSXOffset, PRInt32 aSYOffset, PRInt32 aSXOffset, PRInt32 aSYOffset,
const nsRect &aTileRect); const nsRect &aTileRect);
nsresult CopyPixMap( Rect& aSrcRegion, nsresult CopyPixMap( const Rect& aSrcRegion,
Rect& aDestRegion, const Rect& aDestRegion,
const PRInt32 aDestDepth,
const PRBool aCopyMaskBits,
Handle *aDestData);
nsresult CopyPixMapInternal( Rect& aSrcRegion,
Rect& aDestRegion,
const PRInt32 aDestDepth, const PRInt32 aDestDepth,
const PRBool aCopyMaskBits, const PRBool aCopyMaskBits,
Handle *aDestData, Handle *aDestData,
PRBool aAllow2Bytes); PRBool aAllow2Bytes = PR_FALSE);
static GDHandle GetCachedGDeviceForDepth(PRInt32 aDepth);
static OSType MakeIconType(PRInt32 aHeight, PRInt32 aDepth, PRBool aMask); static OSType MakeIconType(PRInt32 aHeight, PRInt32 aDepth, PRBool aMask);
static OSErr CreatePixMap(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, CTabHandle aColorTable, static OSErr CreateGWorld(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,
PixMap& ioPixMap, Handle& ioBitsHandle); GWorldPtr* outGWorld, char** outBits, PRInt32* outRowBytes);
static OSErr AllocateBitsHandle(PRInt32 imageSizeBytes, Handle *outHandle);
static PRInt32 CalculateRowBytes(PRUint32 aWidth,PRUint32 aDepth); static PRInt32 CalculateRowBytes(PRUint32 aWidth, PRUint32 aDepth);
static PRUint32 GetPixelFormatForDepth(PRInt32 inDepth, PRInt32& outBitsPerPixel, CTabHandle* outDefaultColorTable = nsnull);
static void ClearGWorld(GWorldPtr); static void ClearGWorld(GWorldPtr);
static OSErr AllocateGWorld(PRInt16 depth, CTabHandle colorTable, const Rect& bounds, GWorldPtr *outGWorld); static OSErr AllocateGWorld(PRInt16 depth, CTabHandle colorTable, const Rect& bounds, GWorldPtr *outGWorld);
@ -177,12 +175,12 @@ protected:
static PRBool RenderingToPrinter(nsIRenderingContext &aContext); static PRBool RenderingToPrinter(nsIRenderingContext &aContext);
static OSErr CreatePixMapInternal( PRInt32 aWidth, static OSErr CreateGWorldInternal( PRInt32 aWidth,
PRInt32 aHeight, PRInt32 aHeight,
PRInt32 aDepth, PRInt32 aDepth,
CTabHandle aColorTable, GWorldPtr* outGWorld,
PixMap& ioPixMap, char** outBits,
Handle& ioBitsHandle, PRInt32* outRowBytes,
PRBool aAllow2Bytes); PRBool aAllow2Bytes);
static PRInt32 CalculateRowBytesInternal(PRUint32 aWidth, static PRInt32 CalculateRowBytesInternal(PRUint32 aWidth,
@ -191,8 +189,8 @@ protected:
private: private:
PixMap mImagePixmap; GWorldPtr mImageGWorld;
Handle mImageBitsHandle; // handle for the image bits char* mImageBits; // malloc'd block
PRInt32 mWidth; PRInt32 mWidth;
PRInt32 mHeight; PRInt32 mHeight;
@ -201,13 +199,13 @@ private:
PRInt32 mBytesPerPixel; PRInt32 mBytesPerPixel;
// alpha layer members // alpha layer members
PixMap mMaskPixmap; // the alpha level pixel map GWorldPtr mMaskGWorld;
Handle mMaskBitsHandle; // handle for the mask bits char* mMaskBits; // malloc'd block
PRInt16 mAlphaDepth; // alpha layer depth PRInt16 mAlphaDepth; // alpha layer depth
PRInt32 mARowBytes; // alpha row bytes PRInt32 mAlphaRowBytes; // alpha row bytes
PRInt32 mDecodedX1; //Keeps track of what part of image PRInt32 mDecodedX1; // Keeps track of what part of image
PRInt32 mDecodedY1; // has been decoded. PRInt32 mDecodedY1; // has been decoded.
PRInt32 mDecodedX2; PRInt32 mDecodedX2;
PRInt32 mDecodedY2; PRInt32 mDecodedY2;
@ -216,7 +214,6 @@ private:
//PRInt8 mImageCache; // place to save off the old image for fast animation //PRInt8 mImageCache; // place to save off the old image for fast animation
}; };
#endif #endif