diff options
author | mtklein <mtklein@chromium.org> | 2015-03-25 13:43:34 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-25 13:43:34 -0700 |
commit | 15391ee4acaa092f52742f64968ad8046b74ca81 (patch) | |
tree | ace01376be31a5a759439e6cec52a4acc65bf4bd /src/opts/SkPMFloat_neon.h | |
parent | 2af858354d913397a6c316ef46a5d52d686e10ab (diff) |
Update 4-at-a-time APIs.
There is no reason to require the 4 SkPMFloats (registers) to be adjacent.
The only potential win in loads and stores comes from the SkPMColors being adjacent.
Makes no difference to existing bench.
BUG=skia:
Review URL: https://codereview.chromium.org/1035583002
Diffstat (limited to 'src/opts/SkPMFloat_neon.h')
-rw-r--r-- | src/opts/SkPMFloat_neon.h | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/opts/SkPMFloat_neon.h b/src/opts/SkPMFloat_neon.h index 6c9df37e51..780981bd95 100644 --- a/src/opts/SkPMFloat_neon.h +++ b/src/opts/SkPMFloat_neon.h @@ -1,3 +1,10 @@ +/* + * Copyright 2015 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + inline SkPMFloat& SkPMFloat::operator=(const SkPMFloat& that) { fColors = that.fColors; return *this; @@ -41,14 +48,28 @@ inline SkPMColor SkPMFloat::clamped() const { } // TODO: we should be able to beat these loops on all three methods. -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::From4PMColors(const SkPMColor colors[4], + SkPMFloat* a, SkPMFloat* b, SkPMFloat* c, SkPMFloat* d) { + *a = FromPMColor(colors[0]); + *b = FromPMColor(colors[1]); + *c = FromPMColor(colors[2]); + *d = FromPMColor(colors[3]); } -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::To4PMColors( + const SkPMFloat& a, const SkPMFloat& b, const SkPMFloat&c, const SkPMFloat& d, + SkPMColor colors[4]) { + colors[0] = a.get(); + colors[1] = b.get(); + colors[2] = c.get(); + colors[3] = d.get(); } -inline void SkPMFloat::ClampTo4PMColors(SkPMColor colors[4], const SkPMFloat floats[4]) { - for (int i = 0; i < 4; i++) { colors[i] = floats[i].clamped(); } +inline void SkPMFloat::ClampTo4PMColors( + const SkPMFloat& a, const SkPMFloat& b, const SkPMFloat&c, const SkPMFloat& d, + SkPMColor colors[4]) { + colors[0] = a.clamped(); + colors[1] = b.clamped(); + colors[2] = c.clamped(); + colors[3] = d.clamped(); } |