OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 SkAvoidXfermode_DEFINED | 8 #ifndef SkAvoidXfermode_DEFINED |
9 #define SkAvoidXfermode_DEFINED | 9 #define SkAvoidXfermode_DEFINED |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 Avoid: In this mode, drawing is allowed only on destination pixels that | 32 Avoid: In this mode, drawing is allowed only on destination pixels that |
33 are different from the op-color. | 33 are different from the op-color. |
34 Tolerance near 0: avoid any colors even remotely similar to the o
p-color | 34 Tolerance near 0: avoid any colors even remotely similar to the o
p-color |
35 Tolerance near 255: avoid only colors nearly identical to the op-
color | 35 Tolerance near 255: avoid only colors nearly identical to the op-
color |
36 | 36 |
37 Target: In this mode, drawing only occurs on destination pixels that | 37 Target: In this mode, drawing only occurs on destination pixels that |
38 are similar to the op-color | 38 are similar to the op-color |
39 Tolerance near 0: draw only on colors that are nearly identical
to the op-color | 39 Tolerance near 0: draw only on colors that are nearly identical
to the op-color |
40 Tolerance near 255: draw on any colors even remotely similar to
the op-color | 40 Tolerance near 255: draw on any colors even remotely similar to
the op-color |
41 */ | 41 */ |
| 42 static sk_sp<SkXfermode> Make(SkColor opColor, U8CPU tolerance, Mode mode) { |
| 43 return sk_sp<SkXfermode>(new SkAvoidXfermode(opColor, tolerance, mode)); |
| 44 } |
| 45 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR |
42 static SkAvoidXfermode* Create(SkColor opColor, U8CPU tolerance, Mode mode)
{ | 46 static SkAvoidXfermode* Create(SkColor opColor, U8CPU tolerance, Mode mode)
{ |
43 return new SkAvoidXfermode(opColor, tolerance, mode); | 47 return (SkAvoidXfermode*)(Make(opColor, tolerance, mode).release()); |
44 } | 48 } |
| 49 #endif |
45 | 50 |
46 // overrides from SkXfermode | 51 // overrides from SkXfermode |
47 void xfer32(SkPMColor dst[], const SkPMColor src[], int count, | 52 void xfer32(SkPMColor dst[], const SkPMColor src[], int count, |
48 const SkAlpha aa[]) const override; | 53 const SkAlpha aa[]) const override; |
49 void xfer16(uint16_t dst[], const SkPMColor src[], int count, | 54 void xfer16(uint16_t dst[], const SkPMColor src[], int count, |
50 const SkAlpha aa[]) const override; | 55 const SkAlpha aa[]) const override; |
51 void xferA8(SkAlpha dst[], const SkPMColor src[], int count, | 56 void xferA8(SkAlpha dst[], const SkPMColor src[], int count, |
52 const SkAlpha aa[]) const override; | 57 const SkAlpha aa[]) const override; |
53 | 58 |
54 #if SK_SUPPORT_GPU | 59 #if SK_SUPPORT_GPU |
(...skipping 12 matching lines...) Expand all Loading... |
67 private: | 72 private: |
68 SkColor fOpColor; | 73 SkColor fOpColor; |
69 uint32_t fDistMul; // x.14 cached from fTolerance | 74 uint32_t fDistMul; // x.14 cached from fTolerance |
70 uint8_t fTolerance; | 75 uint8_t fTolerance; |
71 Mode fMode; | 76 Mode fMode; |
72 | 77 |
73 typedef SkXfermode INHERITED; | 78 typedef SkXfermode INHERITED; |
74 }; | 79 }; |
75 | 80 |
76 #endif | 81 #endif |
OLD | NEW |