Loading gfx/src/thebes/nsThebesImage.cpp +10 −19 Original line number Diff line number Diff line Loading @@ -551,7 +551,7 @@ nsThebesImage::DrawToImage(nsIImage* aDstImage, PRInt32 aDX, PRInt32 aDY, PRInt3 dst->Scale(double(aDWidth)/mWidth, double(aDHeight)/mHeight); dst->SetSource(ThebesSurface()); dst->Fill(); dst->Paint(); return NS_OK; } Loading @@ -563,10 +563,17 @@ static PRUint8 Unpremultiply(PRUint8 aVal, PRUint8 aAlpha) { } static void ARGBToThreeChannel(PRUint32* aARGB, PRUint8* aData) { #ifdef IS_LITTLE_ENDIAN PRUint8 a = (PRUint8)(*aARGB >> 24); PRUint8 r = (PRUint8)(*aARGB >> 16); PRUint8 g = (PRUint8)(*aARGB >> 8); PRUint8 b = (PRUint8)(*aARGB >> 0); #else PRUint8 a = (PRUint8)(*aARGB >> 0); PRUint8 r = (PRUint8)(*aARGB >> 8); PRUint8 g = (PRUint8)(*aARGB >> 16); PRUint8 b = (PRUint8)(*aARGB >> 24); #endif if (a != 0xFF) { if (a == 0) { Loading @@ -580,17 +587,8 @@ static void ARGBToThreeChannel(PRUint32* aARGB, PRUint8* aData) { } } #if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) // BGR format; assume little-endian system #ifndef IS_LITTLE_ENDIAN #error Strange big-endian/OS combination #endif // BGR, blue byte first aData[0] = b; aData[1] = g; aData[2] = r; #else // RGB, red byte first aData[0] = r; aData[1] = g; aData[2] = b; #endif } static PRUint8 Premultiply(PRUint8 aVal, PRUint8 aAlpha) { Loading @@ -601,17 +599,8 @@ static PRUint8 Premultiply(PRUint8 aVal, PRUint8 aAlpha) { static PRUint32 ThreeChannelToARGB(PRUint8* aData, PRUint8 aAlpha) { PRUint8 r, g, b; #if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) // BGR format; assume little-endian system #ifndef IS_LITTLE_ENDIAN #error Strange big-endian/OS combination #endif // BGR, blue byte first b = aData[0]; g = aData[1]; r = aData[2]; #else // RGB, red byte first r = aData[0]; g = aData[1]; b = aData[2]; #endif if (aAlpha != 0xFF) { if (aAlpha == 0) { r = 0; Loading @@ -623,5 +612,7 @@ static PRUint32 ThreeChannelToARGB(PRUint8* aData, PRUint8 aAlpha) { b = Premultiply(b, aAlpha); } } // Output is always ARGB with A in the high byte of a dword return (aAlpha << 24) | (r << 16) | (g << 8) | b; } modules/libpr0n/decoders/bmp/nsBMPDecoder.h +3 −3 Original line number Diff line number Diff line Loading @@ -116,7 +116,7 @@ struct bitFields { #define LITTLE_TO_NATIVE32(x) x #endif #if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)) #define BMP_GFXFORMAT gfxIFormats::BGR #define RLE_GFXFORMAT_ALPHA gfxIFormats::BGR_A1 #else Loading @@ -125,7 +125,7 @@ struct bitFields { #define RLE_GFXFORMAT_ALPHA gfxIFormats::RGB_A1 #endif #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) #define GFXBYTESPERPIXEL 4 #else #define GFXBYTESPERPIXEL 3 Loading Loading @@ -232,7 +232,7 @@ private: * The variable passed in as aDecoded will be moved on 3 bytes! */ inline void SetPixel(PRUint8*& aDecoded, PRUint8 aRed, PRUint8 aGreen, PRUint8 aBlue) { #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) *aDecoded++ = 0; // Mac needs this padding byte #endif #ifdef USE_RGB Loading modules/libpr0n/decoders/bmp/nsICODecoder.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ nsresult nsICODecoder::SetImageData() // Since the ICO is decoded into an exact sized array, the frame may use // more bytes per row of pixels than the decoding array. #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) PRUint32 decodedLineLen = mDirEntry.mWidth * 4; #else PRUint32 decodedLineLen = mDirEntry.mWidth * 3; Loading Loading @@ -400,7 +400,7 @@ nsresult nsICODecoder::ProcessData(const char* aBuffer, PRUint32 aCount) { if (mPos == (mImageOffset + BITMAPINFOSIZE + mNumColors*4)) { // Increment mPos to avoid reprocessing the info header. mPos++; #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) mDecodedBuffer = (PRUint8*)malloc(mDirEntry.mHeight*mDirEntry.mWidth*4); #else mDecodedBuffer = (PRUint8*)malloc(mDirEntry.mHeight*mDirEntry.mWidth*3); Loading modules/libpr0n/decoders/gif/imgContainerGIF.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -994,7 +994,7 @@ void imgContainerGIF::BlackenFrame(gfxIImageFrame *aFrame, PRUint32 bpr; // Bytes Per Row aFrame->GetImageBytesPerRow(&bpr); #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) const PRUint8 bpp = 4; #else const PRUint8 bpp = 3; Loading modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -424,7 +424,7 @@ int nsGIFDecoder2::HaveDecodedRow( format = gfxIFormats::RGB_A1; } #if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) #if !defined(MOZ_ENABLE_CAIRO) || (defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)) // XXX this works... format += 1; // RGB to BGR #endif Loading Loading @@ -509,12 +509,12 @@ int nsGIFDecoder2::HaveDecodedRow( case gfxIFormats::BGR: { while (rowBufIndex != decoder->mGIFStruct->rowend) { #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) *rgbRowIndex++ = 0; // Mac is always 32bits per pixel, this is pad #endif if (*rowBufIndex < cmapsize) { PRUint32 colorIndex = *rowBufIndex * 3; #if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)) *rgbRowIndex++ = cmap[colorIndex + 2]; // blue *rgbRowIndex++ = cmap[colorIndex + 1]; // green *rgbRowIndex++ = cmap[colorIndex]; // red Loading Loading @@ -543,12 +543,12 @@ int nsGIFDecoder2::HaveDecodedRow( memset(decoder->mAlphaLine, 0, abpr); for (PRUint32 x = 0; x < (PRUint32)width; ++x) { if (*rowBufIndex != decoder->mGIFStruct->tpixel) { #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) *rgbRowIndex++ = 0; // Mac is always 32bits per pixel, this is pad #endif if (*rowBufIndex < cmapsize) { PRUint32 colorIndex = *rowBufIndex * 3; #if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)) *rgbRowIndex++ = cmap[colorIndex + 2]; // blue *rgbRowIndex++ = cmap[colorIndex + 1]; // green *rgbRowIndex++ = cmap[colorIndex]; // red Loading @@ -564,7 +564,7 @@ int nsGIFDecoder2::HaveDecodedRow( } decoder->mAlphaLine[x>>3] |= 1<<(7-x&0x7); } else { #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) rgbRowIndex+=4; #else rgbRowIndex+=3; Loading Loading
gfx/src/thebes/nsThebesImage.cpp +10 −19 Original line number Diff line number Diff line Loading @@ -551,7 +551,7 @@ nsThebesImage::DrawToImage(nsIImage* aDstImage, PRInt32 aDX, PRInt32 aDY, PRInt3 dst->Scale(double(aDWidth)/mWidth, double(aDHeight)/mHeight); dst->SetSource(ThebesSurface()); dst->Fill(); dst->Paint(); return NS_OK; } Loading @@ -563,10 +563,17 @@ static PRUint8 Unpremultiply(PRUint8 aVal, PRUint8 aAlpha) { } static void ARGBToThreeChannel(PRUint32* aARGB, PRUint8* aData) { #ifdef IS_LITTLE_ENDIAN PRUint8 a = (PRUint8)(*aARGB >> 24); PRUint8 r = (PRUint8)(*aARGB >> 16); PRUint8 g = (PRUint8)(*aARGB >> 8); PRUint8 b = (PRUint8)(*aARGB >> 0); #else PRUint8 a = (PRUint8)(*aARGB >> 0); PRUint8 r = (PRUint8)(*aARGB >> 8); PRUint8 g = (PRUint8)(*aARGB >> 16); PRUint8 b = (PRUint8)(*aARGB >> 24); #endif if (a != 0xFF) { if (a == 0) { Loading @@ -580,17 +587,8 @@ static void ARGBToThreeChannel(PRUint32* aARGB, PRUint8* aData) { } } #if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) // BGR format; assume little-endian system #ifndef IS_LITTLE_ENDIAN #error Strange big-endian/OS combination #endif // BGR, blue byte first aData[0] = b; aData[1] = g; aData[2] = r; #else // RGB, red byte first aData[0] = r; aData[1] = g; aData[2] = b; #endif } static PRUint8 Premultiply(PRUint8 aVal, PRUint8 aAlpha) { Loading @@ -601,17 +599,8 @@ static PRUint8 Premultiply(PRUint8 aVal, PRUint8 aAlpha) { static PRUint32 ThreeChannelToARGB(PRUint8* aData, PRUint8 aAlpha) { PRUint8 r, g, b; #if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) // BGR format; assume little-endian system #ifndef IS_LITTLE_ENDIAN #error Strange big-endian/OS combination #endif // BGR, blue byte first b = aData[0]; g = aData[1]; r = aData[2]; #else // RGB, red byte first r = aData[0]; g = aData[1]; b = aData[2]; #endif if (aAlpha != 0xFF) { if (aAlpha == 0) { r = 0; Loading @@ -623,5 +612,7 @@ static PRUint32 ThreeChannelToARGB(PRUint8* aData, PRUint8 aAlpha) { b = Premultiply(b, aAlpha); } } // Output is always ARGB with A in the high byte of a dword return (aAlpha << 24) | (r << 16) | (g << 8) | b; }
modules/libpr0n/decoders/bmp/nsBMPDecoder.h +3 −3 Original line number Diff line number Diff line Loading @@ -116,7 +116,7 @@ struct bitFields { #define LITTLE_TO_NATIVE32(x) x #endif #if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)) #define BMP_GFXFORMAT gfxIFormats::BGR #define RLE_GFXFORMAT_ALPHA gfxIFormats::BGR_A1 #else Loading @@ -125,7 +125,7 @@ struct bitFields { #define RLE_GFXFORMAT_ALPHA gfxIFormats::RGB_A1 #endif #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) #define GFXBYTESPERPIXEL 4 #else #define GFXBYTESPERPIXEL 3 Loading Loading @@ -232,7 +232,7 @@ private: * The variable passed in as aDecoded will be moved on 3 bytes! */ inline void SetPixel(PRUint8*& aDecoded, PRUint8 aRed, PRUint8 aGreen, PRUint8 aBlue) { #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) *aDecoded++ = 0; // Mac needs this padding byte #endif #ifdef USE_RGB Loading
modules/libpr0n/decoders/bmp/nsICODecoder.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ nsresult nsICODecoder::SetImageData() // Since the ICO is decoded into an exact sized array, the frame may use // more bytes per row of pixels than the decoding array. #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) PRUint32 decodedLineLen = mDirEntry.mWidth * 4; #else PRUint32 decodedLineLen = mDirEntry.mWidth * 3; Loading Loading @@ -400,7 +400,7 @@ nsresult nsICODecoder::ProcessData(const char* aBuffer, PRUint32 aCount) { if (mPos == (mImageOffset + BITMAPINFOSIZE + mNumColors*4)) { // Increment mPos to avoid reprocessing the info header. mPos++; #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) mDecodedBuffer = (PRUint8*)malloc(mDirEntry.mHeight*mDirEntry.mWidth*4); #else mDecodedBuffer = (PRUint8*)malloc(mDirEntry.mHeight*mDirEntry.mWidth*3); Loading
modules/libpr0n/decoders/gif/imgContainerGIF.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -994,7 +994,7 @@ void imgContainerGIF::BlackenFrame(gfxIImageFrame *aFrame, PRUint32 bpr; // Bytes Per Row aFrame->GetImageBytesPerRow(&bpr); #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) const PRUint8 bpp = 4; #else const PRUint8 bpp = 3; Loading
modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -424,7 +424,7 @@ int nsGIFDecoder2::HaveDecodedRow( format = gfxIFormats::RGB_A1; } #if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) #if !defined(MOZ_ENABLE_CAIRO) || (defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)) // XXX this works... format += 1; // RGB to BGR #endif Loading Loading @@ -509,12 +509,12 @@ int nsGIFDecoder2::HaveDecodedRow( case gfxIFormats::BGR: { while (rowBufIndex != decoder->mGIFStruct->rowend) { #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) *rgbRowIndex++ = 0; // Mac is always 32bits per pixel, this is pad #endif if (*rowBufIndex < cmapsize) { PRUint32 colorIndex = *rowBufIndex * 3; #if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)) *rgbRowIndex++ = cmap[colorIndex + 2]; // blue *rgbRowIndex++ = cmap[colorIndex + 1]; // green *rgbRowIndex++ = cmap[colorIndex]; // red Loading Loading @@ -543,12 +543,12 @@ int nsGIFDecoder2::HaveDecodedRow( memset(decoder->mAlphaLine, 0, abpr); for (PRUint32 x = 0; x < (PRUint32)width; ++x) { if (*rowBufIndex != decoder->mGIFStruct->tpixel) { #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) *rgbRowIndex++ = 0; // Mac is always 32bits per pixel, this is pad #endif if (*rowBufIndex < cmapsize) { PRUint32 colorIndex = *rowBufIndex * 3; #if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)) *rgbRowIndex++ = cmap[colorIndex + 2]; // blue *rgbRowIndex++ = cmap[colorIndex + 1]; // green *rgbRowIndex++ = cmap[colorIndex]; // red Loading @@ -564,7 +564,7 @@ int nsGIFDecoder2::HaveDecodedRow( } decoder->mAlphaLine[x>>3] |= 1<<(7-x&0x7); } else { #if defined(XP_MAC) || defined(XP_MACOSX) #if !defined(MOZ_CAIRO_GFX) && (defined(XP_MAC) || defined(XP_MACOSX)) rgbRowIndex+=4; #else rgbRowIndex+=3; Loading