disable 32A->565 + alpha for now, until it handles src-alpha==0 as a noop

git-svn-id: http://skia.googlecode.com/svn/trunk@525 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2010-03-09 15:21:28 +00:00
parent 1db89dc9a5
commit 8e4c93b04c
3 changed files with 16 additions and 36 deletions

View File

@ -63,27 +63,16 @@ static void S32A_D565_Blend(uint16_t* SK_RESTRICT dst,
SkASSERT(255 > alpha); SkASSERT(255 > alpha);
if (count > 0) { if (count > 0) {
int src_scale = SkAlpha255To256(alpha);
do { do {
SkPMColor sc = *src++; SkPMColor sc = *src++;
SkPMColorAssert(sc); SkPMColorAssert(sc);
if (sc) if (sc) {
{
uint16_t dc = *dst; uint16_t dc = *dst;
unsigned sa = SkGetPackedA32(sc); unsigned dst_scale = 255 - SkMulDiv255Round(SkGetPackedA32(sc), alpha);
unsigned dr, dg, db; unsigned dr = SkMulS16(SkPacked32ToR16(sc), alpha) + SkMulS16(SkGetPackedR16(dc), dst_scale);
unsigned dg = SkMulS16(SkPacked32ToG16(sc), alpha) + SkMulS16(SkGetPackedG16(dc), dst_scale);
if (sa == 255) { unsigned db = SkMulS16(SkPacked32ToB16(sc), alpha) + SkMulS16(SkGetPackedB16(dc), dst_scale);
dr = SkAlphaBlend(SkPacked32ToR16(sc), SkGetPackedR16(dc), src_scale); *dst = SkPackRGB16(SkDiv255Round(dr), SkDiv255Round(dg), SkDiv255Round(db));
dg = SkAlphaBlend(SkPacked32ToG16(sc), SkGetPackedG16(dc), src_scale);
db = SkAlphaBlend(SkPacked32ToB16(sc), SkGetPackedB16(dc), src_scale);
} else {
unsigned dst_scale = 255 - SkAlphaMul(sa, src_scale);
dr = (SkPacked32ToR16(sc) * src_scale + SkGetPackedR16(dc) * dst_scale) >> 8;
dg = (SkPacked32ToG16(sc) * src_scale + SkGetPackedG16(dc) * dst_scale) >> 8;
db = (SkPacked32ToB16(sc) * src_scale + SkGetPackedB16(dc) * dst_scale) >> 8;
}
*dst = SkPackRGB16(dr, dg, db);
} }
dst += 1; dst += 1;
} while (--count != 0); } while (--count != 0);

View File

@ -281,23 +281,13 @@ static void S32A_D565_Blend_neon(uint16_t* SK_RESTRICT dst,
if (count > 0) { if (count > 0) {
do { do {
SkPMColor sc = *src++; SkPMColor sc = *src++;
if (sc) if (sc) {
{
uint16_t dc = *dst; uint16_t dc = *dst;
unsigned sa = SkGetPackedA32(sc); unsigned dst_scale = 255 - SkMulDiv255Round(SkGetPackedA32(sc), alpha);
unsigned dr, dg, db; unsigned dr = SkMulS16(SkPacked32ToR16(sc), alpha) + SkMulS16(SkGetPackedR16(dc), dst_scale);
unsigned dg = SkMulS16(SkPacked32ToG16(sc), alpha) + SkMulS16(SkGetPackedG16(dc), dst_scale);
if (sa == 255) { unsigned db = SkMulS16(SkPacked32ToB16(sc), alpha) + SkMulS16(SkGetPackedB16(dc), dst_scale);
dr = SkAlphaBlend(SkPacked32ToR16(sc), SkGetPackedR16(dc), alpha); *dst = SkPackRGB16(SkDiv255Round(dr), SkDiv255Round(dg), SkDiv255Round(db));
dg = SkAlphaBlend(SkPacked32ToG16(sc), SkGetPackedG16(dc), alpha);
db = SkAlphaBlend(SkPacked32ToB16(sc), SkGetPackedB16(dc), alpha);
} else {
unsigned dst_scale = 255 - SkAlphaMul(sa, alpha);
dr = (SkPacked32ToR16(sc) * alpha + SkGetPackedR16(dc) * dst_scale) >> 8;
dg = (SkPacked32ToG16(sc) * alpha + SkGetPackedG16(dc) * dst_scale) >> 8;
db = (SkPacked32ToB16(sc) * alpha + SkGetPackedB16(dc) * dst_scale) >> 8;
}
*dst = SkPackRGB16(dr, dg, db);
} }
dst += 1; dst += 1;
} while (--count != 0); } while (--count != 0);
@ -988,7 +978,8 @@ static const SkBlitRow::Proc platform_565_procs[] = {
S32_D565_Opaque_PROC, S32_D565_Opaque_PROC,
S32_D565_Blend_PROC, S32_D565_Blend_PROC,
S32A_D565_Opaque_PROC, S32A_D565_Opaque_PROC,
S32A_D565_Blend_PROC, // fails to treat src==0 as a no-op. see BlitRowTest.cpp
NULL, // S32A_D565_Blend_PROC,
// dither // dither
S32_D565_Opaque_Dither_PROC, S32_D565_Opaque_Dither_PROC,

View File

@ -100,7 +100,7 @@ static void TestBlitRow(skiatest::Reporter* reporter) {
static const SkBitmap::Config gDstConfig[] = { static const SkBitmap::Config gDstConfig[] = {
SkBitmap::kARGB_8888_Config, SkBitmap::kARGB_8888_Config,
SkBitmap::kRGB_565_Config, SkBitmap::kRGB_565_Config,
SkBitmap::kARGB_4444_Config, // SkBitmap::kARGB_4444_Config,
// SkBitmap::kA8_Config, // SkBitmap::kA8_Config,
}; };
@ -140,7 +140,7 @@ static void TestBlitRow(skiatest::Reporter* reporter) {
if (gSrcRec[j].fSrc != 0 && blend) { if (gSrcRec[j].fSrc != 0 && blend) {
// can't make a numerical promise about blending anything // can't make a numerical promise about blending anything
// but 0 // but 0
continue; // continue;
} }
paint.setDither(dither); paint.setDither(dither);
paint.setAlpha(blend ? 0x80 : 0xFF); paint.setAlpha(blend ? 0x80 : 0xFF);