Code to fastpath Alpha PNGs in LCMS - part of bug 445552. r=vlad

This commit is contained in:
Bobby Holley 2008-08-17 22:08:53 -07:00
Родитель 47b7be01c1
Коммит 237fe615c6
2 изменённых файлов: 14 добавлений и 5 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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) {