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

Unified Diff: src/opts/SkPMFloat_SSSE3.h

Issue 1055123002: New names for SkPMFloat methods. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: one more Created 5 years, 9 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_SSE2.h ('k') | src/opts/SkPMFloat_neon.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opts/SkPMFloat_SSSE3.h
diff --git a/src/opts/SkPMFloat_SSSE3.h b/src/opts/SkPMFloat_SSSE3.h
index 2765048ad365355eac61d36a653483540e1cdffd..c1c6d67446e0fb385220c0b53a0e7e1c512ffd67 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.
« no previous file with comments | « src/opts/SkPMFloat_SSE2.h ('k') | src/opts/SkPMFloat_neon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698