OLD | NEW |
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 #ifndef Sk4pxXfermode_DEFINED | 8 #ifndef Sk4pxXfermode_DEFINED |
9 #define Sk4pxXfermode_DEFINED | 9 #define Sk4pxXfermode_DEFINED |
10 | 10 |
11 #include "Sk4px.h" | 11 #include "Sk4px.h" |
12 #include "SkPMFloat.h" | 12 #include "SkPMFloat.h" |
13 #include "SkXfermode_proccoeff.h" | 13 #include "SkXfermode_proccoeff.h" |
14 | 14 |
15 // This file is possibly included into multiple .cpp files. | 15 namespace /* TODO: SK_OPTS_NS */ { |
16 // Each gets its own independent instantiation by wrapping in an anonymous names
pace. | |
17 namespace { | |
18 | 16 |
19 // Most xfermodes can be done most efficiently 4 pixels at a time in 8 or 16-bit
fixed point. | 17 // Most xfermodes can be done most efficiently 4 pixels at a time in 8 or 16-bit
fixed point. |
20 #define XFERMODE(Name) static Sk4px SK_VECTORCALL Name(Sk4px s, Sk4px d) | 18 #define XFERMODE(Name) static Sk4px SK_VECTORCALL Name(Sk4px s, Sk4px d) |
21 | 19 |
22 XFERMODE(Clear) { return Sk4px::DupPMColor(0); } | 20 XFERMODE(Clear) { return Sk4px::DupPMColor(0); } |
23 XFERMODE(Src) { return s; } | 21 XFERMODE(Src) { return s; } |
24 XFERMODE(Dst) { return d; } | 22 XFERMODE(Dst) { return d; } |
25 XFERMODE(SrcIn) { return s.approxMulDiv255(d.alphas() ); } | 23 XFERMODE(SrcIn) { return s.approxMulDiv255(d.alphas() ); } |
26 XFERMODE(SrcOut) { return s.approxMulDiv255(d.alphas().inv()); } | 24 XFERMODE(SrcOut) { return s.approxMulDiv255(d.alphas().inv()); } |
27 XFERMODE(SrcOver) { return s + d.approxMulDiv255(s.alphas().inv()); } | 25 XFERMODE(SrcOver) { return s + d.approxMulDiv255(s.alphas().inv()); } |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 CASE(ColorDodge); | 307 CASE(ColorDodge); |
310 CASE(ColorBurn); | 308 CASE(ColorBurn); |
311 CASE(SoftLight); | 309 CASE(SoftLight); |
312 #undef CASE | 310 #undef CASE |
313 | 311 |
314 default: break; | 312 default: break; |
315 } | 313 } |
316 return nullptr; | 314 return nullptr; |
317 } | 315 } |
318 | 316 |
319 } // namespace | 317 } // namespace SK_NS_OPTS |
320 | 318 |
321 #endif//Sk4pxXfermode_DEFINED | 319 #endif//Sk4pxXfermode_DEFINED |
OLD | NEW |