OLD | NEW |
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 SkLinearBitmapPipeline_core_DEFINED | 8 #ifndef SkLinearBitmapPipeline_core_DEFINED |
9 #define SkLinearBitmapPipeline_core_DEFINED | 9 #define SkLinearBitmapPipeline_core_DEFINED |
10 | 10 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 while (count >= 4) { | 179 while (count >= 4) { |
180 stage->pointList4(xs, ys); | 180 stage->pointList4(xs, ys); |
181 xs = xs + fourDx; | 181 xs = xs + fourDx; |
182 count -= 4; | 182 count -= 4; |
183 } | 183 } |
184 if (count > 0) { | 184 if (count > 0) { |
185 stage->pointListFew(count, xs, ys); | 185 stage->pointListFew(count, xs, ys); |
186 } | 186 } |
187 } | 187 } |
| 188 |
| 189 class sRGBFast { |
| 190 public: |
| 191 static Sk4f VECTORCALL sRGBToLinear(Sk4f pixel) { |
| 192 Sk4f l = pixel * pixel; |
| 193 return Sk4f{l[0], l[1], l[2], pixel[3]}; |
| 194 } |
| 195 static Sk4f VECTORCALL LinearTosRGB(Sk4f pixel) { |
| 196 Sk4f s = pixel.sqrt(); |
| 197 return Sk4f{s[0], s[1], s[2], pixel[3]}; |
| 198 } |
| 199 }; |
| 200 |
188 } // namespace | 201 } // namespace |
189 | 202 |
190 #endif // SkLinearBitmapPipeline_core_DEFINED | 203 #endif // SkLinearBitmapPipeline_core_DEFINED |
OLD | NEW |