From 6812332e436cd9c8ead470875af2b28fab0aba90 Mon Sep 17 00:00:00 2001 From: "pavlov%netscape.com" Date: Wed, 13 Jun 2001 01:13:06 +0000 Subject: [PATCH] fixing image rendering color problems on photon. patch from briane@qnx.com. r=pavlov sr=blizzard a=asa --- modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp | 4 ++-- modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp | 6 +++--- modules/libpr0n/decoders/png/nsPNGDecoder.cpp | 4 ++-- modules/libpr0n/src/imgContainer.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp b/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp index 03dddbb93f7..d8e1e29690a 100644 --- a/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp +++ b/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp @@ -402,7 +402,7 @@ int HaveDecodedRow( format = gfxIFormats::RGB_A1; } -#if defined(XP_PC) || defined(XP_BEOS) +#if defined(XP_PC) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) // XXX this works... format += 1; // RGB to BGR #endif @@ -511,7 +511,7 @@ int HaveDecodedRow( PRUint32 iwidth = (PRUint32)width; for (PRUint32 x=0; xmGIFStruct->tpixel) { -#if defined(XP_PC) || defined(XP_BEOS) +#if defined(XP_PC) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) *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 f7495cab39f..716aaf913f3 100644 --- a/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp +++ b/modules/libpr0n/decoders/jpeg/nsJPEGDecoder.cpp @@ -316,7 +316,7 @@ NS_IMETHODIMP nsJPEGDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PR } gfx_format format = gfxIFormats::RGB; -#if defined(XP_PC) || defined(XP_BEOS) +#if defined(XP_PC) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) format = gfxIFormats::BGR; #endif @@ -346,7 +346,7 @@ NS_IMETHODIMP nsJPEGDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PR JPOOL_IMAGE, row_stride, 1); -#if defined(XP_PC) || defined(XP_BEOS) || defined(XP_MAC) +#if defined(XP_PC) || defined(XP_BEOS) || defined(XP_MAC) || defined(MOZ_WIDGET_PHOTON) // allocate buffer to do byte flipping if needed if (mInfo.output_components == 3) { mRGBPadRow = (PRUint8*) PR_MALLOC(row_stride); @@ -527,7 +527,7 @@ nsJPEGDecoder::OutputScanlines(int num_scanlines) samples = mSamples3[0]; } else { /* 24-bit color image */ -#if defined(XP_PC) || defined(XP_BEOS) +#if defined(XP_PC) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) memset(mRGBPadRow, 0, mInfo.output_width * 4); PRUint8 *ptrOutputBuf = mRGBPadRow; diff --git a/modules/libpr0n/decoders/png/nsPNGDecoder.cpp b/modules/libpr0n/decoders/png/nsPNGDecoder.cpp index a6f2b19049c..f4cbeb4a582 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); -#if defined(XP_PC) || defined(XP_BEOS) +#if defined(XP_PC) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) // windows likes BGR png_set_bgr(png_ptr); #endif @@ -333,7 +333,7 @@ info_callback(png_structp png_ptr, png_infop info_ptr) } } -#if defined(XP_PC) || defined(XP_BEOS) +#if defined(XP_PC) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON) // XXX this works... format += 1; // RGB to BGR #endif diff --git a/modules/libpr0n/src/imgContainer.cpp b/modules/libpr0n/src/imgContainer.cpp index 8c8258022df..9f4c1a5e7a1 100644 --- a/modules/libpr0n/src/imgContainer.cpp +++ b/modules/libpr0n/src/imgContainer.cpp @@ -636,7 +636,7 @@ void imgContainer::FillWithColor(gfxIImageFrame *aFrame, gfx_color color) for(PRUint32 y=0; y> 16; *rgbRowIndex++ = (backgroundColor & 0x0000FF00) >> 8; *rgbRowIndex++ = backgroundColor & 0x000000FF;