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 "sk_paint.h" | 8 #include "sk_paint.h" |
9 #include "sk_types_priv.h" | 9 #include "sk_types_priv.h" |
10 | 10 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 void sk_paint_set_stroke_join(sk_paint_t* cpaint, sk_stroke_join_t cjoin) { | 126 void sk_paint_set_stroke_join(sk_paint_t* cpaint, sk_stroke_join_t cjoin) { |
127 SkPaint::Join skjoin; | 127 SkPaint::Join skjoin; |
128 if (find_sk(cjoin, &skjoin)) { | 128 if (find_sk(cjoin, &skjoin)) { |
129 AsPaint(cpaint)->setStrokeJoin(skjoin); | 129 AsPaint(cpaint)->setStrokeJoin(skjoin); |
130 } else { | 130 } else { |
131 // unknown cjoin | 131 // unknown cjoin |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 | 135 void sk_paint_set_xfermode_mode(sk_paint_t* paint, sk_xfermode_mode_t mode) { |
| 136 SkASSERT(paint); |
| 137 SkXfermode::Mode skmode; |
| 138 switch (mode) { |
| 139 #define MAP(X, Y) case (X): skmode = (Y); break |
| 140 MAP( CLEAR_SK_XFERMODE_MODE, SkXfermode::kClear_Mode ); |
| 141 MAP( SRC_SK_XFERMODE_MODE, SkXfermode::kSrc_Mode ); |
| 142 MAP( DST_SK_XFERMODE_MODE, SkXfermode::kDst_Mode ); |
| 143 MAP( SRCOVER_SK_XFERMODE_MODE, SkXfermode::kSrcOver_Mode ); |
| 144 MAP( DSTOVER_SK_XFERMODE_MODE, SkXfermode::kDstOver_Mode ); |
| 145 MAP( SRCIN_SK_XFERMODE_MODE, SkXfermode::kSrcIn_Mode ); |
| 146 MAP( DSTIN_SK_XFERMODE_MODE, SkXfermode::kDstIn_Mode ); |
| 147 MAP( SRCOUT_SK_XFERMODE_MODE, SkXfermode::kSrcOut_Mode ); |
| 148 MAP( DSTOUT_SK_XFERMODE_MODE, SkXfermode::kDstOut_Mode ); |
| 149 MAP( SRCATOP_SK_XFERMODE_MODE, SkXfermode::kSrcATop_Mode ); |
| 150 MAP( DSTATOP_SK_XFERMODE_MODE, SkXfermode::kDstATop_Mode ); |
| 151 MAP( XOR_SK_XFERMODE_MODE, SkXfermode::kXor_Mode ); |
| 152 MAP( PLUS_SK_XFERMODE_MODE, SkXfermode::kPlus_Mode ); |
| 153 MAP( MODULATE_SK_XFERMODE_MODE, SkXfermode::kModulate_Mode ); |
| 154 MAP( SCREEN_SK_XFERMODE_MODE, SkXfermode::kScreen_Mode ); |
| 155 MAP( OVERLAY_SK_XFERMODE_MODE, SkXfermode::kOverlay_Mode ); |
| 156 MAP( DARKEN_SK_XFERMODE_MODE, SkXfermode::kDarken_Mode ); |
| 157 MAP( LIGHTEN_SK_XFERMODE_MODE, SkXfermode::kLighten_Mode ); |
| 158 MAP( COLORDODGE_SK_XFERMODE_MODE, SkXfermode::kColorDodge_Mode ); |
| 159 MAP( COLORBURN_SK_XFERMODE_MODE, SkXfermode::kColorBurn_Mode ); |
| 160 MAP( HARDLIGHT_SK_XFERMODE_MODE, SkXfermode::kHardLight_Mode ); |
| 161 MAP( SOFTLIGHT_SK_XFERMODE_MODE, SkXfermode::kSoftLight_Mode ); |
| 162 MAP( DIFFERENCE_SK_XFERMODE_MODE, SkXfermode::kDifference_Mode ); |
| 163 MAP( EXCLUSION_SK_XFERMODE_MODE, SkXfermode::kExclusion_Mode ); |
| 164 MAP( MULTIPLY_SK_XFERMODE_MODE, SkXfermode::kMultiply_Mode ); |
| 165 MAP( HUE_SK_XFERMODE_MODE, SkXfermode::kHue_Mode ); |
| 166 MAP( SATURATION_SK_XFERMODE_MODE, SkXfermode::kSaturation_Mode ); |
| 167 MAP( COLOR_SK_XFERMODE_MODE, SkXfermode::kColor_Mode ); |
| 168 MAP( LUMINOSITY_SK_XFERMODE_MODE, SkXfermode::kLuminosity_Mode ); |
| 169 #undef MAP |
| 170 default: |
| 171 return; |
| 172 } |
| 173 AsPaint(paint)->setXfermodeMode(skmode); |
| 174 } |
OLD | NEW |