Bug 53597 - gamma correction was missing RGB jpeg images on unix.
r=biesi, sr=brendan git-svn-id: svn://10.0.0.236/trunk@118996 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -330,14 +330,12 @@ NS_IMETHODIMP nsJPEGDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PR
|
||||
JPOOL_IMAGE,
|
||||
row_stride, 1);
|
||||
|
||||
#if defined(XP_PC) || defined(XP_BEOS) || defined(XP_MAC) || defined(XP_MACOSX) || defined(MOZ_WIDGET_PHOTON)
|
||||
// allocate buffer to do byte flipping if needed
|
||||
// allocate buffer to do byte flipping (if needed) and gamma correction
|
||||
if (mInfo.output_components == 3) {
|
||||
mRGBPadRow = (PRUint8*) PR_MALLOC(row_stride);
|
||||
mRGBPadRowLength = row_stride;
|
||||
memset(mRGBPadRow, 0, mRGBPadRowLength);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Allocate RGB buffer for conversion from greyscale. */
|
||||
if (mInfo.output_components != 3) {
|
||||
@@ -515,36 +513,27 @@ nsJPEGDecoder::OutputScanlines(int num_scanlines)
|
||||
samples = mSamples3[0];
|
||||
} else {
|
||||
/* 24-bit color image */
|
||||
#if defined(XP_PC) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)
|
||||
memset(mRGBPadRow, 0, mInfo.output_width * 4);
|
||||
PRUint8 *ptrOutputBuf = mRGBPadRow;
|
||||
|
||||
JSAMPLE *j1 = mSamples[0];
|
||||
for (PRUint32 i=0;i<mInfo.output_width;++i) {
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
*ptrOutputBuf++ = 0;
|
||||
#endif
|
||||
#if defined(XP_PC) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)
|
||||
ptrOutputBuf[2] = NS_GAMMA_CORRECT_COMPONENT(*j1++);
|
||||
ptrOutputBuf[1] = NS_GAMMA_CORRECT_COMPONENT(*j1++);
|
||||
ptrOutputBuf[0] = NS_GAMMA_CORRECT_COMPONENT(*j1++);
|
||||
#else
|
||||
ptrOutputBuf[0] = NS_GAMMA_CORRECT_COMPONENT(*j1++);
|
||||
ptrOutputBuf[1] = NS_GAMMA_CORRECT_COMPONENT(*j1++);
|
||||
ptrOutputBuf[2] = NS_GAMMA_CORRECT_COMPONENT(*j1++);
|
||||
#endif
|
||||
ptrOutputBuf += 3;
|
||||
}
|
||||
|
||||
samples = mRGBPadRow;
|
||||
#elif defined(XP_MAC) || defined(XP_MACOSX)
|
||||
memset(mRGBPadRow, 0, mInfo.output_width * 4);
|
||||
PRUint8 *ptrOutputBuf = mRGBPadRow;
|
||||
|
||||
JSAMPLE *j1 = mSamples[0];
|
||||
for (PRUint32 i=0;i<mInfo.output_width;++i) {
|
||||
ptrOutputBuf[0] = 0;
|
||||
ptrOutputBuf[1] = NS_GAMMA_CORRECT_COMPONENT(*j1++);
|
||||
ptrOutputBuf[2] = NS_GAMMA_CORRECT_COMPONENT(*j1++);
|
||||
ptrOutputBuf[3] = NS_GAMMA_CORRECT_COMPONENT(*j1++);
|
||||
ptrOutputBuf += 4;
|
||||
}
|
||||
|
||||
samples = mRGBPadRow;
|
||||
#else
|
||||
samples = mSamples[0];
|
||||
#endif
|
||||
}
|
||||
|
||||
PRUint32 bpr;
|
||||
|
||||
Reference in New Issue
Block a user