diff --git a/modules/lcms/src/cmsxform.c b/modules/lcms/src/cmsxform.c index cc951a77d92f..43b42c00bdbd 100644 --- a/modules/lcms/src/cmsxform.c +++ b/modules/lcms/src/cmsxform.c @@ -615,8 +615,13 @@ void MatrixShaperXFORMFloat(_LPcmsTRANSFORM p, register LPBYTE In, Out; register unsigned int i; LPMATSHAPER MatShaper; + unsigned Increment; + // We support a very limited number of configurations for the floatpath + CMSASSERT(p->InputFormat == p->OutputFormat); + CMSASSERT((p->InputFormat == TYPE_RGB_8) || (p->InputFormat == TYPE_RGBA_8)); + Increment = (p->InputFormat == TYPE_RGB_8) ? 3 : 4; In = (LPBYTE) in; Out = (LPBYTE) out; MatShaper = p -> SmeltMatShaper; @@ -758,8 +763,8 @@ void MatrixShaperXFORMFloat(_LPcmsTRANSFORM p, Out[2] = RGB_16_TO_8((WORD)tmp[2]); } - In += 3; - Out += 3; + In += Increment; + Out += Increment; } } #endif diff --git a/modules/libpr0n/decoders/png/nsPNGDecoder.cpp b/modules/libpr0n/decoders/png/nsPNGDecoder.cpp index d3b13b27b885..28e3e5fa0dfb 100644 --- a/modules/libpr0n/decoders/png/nsPNGDecoder.cpp +++ b/modules/libpr0n/decoders/png/nsPNGDecoder.cpp @@ -542,20 +542,24 @@ info_callback(png_structp png_ptr, png_infop info_ptr) } if (decoder->mInProfile && gfxPlatform::GetCMSOutputProfile()) { PRUint32 outType; + PRUint32 dwFlags = 0; if (color_type & PNG_COLOR_MASK_ALPHA || num_trans) outType = TYPE_RGBA_8; else outType = TYPE_RGB_8; + /* Determine if we can use the optimized floating point path. */ + if ((inType == outType) && + ((inType == TYPE_RGB_8) || (inType == TYPE_RGBA_8))) + dwFlags |= cmsFLAGS_FLOATSHAPER; + decoder->mTransform = cmsCreateTransform(decoder->mInProfile, inType, gfxPlatform::GetCMSOutputProfile(), outType, intent, - ((inType == TYPE_RGB_8) && - (outType == TYPE_RGB_8)) - ? cmsFLAGS_FLOATSHAPER : 0); + dwFlags); } else { png_set_gray_to_rgb(png_ptr); if (gfxPlatform::GetCMSMode() == eCMSMode_All) {