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

Unified Diff: src/opts/SkPMFloat_none.h

Issue 982123002: SKPMFloat: we can beat the naive loops when clamping (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: restore some asserts Created 5 years, 10 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/opts/SkPMFloat_neon.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opts/SkPMFloat_none.h
diff --git a/src/opts/SkPMFloat_none.h b/src/opts/SkPMFloat_none.h
index 011ce07014851101dde45dbb34a1907e8c1796b9..a33fa7a28d91e6d2068ee4ab77c427d90bcafc30 100644
--- a/src/opts/SkPMFloat_none.h
+++ b/src/opts/SkPMFloat_none.h
@@ -24,3 +24,15 @@ inline SkPMColor SkPMFloat::clamped() const {
b = b < 0 ? 0 : (b > 255 ? 255 : b);
return SkPackARGB32(a+0.5f, r+0.5f, g+0.5f, b+0.5f);
}
+
+inline void SkPMFloat::From4PMColors(SkPMFloat floats[4], const SkPMColor colors[4]) {
+ for (int i = 0; i < 4; i++) { floats[i] = FromPMColor(colors[i]); }
+}
+
+inline void SkPMFloat::To4PMColors(SkPMColor colors[4], const SkPMFloat floats[4]) {
+ for (int i = 0; i < 4; i++) { colors[i] = floats[i].get(); }
+}
+
+inline void SkPMFloat::ClampTo4PMColors(SkPMColor colors[4], const SkPMFloat floats[4]) {
+ for (int i = 0; i < 4; i++) { colors[i] = floats[i].clamped(); }
+}
« no previous file with comments | « src/opts/SkPMFloat_neon.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698