aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts/Sk4px_none.h
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-07-22 10:52:53 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-22 10:52:53 -0700
commitced1585149d4ac8a68efd80e11dbc23bca6620d4 (patch)
treeca42ea0d7f2d818dbf15a0cb83a9a934a032664d /src/opts/Sk4px_none.h
parent651c920d2f8671756968366c7ed9b455fc1a096c (diff)
565 support for SIMD xfermodes
This uses the most basic approach possible: - to load an Sk4px from 565, convert to SkPMColors on the stack serially then load those SkPMColors. - to store an Sk4px to 565, store to SkPMColors on the stack then convert to 565 serially. Clearly, we can optimize these loads and stores. That's a TODO. The code using SkPMFloat is the same idea but a little more long-term viable, as we're only operating on one pixel at a time anyway. We could probably write 565 <-> SkPMFloat methods, but I'd rather not until it's really compelling. The speedups are varied but similar across SSE and NEON: a few uninteresting, many 50% faster, some 2x faster, and SoftLight ~4x faster. This will cause minor GM diffs, but I don't think any layout test changes. BUG=skia: Committed: https://skia.googlesource.com/skia/+/942930dcaa51f66d82cdaf46ae62efebd16c8cd0 Committed: https://skia.googlesource.com/skia/+/860dcaa2ddfdadc050af4f943a84a9d499315066 Review URL: https://codereview.chromium.org/1245673002
Diffstat (limited to 'src/opts/Sk4px_none.h')
-rw-r--r--src/opts/Sk4px_none.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/opts/Sk4px_none.h b/src/opts/Sk4px_none.h
index ba13e58fb5..540edb821d 100644
--- a/src/opts/Sk4px_none.h
+++ b/src/opts/Sk4px_none.h
@@ -100,4 +100,35 @@ inline Sk4px Sk4px::zeroColors() const {
0,0,0, this->kth<15>());
}
+inline Sk4px Sk4px::Load4(const SkPMColor16 src[4]) {
+ SkPMColor src32[4];
+ for (int i = 0; i < 4; i++) { src32[i] = SkPixel16ToPixel32(src[i]); }
+ return Load4(src32);
+}
+inline Sk4px Sk4px::Load2(const SkPMColor16 src[2]) {
+ SkPMColor src32[2];
+ for (int i = 0; i < 2; i++) { src32[i] = SkPixel16ToPixel32(src[i]); }
+ return Load2(src32);
+}
+inline Sk4px Sk4px::Load1(const SkPMColor16 src[1]) {
+ SkPMColor src32 = SkPixel16ToPixel32(src[0]);
+ return Load1(&src32);
+}
+
+inline void Sk4px::store4(SkPMColor16 dst[4]) const {
+ SkPMColor dst32[4];
+ this->store4(dst32);
+ for (int i = 0; i < 4; i++) { dst[i] = SkPixel32ToPixel16(dst32[i]); }
+}
+inline void Sk4px::store2(SkPMColor16 dst[2]) const {
+ SkPMColor dst32[2];
+ this->store2(dst32);
+ for (int i = 0; i < 2; i++) { dst[i] = SkPixel32ToPixel16(dst32[i]); }
+}
+inline void Sk4px::store1(SkPMColor16 dst[1]) const {
+ SkPMColor dst32;
+ this->store1(&dst32);
+ dst[0] = SkPixel32ToPixel16(dst32);
+}
+
} // namespace