From 7f6c689f4d15171198b6968ca66d2beafcee6f36 Mon Sep 17 00:00:00 2001 From: "pavlov%netscape.com" Date: Mon, 23 Apr 2001 08:27:06 +0000 Subject: [PATCH] fixing image colors on beos. patch from Wade Majors . bug 75339. r=pavlov sr=cls@seawood.org --- modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp | 4 ++-- modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp | 8 +++----- modules/libpr0n/decoders/png/nsPNGDecoder.cpp | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp b/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp index 335756126adf..c628700c629f 100644 --- a/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp +++ b/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp @@ -333,7 +333,7 @@ int HaveDecodedRow( if (decoder->mGIFStruct->is_transparent) format = gfxIFormats::RGB_A1; -#ifdef XP_PC +#if defined(XP_PC) || defined(XP_BEOS) // XXX this works... format += 1; // RGB to BGR #endif @@ -421,7 +421,7 @@ int HaveDecodedRow( PRUint32 iwidth = (PRUint32)width; for (PRUint32 x=0; xmGIFStruct->tpixel) { -#ifdef XP_PC +#if defined(XP_PC) || defined(XP_BEOS) *rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].blue; *rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].green; *rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].red; diff --git a/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp b/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp index 0d4b3319f60e..5930a0863d16 100644 --- a/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp +++ b/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp @@ -310,7 +310,7 @@ NS_IMETHODIMP nsJPEGDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PR } gfx_format format = gfxIFormats::RGB; -#ifdef XP_PC +#if defined(XP_PC) || defined(XP_BEOS) format = gfxIFormats::BGR; #endif @@ -524,7 +524,7 @@ nsJPEGDecoder::OutputScanlines(int num_scanlines) samples = mSamples3[0]; } else { /* 24-bit color image */ -#ifdef XP_PC +#if defined(XP_PC) || defined(XP_BEOS) memset(mRGBPadRow, 0, mInfo.output_width * 4); PRUint8 *ptrOutputBuf = mRGBPadRow; @@ -537,8 +537,7 @@ nsJPEGDecoder::OutputScanlines(int num_scanlines) } samples = mRGBPadRow; -#else -#ifdef XP_MAC +#elif defined(XP_MAC) memset(mRGBPadRow, 0, mInfo.output_width * 4); PRUint8 *ptrOutputBuf = mRGBPadRow; @@ -554,7 +553,6 @@ nsJPEGDecoder::OutputScanlines(int num_scanlines) samples = mRGBPadRow; #else samples = mSamples[0]; -#endif #endif } diff --git a/modules/libpr0n/decoders/png/nsPNGDecoder.cpp b/modules/libpr0n/decoders/png/nsPNGDecoder.cpp index e4aa1180677e..a6f2b19049c0 100644 --- a/modules/libpr0n/decoders/png/nsPNGDecoder.cpp +++ b/modules/libpr0n/decoders/png/nsPNGDecoder.cpp @@ -234,7 +234,7 @@ info_callback(png_structp png_ptr, png_infop info_ptr) png_set_gray_to_rgb(png_ptr); -#ifdef XP_PC +#if defined(XP_PC) || defined(XP_BEOS) // windows likes BGR png_set_bgr(png_ptr); #endif @@ -333,7 +333,7 @@ info_callback(png_structp png_ptr, png_infop info_ptr) } } -#ifdef XP_PC +#if defined(XP_PC) || defined(XP_BEOS) // XXX this works... format += 1; // RGB to BGR #endif