aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-04-03 07:05:20 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-03 07:05:20 -0700
commit3d626834b4b5ee2d6dda34da365dfe40520253aa (patch)
treef44f43a60aaf30d725a56434834d372270c3e29d /src/opts
parent2ab9000b3fa1a61ec9213408af9c800f70eb0657 (diff)
New names for SkPMFloat methods.
Diffstat (limited to 'src/opts')
-rw-r--r--src/opts/SkPMFloat_SSE2.h16
-rw-r--r--src/opts/SkPMFloat_SSSE3.h22
-rw-r--r--src/opts/SkPMFloat_neon.h28
-rw-r--r--src/opts/SkPMFloat_none.h24
4 files changed, 45 insertions, 45 deletions
diff --git a/src/opts/SkPMFloat_SSE2.h b/src/opts/SkPMFloat_SSE2.h
index 2803293664..e10328aae3 100644
--- a/src/opts/SkPMFloat_SSE2.h
+++ b/src/opts/SkPMFloat_SSE2.h
@@ -8,7 +8,7 @@
// For SkPMFloat(SkPMColor), we widen our 8 bit components (fix8) to 8-bit components in 16 bits
// (fix8_16), then widen those to 8-bit-in-32-bits (fix8_32), and finally convert those to floats.
-// get() and clamped() do the opposite, working from floats to 8-bit-in-32-bit,
+// round() and roundClamp() do the opposite, working from floats to 8-bit-in-32-bit,
// to 8-bit-in-16-bit, back down to 8-bit components.
// _mm_packus_epi16() gives us clamping for free while narrowing.
@@ -21,11 +21,11 @@ inline SkPMFloat::SkPMFloat(SkPMColor c) {
SkASSERT(this->isValid());
}
-inline SkPMColor SkPMFloat::get() const {
- return this->clamped(); // Haven't beaten this yet.
+inline SkPMColor SkPMFloat::round() const {
+ return this->roundClamp(); // Haven't beaten this yet.
}
-inline SkPMColor SkPMFloat::clamped() const {
+inline SkPMColor SkPMFloat::roundClamp() const {
// We don't use _mm_cvtps_epi32, because we want precise control over how 0.5 rounds (up).
__m128i fix8_32 = _mm_cvttps_epi32(_mm_add_ps(_mm_set1_ps(0.5f), fColors.vec())),
fix8_16 = _mm_packus_epi16(fix8_32, fix8_32),
@@ -36,7 +36,7 @@ inline SkPMColor SkPMFloat::clamped() const {
}
inline SkPMColor SkPMFloat::trunc() const {
- // Basically, same as clamped(), but no rounding.
+ // Basically, same as roundClamp(), but no rounding.
__m128i fix8_32 = _mm_cvttps_epi32(fColors.vec()),
fix8_16 = _mm_packus_epi16(fix8_32, fix8_32),
fix8 = _mm_packus_epi16(fix8_16, fix8_16);
@@ -54,14 +54,14 @@ inline void SkPMFloat::From4PMColors(const SkPMColor colors[4],
*d = FromPMColor(colors[3]);
}
-inline void SkPMFloat::To4PMColors(
+inline void SkPMFloat::RoundTo4PMColors(
const SkPMFloat& a, const SkPMFloat& b, const SkPMFloat&c, const SkPMFloat& d,
SkPMColor colors[4]) {
// Haven't beaten this yet.
- ClampTo4PMColors(a,b,c,d, colors);
+ RoundClampTo4PMColors(a,b,c,d, colors);
}
-inline void SkPMFloat::ClampTo4PMColors(
+inline void SkPMFloat::RoundClampTo4PMColors(
const SkPMFloat& a, const SkPMFloat& b, const SkPMFloat&c, const SkPMFloat& d,
SkPMColor colors[4]) {
// Same as _SSSE3.h's. We use 3 _mm_packus_epi16() where the naive loop uses 8.
diff --git a/src/opts/SkPMFloat_SSSE3.h b/src/opts/SkPMFloat_SSSE3.h
index 2765048ad3..c1c6d67446 100644
--- a/src/opts/SkPMFloat_SSSE3.h
+++ b/src/opts/SkPMFloat_SSSE3.h
@@ -8,9 +8,9 @@
// For SkPMFloat(SkPMColor), we widen our 8 bit components (fix8) to 8-bit components in 32 bits
// (fix8_32), then convert those to floats.
-// get() does the opposite, working from floats to 8-bit-in-32-bits, then back to packed 8 bit.
+// round() does the opposite, working from floats to 8-bit-in-32-bits, then back to packed 8 bit.
-// clamped() is the same as _SSE2: floats to 8-in-32, to 8-in-16, to packed 8 bit, with
+// roundClamp() is the same as _SSE2: floats to 8-in-32, to 8-in-16, to packed 8 bit, with
// _mm_packus_epi16() both clamping and narrowing.
inline SkPMFloat::SkPMFloat(SkPMColor c) {
@@ -31,11 +31,11 @@ inline SkPMColor SkPMFloat::trunc() const {
return c;
}
-inline SkPMColor SkPMFloat::get() const {
+inline SkPMColor SkPMFloat::round() const {
return SkPMFloat(Sk4f(0.5f) + *this).trunc();
}
-inline SkPMColor SkPMFloat::clamped() const {
+inline SkPMColor SkPMFloat::roundClamp() const {
// We don't use _mm_cvtps_epi32, because we want precise control over how 0.5 rounds (up).
__m128i fix8_32 = _mm_cvttps_epi32(_mm_add_ps(_mm_set1_ps(0.5f), fColors.vec())),
fix8_16 = _mm_packus_epi16(fix8_32, fix8_32),
@@ -54,17 +54,17 @@ inline void SkPMFloat::From4PMColors(const SkPMColor colors[4],
*d = FromPMColor(colors[3]);
}
-inline void SkPMFloat::To4PMColors(
+inline void SkPMFloat::RoundTo4PMColors(
const SkPMFloat& a, const SkPMFloat& b, const SkPMFloat&c, const SkPMFloat& d,
SkPMColor colors[4]) {
- // Haven't beaten this yet. Still faster than ClampTo4PMColors?
- colors[0] = a.get();
- colors[1] = b.get();
- colors[2] = c.get();
- colors[3] = d.get();
+ // Haven't beaten this yet. Still faster than RoundClampTo4PMColors?
+ colors[0] = a.round();
+ colors[1] = b.round();
+ colors[2] = c.round();
+ colors[3] = d.round();
}
-inline void SkPMFloat::ClampTo4PMColors(
+inline void SkPMFloat::RoundClampTo4PMColors(
const SkPMFloat& a, const SkPMFloat& b, const SkPMFloat&c, const SkPMFloat& d,
SkPMColor colors[4]) {
// Same as _SSE2.h's. We use 3 _mm_packus_epi16() where the naive loop uses 8.
diff --git a/src/opts/SkPMFloat_neon.h b/src/opts/SkPMFloat_neon.h
index 4d46c975ec..baad190e56 100644
--- a/src/opts/SkPMFloat_neon.h
+++ b/src/opts/SkPMFloat_neon.h
@@ -8,9 +8,9 @@
// For SkPMFloat(SkPMFColor), we widen our 8 bit components (fix8) to 8-bit components in 16 bits
// (fix8_16), then widen those to 8-bit-in-32-bits (fix8_32), and finally convert those to floats.
-// get() and clamped() do the opposite, working from floats to 8-bit-in-32-bit,
+// round() and roundClamp() do the opposite, working from floats to 8-bit-in-32-bit,
// to 8-bit-in-16-bit, back down to 8-bit components.
-// clamped() uses vqmovn to clamp while narrowing instead of just narrowing with vmovn.
+// roundClamp() uses vqmovn to clamp while narrowing instead of just narrowing with vmovn.
inline SkPMFloat::SkPMFloat(SkPMColor c) {
SkPMColorAssert(c);
@@ -30,11 +30,11 @@ inline SkPMColor SkPMFloat::trunc() const {
return c;
}
-inline SkPMColor SkPMFloat::get() const {
+inline SkPMColor SkPMFloat::round() const {
return SkPMFloat(Sk4f(0.5f) + *this).trunc();
}
-inline SkPMColor SkPMFloat::clamped() const {
+inline SkPMColor SkPMFloat::roundClamp() const {
float32x4_t add_half = vaddq_f32(fColors.vec(), vdupq_n_f32(0.5f));
uint32x4_t fix8_32 = vcvtq_u32_f32(add_half); // vcvtq_u32_f32 truncates, so round manually
uint16x4_t fix8_16 = vqmovn_u32(fix8_32);
@@ -53,20 +53,20 @@ inline void SkPMFloat::From4PMColors(const SkPMColor colors[4],
*d = FromPMColor(colors[3]);
}
-inline void SkPMFloat::To4PMColors(
+inline void SkPMFloat::RoundTo4PMColors(
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();
+ colors[0] = a.round();
+ colors[1] = b.round();
+ colors[2] = c.round();
+ colors[3] = d.round();
}
-inline void SkPMFloat::ClampTo4PMColors(
+inline void SkPMFloat::RoundClampTo4PMColors(
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();
+ colors[0] = a.roundClamp();
+ colors[1] = b.roundClamp();
+ colors[2] = c.roundClamp();
+ colors[3] = d.roundClamp();
}
diff --git a/src/opts/SkPMFloat_none.h b/src/opts/SkPMFloat_none.h
index 7f03f2f53a..50f242749a 100644
--- a/src/opts/SkPMFloat_none.h
+++ b/src/opts/SkPMFloat_none.h
@@ -17,13 +17,13 @@ inline SkPMColor SkPMFloat::trunc() const {
return SkPackARGB32(this->a(), this->r(), this->g(), this->b());
}
-inline SkPMColor SkPMFloat::get() const {
+inline SkPMColor SkPMFloat::round() const {
SkPMColor c = SkPackARGB32(this->a()+0.5f, this->r()+0.5f, this->g()+0.5f, this->b()+0.5f);
SkPMColorAssert(c);
return c;
}
-inline SkPMColor SkPMFloat::clamped() const {
+inline SkPMColor SkPMFloat::roundClamp() const {
float a = this->a(),
r = this->r(),
g = this->g(),
@@ -45,20 +45,20 @@ inline void SkPMFloat::From4PMColors(const SkPMColor colors[4],
*d = FromPMColor(colors[3]);
}
-inline void SkPMFloat::To4PMColors(
+inline void SkPMFloat::RoundTo4PMColors(
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();
+ colors[0] = a.round();
+ colors[1] = b.round();
+ colors[2] = c.round();
+ colors[3] = d.round();
}
-inline void SkPMFloat::ClampTo4PMColors(
+inline void SkPMFloat::RoundClampTo4PMColors(
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();
+ colors[0] = a.roundClamp();
+ colors[1] = b.roundClamp();
+ colors[2] = c.roundClamp();
+ colors[3] = d.roundClamp();
}