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

Unified Diff: src/opts/SkPMFloat_SSE2.h

Issue 1032243002: SkPMFloat::trunc() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove isValid assert in _none trunc() 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/core/SkPMFloat.h ('k') | src/opts/SkPMFloat_SSSE3.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opts/SkPMFloat_SSE2.h
diff --git a/src/opts/SkPMFloat_SSE2.h b/src/opts/SkPMFloat_SSE2.h
index 156c0c989755026c0717a37cbcd61fc0e32083d1..fa920d75d6c0dc09e810895811dff7b1647d5117 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.
« no previous file with comments | « src/core/SkPMFloat.h ('k') | src/opts/SkPMFloat_SSSE3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698