Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: src/core/SkBlitRow_D16.cpp

Issue 891703005: Improve Color32A_D565 quality at the expense of speed. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBlitRow_D16.cpp
diff --git a/src/core/SkBlitRow_D16.cpp b/src/core/SkBlitRow_D16.cpp
index 6bf4cea9974f5d4488a65bd6aec532ccbe8096e5..544234d064261aa45104ed4d25df475218339c86 100644
--- a/src/core/SkBlitRow_D16.cpp
+++ b/src/core/SkBlitRow_D16.cpp
@@ -204,27 +204,12 @@ static void S32A_D565_Blend_Dither(uint16_t* SK_RESTRICT dst,
///////////////////////////////////////////////////////////////////////////////
-static uint32_t pmcolor_to_expand16(SkPMColor c) {
- unsigned r = SkGetPackedR32(c);
- unsigned g = SkGetPackedG32(c);
- unsigned b = SkGetPackedB32(c);
- return (g << 24) | (r << 13) | (b << 2);
-}
-
static void Color32A_D565(uint16_t dst[], SkPMColor src, int count, int x, int y) {
- SkASSERT(count > 0);
- uint32_t src_expand = pmcolor_to_expand16(src);
- 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);
+ for (int i = 0; i < count; i++) {
+ dst[i] = SkSrcOver32To16(src, dst[i]);
+ }
}
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
static const SkBlitRow::Proc16 gDefault_565_Procs[] = {
// no dither
S32_D565_Opaque,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698