diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-07-10 15:58:53 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-07-10 15:58:53 +0000 |
commit | b602b8e5334edc0bfcdf086c2ea58e2b5d5f1f3b (patch) | |
tree | b3d71dc22a3354a7f634c6b028c7ca313300ae7f | |
parent | 32a4249cbd3ebcb448fb0824afe875cdf9036686 (diff) |
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
-rw-r--r-- | samplecode/SampleFillType.cpp | 1 | ||||
-rw-r--r-- | src/core/SkBlitter_4444.cpp | 4 | ||||
-rw-r--r-- | src/core/SkBlitter_RGB16.cpp | 9 | ||||
-rw-r--r-- | src/core/SkCoreBlitters.h | 2 |
4 files changed, 5 insertions, 11 deletions
diff --git a/samplecode/SampleFillType.cpp b/samplecode/SampleFillType.cpp index bb268cdc65..dd4ea1a82e 100644 --- a/samplecode/SampleFillType.cpp +++ b/samplecode/SampleFillType.cpp @@ -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); diff --git a/src/core/SkBlitter_4444.cpp b/src/core/SkBlitter_4444.cpp index cce94c5156..736f8c3c2d 100644 --- a/src/core/SkBlitter_4444.cpp +++ b/src/core/SkBlitter_4444.cpp @@ -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); } diff --git a/src/core/SkBlitter_RGB16.cpp b/src/core/SkBlitter_RGB16.cpp index 3b8075fad3..3111655feb 100644 --- a/src/core/SkBlitter_RGB16.cpp +++ b/src/core/SkBlitter_RGB16.cpp @@ -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 { diff --git a/src/core/SkCoreBlitters.h b/src/core/SkCoreBlitters.h index 7da7cad967..5e34685a08 100644 --- a/src/core/SkCoreBlitters.h +++ b/src/core/SkCoreBlitters.h @@ -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; }; |