diff options
Diffstat (limited to 'src/opts/SkPMFloat_SSE2.h')
-rw-r--r-- | src/opts/SkPMFloat_SSE2.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/opts/SkPMFloat_SSE2.h b/src/opts/SkPMFloat_SSE2.h index 156c0c9897..fa920d75d6 100644 --- a/src/opts/SkPMFloat_SSE2.h +++ b/src/opts/SkPMFloat_SSE2.h @@ -41,6 +41,16 @@ inline SkPMColor SkPMFloat::clamped() const { return c; } +inline SkPMColor SkPMFloat::trunc() const { + // Basically, same as clamped(), but no rounding. + __m128i fix8_32 = _mm_cvttps_epi32(fColors), + fix8_16 = _mm_packus_epi16(fix8_32, fix8_32), + fix8 = _mm_packus_epi16(fix8_16, fix8_16); + SkPMColor c = _mm_cvtsi128_si32(fix8); + SkPMColorAssert(c); + return c; +} + inline void SkPMFloat::From4PMColors(const SkPMColor colors[4], SkPMFloat* a, SkPMFloat* b, SkPMFloat* c, SkPMFloat* d) { // Haven't beaten this yet. |