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

Side by Side Diff: src/opts/SkPMFloat_sse.h

Issue 1214443002: Color dodge and burn with SkPMFloat. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: reed Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « src/opts/SkPMFloat_none.h ('k') | src/opts/SkXfermode_opts_SSE2.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 namespace { // See SkPMFloat.h 8 namespace { // See SkPMFloat.h
9 9
10 inline SkPMFloat::SkPMFloat(SkPMColor c) { 10 inline SkPMFloat::SkPMFloat(SkPMColor c) {
(...skipping 15 matching lines...) Expand all
26 // We don't use _mm_cvtps_epi32, because we want precise control over how 0. 5 rounds (up). 26 // We don't use _mm_cvtps_epi32, because we want precise control over how 0. 5 rounds (up).
27 __m128 scaled = _mm_mul_ps(_mm_set1_ps(255), fVec); 27 __m128 scaled = _mm_mul_ps(_mm_set1_ps(255), fVec);
28 __m128i fix8_32 = _mm_cvttps_epi32(_mm_add_ps(_mm_set1_ps(0.5f), scaled)), 28 __m128i fix8_32 = _mm_cvttps_epi32(_mm_add_ps(_mm_set1_ps(0.5f), scaled)),
29 fix8_16 = _mm_packus_epi16(fix8_32, fix8_32), 29 fix8_16 = _mm_packus_epi16(fix8_32, fix8_32),
30 fix8 = _mm_packus_epi16(fix8_16, fix8_16); 30 fix8 = _mm_packus_epi16(fix8_16, fix8_16);
31 SkPMColor c = _mm_cvtsi128_si32(fix8); 31 SkPMColor c = _mm_cvtsi128_si32(fix8);
32 SkPMColorAssert(c); 32 SkPMColorAssert(c);
33 return c; 33 return c;
34 } 34 }
35 35
36 inline Sk4f SkPMFloat::alphas() const {
37 static_assert(SK_A32_SHIFT == 24, "");
38 return _mm_shuffle_ps(fVec, fVec, 0xff); // Read as 11 11 11 11, copying la ne 3 to all lanes.
39 }
40
36 } // namespace 41 } // namespace
OLDNEW
« no previous file with comments | « src/opts/SkPMFloat_none.h ('k') | src/opts/SkXfermode_opts_SSE2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698