tweaks to 16bit shaders

fix typo-bug in 4444 blend case



git-svn-id: http://skia.googlecode.com/svn/trunk@265 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-07-10 15:58:53 +00:00
parent 32a4249cbd
commit b602b8e533
4 changed files with 5 additions and 11 deletions

View File

@ -69,6 +69,7 @@ protected:
const SkScalar scale = SkIntToScalar(5)/4;
paint.setAntiAlias(false);
paint.setColor(0x8000FF00);
showFour(canvas, SK_Scalar1, paint);
canvas->translate(SkIntToScalar(450), 0);

View File

@ -112,7 +112,7 @@ static void src_over_4444(SkPMColor16 dst[], SkPMColor16 color,
*dst = other + SkAlphaMulQ4(*dst, invScale);
dst++;
}
if (color & 1) {
if (count & 1) {
*dst = color + SkAlphaMulQ4(*dst, invScale);
}
}
@ -134,7 +134,7 @@ static void src_over_4444x(SkPMColor16 dst[], uint32_t color,
tmp = SkExpand_4444(*dst) * invScale;
*dst++ = SkCompact_4444((other + tmp) >> 4);
}
if (color & 1) {
if (count & 1) {
tmp = SkExpand_4444(*dst) * invScale;
*dst = SkCompact_4444((color + tmp) >> 4);
}

View File

@ -351,20 +351,13 @@ static uint32_t pmcolor_to_expand16(SkPMColor c) {
static inline void blend32_16_row(SkPMColor src, uint16_t dst[], int count) {
SkASSERT(count > 0);
#if 0
uint32_t src_expand = pmcolor_to_expand16(src);
unsigned scale = (0xFF - SkGetPackedA32(src)) >> 3;
unsigned scale = SkAlpha255To256(0xFF - SkGetPackedA32(src)) >> 3;
do {
uint32_t dst_expand = SkExpand_rgb_16(*dst) * scale;
*dst = SkCompact_rgb_16((src_expand + dst_expand) >> 5);
dst += 1;
} while (--count != 0);
#else
do {
*dst = SkSrcOver32To16(src, *dst);
dst += 1;
} while (--count != 0);
#endif
}
void SkRGB16_Blitter::blitH(int x, int y, int width) SK_RESTRICT {

View File

@ -128,7 +128,7 @@ public:
: INHERITED(device, paint) {}
virtual void blitMask(const SkMask&, const SkIRect&);
virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]);
private:
typedef SkARGB32_Opaque_Blitter INHERITED;
};