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

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

Issue 1967283002: All source types working for linear pipeline. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use black const Created 4 years, 7 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/SkLinearBitmapPipeline_sample.h ('k') | no next file » | 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 //////////////////////////////////////////////////////////////////////////////// /////////////////// 55 //////////////////////////////////////////////////////////////////////////////// ///////////////////
56 56
57 static inline Sk4f Sk4f_fromL32(uint32_t src) { 57 static inline Sk4f Sk4f_fromL32(uint32_t src) {
58 return to_4f(src) * Sk4f(1.0f/255); 58 return to_4f(src) * Sk4f(1.0f/255);
59 } 59 }
60 60
61 static inline Sk4f Sk4f_fromS32(uint32_t src) { 61 static inline Sk4f Sk4f_fromS32(uint32_t src) {
62 return srgb_to_linear(to_4f(src) * Sk4f(1.0f/255)); 62 return srgb_to_linear(to_4f(src) * Sk4f(1.0f/255));
63 } 63 }
64 64
65 // Color handling:
66 // SkColor has an ordering of (b, g, r, a) if cast to an Sk4f, so the code swi zzles r and b to
67 // produce the needed (r, g, b, a) ordering.
68 static inline Sk4f Sk4f_from_SkColor(SkColor color) {
69 return swizzle_rb(gTreatSkColorAsSRGB ? Sk4f_fromS32(color) : Sk4f_fromL32(c olor));
70 }
71
65 static inline uint32_t Sk4f_toL32(const Sk4f& x4) { 72 static inline uint32_t Sk4f_toL32(const Sk4f& x4) {
66 return to_4b(x4 * Sk4f(255) + Sk4f(0.5f)); 73 return to_4b(x4 * Sk4f(255) + Sk4f(0.5f));
67 } 74 }
68 75
69 static inline uint32_t Sk4f_toS32(const Sk4f& x4) { 76 static inline uint32_t Sk4f_toS32(const Sk4f& x4) {
70 return to_4b(linear_to_srgb(x4) * Sk4f(255) + Sk4f(0.5f)); 77 return to_4b(linear_to_srgb(x4) * Sk4f(255) + Sk4f(0.5f));
71 } 78 }
72 79
73 #endif 80 #endif
OLDNEW
« no previous file with comments | « src/core/SkLinearBitmapPipeline_sample.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698