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

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: skia: blend32_16_row for neon version 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 | 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..306c95b41389412f67504c94f4a16d5098e45e75 100644
--- a/src/core/SkBlitter_RGB16.cpp
+++ b/src/core/SkBlitter_RGB16.cpp
@@ -77,6 +77,8 @@ protected:
uint16_t fRawDither16; // unscaled
SkBool8 fDoDither;
+ SkBlitRow::ColorProc16 fColorProc16;
+
// illegal
SkRGB16_Blitter& operator=(const SkRGB16_Blitter&);
@@ -544,6 +546,19 @@ 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;
+
+ if (SkGetPackedA32(fSrcColor32) < 0xFF) {
+ flags |= SkBlitRow::kSrcPixelAlpha_Flag;
+ }
+
+ if (fDoDither) {
+ flags |= SkBlitRow::kDither_Flag;
+ }
+
+ fColorProc16 = SkBlitRow::ColorFactory16(flags);
}
const SkBitmap* SkRGB16_Blitter::justAnOpaqueColor(uint32_t* value) {
@@ -554,31 +569,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, fSrcColor32, width, x, y);
}
void SkRGB16_Blitter::blitAntiH(int x, int y,
@@ -681,10 +677,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, fSrcColor32, width, x, y);
device = (uint16_t*)((char*)device + deviceRB);
}
}
« no previous file with comments | « no previous file | src/opts/SkBlitRow_opts_arm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698