OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkXfermode.h" | 10 #include "SkXfermode.h" |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 static inline int min2(int a, int b) { return a < b ? a : b; } | 444 static inline int min2(int a, int b) { return a < b ? a : b; } |
445 static inline int max2(int a, int b) { return a > b ? a : b; } | 445 static inline int max2(int a, int b) { return a > b ? a : b; } |
446 #define minimum(a, b, c) min2(min2(a, b), c) | 446 #define minimum(a, b, c) min2(min2(a, b), c) |
447 #define maximum(a, b, c) max2(max2(a, b), c) | 447 #define maximum(a, b, c) max2(max2(a, b), c) |
448 | 448 |
449 static inline int Sat(int r, int g, int b) { | 449 static inline int Sat(int r, int g, int b) { |
450 return maximum(r, g, b) - minimum(r, g, b); | 450 return maximum(r, g, b) - minimum(r, g, b); |
451 } | 451 } |
452 | 452 |
453 static inline void setSaturationComponents(int* Cmin, int* Cmid, int* Cmax, int
s) { | 453 static inline void setSaturationComponents(int* Cmin, int* Cmid, int* Cmax, int
s) { |
454 if(Cmax > Cmin) { | 454 if(*Cmax > *Cmin) { |
455 *Cmid = (((*Cmid - *Cmin) * s ) / (*Cmax - *Cmin)); | 455 *Cmid = (((*Cmid - *Cmin) * s ) / (*Cmax - *Cmin)); |
456 *Cmax = s; | 456 *Cmax = s; |
457 } else { | 457 } else { |
458 *Cmax = 0; | 458 *Cmax = 0; |
459 *Cmid = 0; | 459 *Cmid = 0; |
460 } | 460 } |
461 | 461 |
462 *Cmin = 0; | 462 *Cmin = 0; |
463 } | 463 } |
464 | 464 |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 return proc16; | 1519 return proc16; |
1520 } | 1520 } |
1521 | 1521 |
1522 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) | 1522 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) |
1523 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) | 1523 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) |
1524 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkClearXfermode) | 1524 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkClearXfermode) |
1525 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode) | 1525 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode) |
1526 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode) | 1526 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode) |
1527 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode) | 1527 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode) |
1528 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1528 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |