aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts/SkPMFloat_none.h
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-03-25 13:43:34 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-25 13:43:34 -0700
commit15391ee4acaa092f52742f64968ad8046b74ca81 (patch)
treeace01376be31a5a759439e6cec52a4acc65bf4bd /src/opts/SkPMFloat_none.h
parent2af858354d913397a6c316ef46a5d52d686e10ab (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_none.h')
-rw-r--r--src/opts/SkPMFloat_none.h33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/opts/SkPMFloat_none.h b/src/opts/SkPMFloat_none.h
index c47f8a3713..00705aa582 100644
--- a/src/opts/SkPMFloat_none.h
+++ b/src/opts/SkPMFloat_none.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) {
for (int i = 0; i < 4; i++) { fColor[i] = that.fColor[i]; }
return *this;
@@ -28,14 +35,28 @@ inline SkPMColor SkPMFloat::clamped() const {
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::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();
}