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

Unified Diff: src/core/SkPMFloat.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 | « no previous file | src/opts/SkPMFloat_SSE2.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPMFloat.h
diff --git a/src/core/SkPMFloat.h b/src/core/SkPMFloat.h
index 2e06ea93e6e9ed1d968f358e57b3ead37e55e833..4534f1142c307c9d1e5976fd79197f9ac01cf2cd 100644
--- a/src/core/SkPMFloat.h
+++ b/src/core/SkPMFloat.h
@@ -13,10 +13,7 @@ public:
static SkPMFloat FromARGB(float a, float r, float g, float b) { return SkPMFloat(a,r,g,b); }
// May be more efficient than one at a time. No special alignment assumed for SkPMColors.
- static void From4PMColors(SkPMFloat floats[4], const SkPMColor colors[4]) {
- // TODO: specialize
- for (int i = 0; i < 4; i++) { floats[i] = FromPMColor(colors[i]); }
- }
+ static void From4PMColors(SkPMFloat[4], const SkPMColor[4]);
explicit SkPMFloat(SkPMColor);
SkPMFloat(float a, float r, float g, float b) {
@@ -51,14 +48,8 @@ public:
SkPMColor clamped() const; // Will clamp all values to [0, 255]. Then may assert isValid().
// 4-at-a-time versions of get() and clamped(). Like From4PMColors(), no alignment assumed.
- static void To4PMColors(SkPMColor colors[4], const SkPMFloat floats[4]) {
- // TODO: specialize
- for (int i = 0; i < 4; i++) { colors[i] = floats[i].get(); }
- }
- static void ClampTo4PMColors(SkPMColor colors[4], const SkPMFloat floats[4]) {
- // TODO: specialize
- for (int i = 0; i < 4; i++) { colors[i] = floats[i].clamped(); }
- }
+ static void To4PMColors(SkPMColor[4], const SkPMFloat[4]);
+ static void ClampTo4PMColors(SkPMColor[4], const SkPMFloat[4]);
bool isValid() const {
return this->a() >= 0 && this->a() <= 255
« no previous file with comments | « no previous file | src/opts/SkPMFloat_SSE2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698