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

Side by Side Diff: src/core/SkPM4fPriv.h

Issue 2347473007: Revert of Support Float32 output from SkColorSpaceXform (Closed)
Patch Set: Created 4 years, 3 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/SkNx.h ('k') | src/gpu/GrDrawContext.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 2016 Google Inc. 2 * Copyright 2016 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 #ifndef SkPM4fPriv_DEFINED 8 #ifndef SkPM4fPriv_DEFINED
9 #define SkPM4fPriv_DEFINED 9 #define SkPM4fPriv_DEFINED
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 50
51 // SkColor handling: 51 // SkColor handling:
52 // SkColor has an ordering of (b, g, r, a) if cast to an Sk4f, so the code swi zzles r and b to 52 // SkColor has an ordering of (b, g, r, a) if cast to an Sk4f, so the code swi zzles r and b to
53 // produce the needed (r, g, b, a) ordering. 53 // produce the needed (r, g, b, a) ordering.
54 static inline Sk4f Sk4f_from_SkColor(SkColor color) { 54 static inline Sk4f Sk4f_from_SkColor(SkColor color) {
55 return swizzle_rb(Sk4f_fromS32(color)); 55 return swizzle_rb(Sk4f_fromS32(color));
56 } 56 }
57 57
58 static inline void assert_unit(float x) {
59 SkASSERT(0 <= x && x <= 1);
60 }
61
62 static inline float exact_srgb_to_linear(float srgb) {
63 assert_unit(srgb);
64 float linear;
65 if (srgb <= 0.04045) {
66 linear = srgb / 12.92f;
67 } else {
68 linear = powf((srgb + 0.055f) / 1.055f, 2.4f);
69 }
70 assert_unit(linear);
71 return linear;
72 }
73
58 #endif 74 #endif
OLDNEW
« no previous file with comments | « src/core/SkNx.h ('k') | src/gpu/GrDrawContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698