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

Side by Side Diff: src/core/SkMipMap.cpp

Issue 2159993003: Improve naive SkColorXform to half floats (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Prettier code Created 4 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/core/SkHalf.h ('k') | src/core/SkNx.h » ('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 2013 Google Inc. 2 * Copyright 2013 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 #include "SkMipMap.h" 8 #include "SkMipMap.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return (uint8_t)x; 81 return (uint8_t)x;
82 } 82 }
83 }; 83 };
84 84
85 struct ColorTypeFilter_F16 { 85 struct ColorTypeFilter_F16 {
86 typedef uint64_t Type; // SkHalf x4 86 typedef uint64_t Type; // SkHalf x4
87 static Sk4f Expand(uint64_t x) { 87 static Sk4f Expand(uint64_t x) {
88 return SkHalfToFloat_finite(x); 88 return SkHalfToFloat_finite(x);
89 } 89 }
90 static uint64_t Compact(const Sk4f& x) { 90 static uint64_t Compact(const Sk4f& x) {
91 return SkFloatToHalf_finite(x); 91 uint64_t r;
92 SkFloatToHalf_finite(x).store(&r);
93 return r;
92 } 94 }
93 }; 95 };
94 96
95 template <typename T> T add_121(const T& a, const T& b, const T& c) { 97 template <typename T> T add_121(const T& a, const T& b, const T& c) {
96 return a + b + b + c; 98 return a + b + b + c;
97 } 99 }
98 100
99 template <typename T> T shift_right(const T& x, int bits) { 101 template <typename T> T shift_right(const T& x, int bits) {
100 return x >> bits; 102 return x >> bits;
101 } 103 }
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 return false; 627 return false;
626 } 628 }
627 if (index > fCount - 1) { 629 if (index > fCount - 1) {
628 return false; 630 return false;
629 } 631 }
630 if (levelPtr) { 632 if (levelPtr) {
631 *levelPtr = fLevels[index]; 633 *levelPtr = fLevels[index];
632 } 634 }
633 return true; 635 return true;
634 } 636 }
OLDNEW
« no previous file with comments | « src/core/SkHalf.h ('k') | src/core/SkNx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698