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

Unified Diff: src/core/SkBlitter_RGB16.cpp

Issue 847363002: skia: blend32_16_row for neon version (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 | « src/core/SkBlitRow_D16.cpp ('k') | src/opts/SkBlitRow_opts_arm.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBlitter_RGB16.cpp
diff --git a/src/core/SkBlitter_RGB16.cpp b/src/core/SkBlitter_RGB16.cpp
index d9193ecf8f1952202b29875426296ce253d14fc0..cff0066ab4a87f3cc0342e7b7cdb299107a28df7 100644
--- a/src/core/SkBlitter_RGB16.cpp
+++ b/src/core/SkBlitter_RGB16.cpp
@@ -70,6 +70,7 @@ public:
protected:
SkPMColor fSrcColor32;
+ SkPMColor fSrcColors32[8];
uint32_t fExpandedRaw16;
unsigned fScale;
uint16_t fColor16; // already scaled by fScale
@@ -77,6 +78,8 @@ protected:
uint16_t fRawDither16; // unscaled
SkBool8 fDoDither;
+ SkBlitRow::ColorProc16 fColorProc16;
+
// illegal
SkRGB16_Blitter& operator=(const SkRGB16_Blitter&);
@@ -527,6 +530,11 @@ SkRGB16_Blitter::SkRGB16_Blitter(const SkBitmap& device, const SkPaint& paint)
SkColor color = paint.getColor();
fSrcColor32 = SkPreMultiplyColor(color);
+
+ for (int count = 0; count < 8; count++) {
djsollen 2015/01/14 14:57:54 We shouldn't need to do this here. You can just d
mlee 2015/01/15 08:12:36 On 2015/01/14 14:57:54, djsollen wrote: Hi, djsol
mlee 2015/01/21 10:17:32 On 2015/01/14 14:57:54, djsollen wrote: Done in pa
+ fSrcColors32[count] = fSrcColor32;
+ }
+
fScale = SkAlpha255To256(SkColorGetA(color));
int r = SkColorGetR(color);
@@ -544,6 +552,14 @@ SkRGB16_Blitter::SkRGB16_Blitter(const SkBitmap& device, const SkPaint& paint)
fColor16 = SkPackRGB16( SkAlphaMul(r, fScale) >> (8 - SK_R16_BITS),
SkAlphaMul(g, fScale) >> (8 - SK_G16_BITS),
SkAlphaMul(b, fScale) >> (8 - SK_B16_BITS));
+
+ // compute SkBlitRow::Procs
+ unsigned flags = 0;
+
+ // TODO: respect fDoDither
+ flags |= SkBlitRow::kSrcPixelAlpha_Flag;
+
+ fColorProc16 = SkBlitRow::PlatformColorFactory565(flags);
}
const SkBitmap* SkRGB16_Blitter::justAnOpaqueColor(uint32_t* value) {
@@ -554,31 +570,12 @@ const SkBitmap* SkRGB16_Blitter::justAnOpaqueColor(uint32_t* value) {
return NULL;
}
-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 inline void blend32_16_row(SkPMColor src, uint16_t dst[], int count) {
- 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);
-}
-
void SkRGB16_Blitter::blitH(int x, int y, int width) {
SkASSERT(width > 0);
SkASSERT(x + width <= fDevice.width());
uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y);
- // TODO: respect fDoDither
- blend32_16_row(fSrcColor32, device, width);
+ fColorProc16(device, fSrcColors32, width, x, y);
}
void SkRGB16_Blitter::blitAntiH(int x, int y,
@@ -681,10 +678,9 @@ void SkRGB16_Blitter::blitRect(int x, int y, int width, int height) {
SkASSERT(x + width <= fDevice.width() && y + height <= fDevice.height());
uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y);
size_t deviceRB = fDevice.rowBytes();
- SkPMColor src32 = fSrcColor32;
while (--height >= 0) {
- blend32_16_row(src32, device, width);
+ fColorProc16(device, fSrcColors32, width, x, y);
device = (uint16_t*)((char*)device + deviceRB);
}
}
« no previous file with comments | « src/core/SkBlitRow_D16.cpp ('k') | src/opts/SkBlitRow_opts_arm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698