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