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 #include "SkPaint.h" | 8 #include "SkPaint.h" |
| 9 #include "SkShader.h" |
9 | 10 |
10 #include "sk_paint.h" | 11 #include "sk_paint.h" |
11 #include "sk_types_priv.h" | 12 #include "sk_types_priv.h" |
12 | 13 |
13 #define MAKE_FROM_TO_NAME(FROM) g_ ## FROM ## _map | 14 #define MAKE_FROM_TO_NAME(FROM) g_ ## FROM ## _map |
14 | 15 |
15 const struct { | 16 const struct { |
16 sk_stroke_cap_t fC; | 17 sk_stroke_cap_t fC; |
17 SkPaint::Cap fSK; | 18 SkPaint::Cap fSK; |
18 } MAKE_FROM_TO_NAME(sk_stroke_cap_t)[] = { | 19 } MAKE_FROM_TO_NAME(sk_stroke_cap_t)[] = { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 57 |
57 sk_color_t sk_paint_get_color(const sk_paint_t* cpaint) { | 58 sk_color_t sk_paint_get_color(const sk_paint_t* cpaint) { |
58 return AsPaint(*cpaint).getColor(); | 59 return AsPaint(*cpaint).getColor(); |
59 } | 60 } |
60 | 61 |
61 void sk_paint_set_color(sk_paint_t* cpaint, sk_color_t c) { | 62 void sk_paint_set_color(sk_paint_t* cpaint, sk_color_t c) { |
62 AsPaint(cpaint)->setColor(c); | 63 AsPaint(cpaint)->setColor(c); |
63 } | 64 } |
64 | 65 |
65 void sk_paint_set_shader(sk_paint_t* cpaint, sk_shader_t* cshader) { | 66 void sk_paint_set_shader(sk_paint_t* cpaint, sk_shader_t* cshader) { |
66 AsPaint(cpaint)->setShader(AsShader(cshader)); | 67 AsPaint(cpaint)->setShader(sk_ref_sp(AsShader(cshader))); |
67 } | 68 } |
68 | 69 |
69 void sk_paint_set_maskfilter(sk_paint_t* cpaint, sk_maskfilter_t* cfilter) { | 70 void sk_paint_set_maskfilter(sk_paint_t* cpaint, sk_maskfilter_t* cfilter) { |
70 AsPaint(cpaint)->setMaskFilter(AsMaskFilter(cfilter)); | 71 AsPaint(cpaint)->setMaskFilter(AsMaskFilter(cfilter)); |
71 } | 72 } |
72 | 73 |
73 bool sk_paint_is_stroke(const sk_paint_t* cpaint) { | 74 bool sk_paint_is_stroke(const sk_paint_t* cpaint) { |
74 return AsPaint(*cpaint).getStyle() != SkPaint::kFill_Style; | 75 return AsPaint(*cpaint).getStyle() != SkPaint::kFill_Style; |
75 } | 76 } |
76 | 77 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 MAP( HUE_SK_XFERMODE_MODE, SkXfermode::kHue_Mode ); | 162 MAP( HUE_SK_XFERMODE_MODE, SkXfermode::kHue_Mode ); |
162 MAP( SATURATION_SK_XFERMODE_MODE, SkXfermode::kSaturation_Mode ); | 163 MAP( SATURATION_SK_XFERMODE_MODE, SkXfermode::kSaturation_Mode ); |
163 MAP( COLOR_SK_XFERMODE_MODE, SkXfermode::kColor_Mode ); | 164 MAP( COLOR_SK_XFERMODE_MODE, SkXfermode::kColor_Mode ); |
164 MAP( LUMINOSITY_SK_XFERMODE_MODE, SkXfermode::kLuminosity_Mode ); | 165 MAP( LUMINOSITY_SK_XFERMODE_MODE, SkXfermode::kLuminosity_Mode ); |
165 #undef MAP | 166 #undef MAP |
166 default: | 167 default: |
167 return; | 168 return; |
168 } | 169 } |
169 AsPaint(paint)->setXfermodeMode(skmode); | 170 AsPaint(paint)->setXfermodeMode(skmode); |
170 } | 171 } |
OLD | NEW |