Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: src/c/sk_paint.cpp

Issue 1829303002: move setshader to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: addressing comments from #8 Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/animator/SkDrawPaint.cpp ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/animator/SkDrawPaint.cpp ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698