OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #ifndef GrStrokeInfo_DEFINED | 8 #ifndef GrStrokeInfo_DEFINED |
9 #define GrStrokeInfo_DEFINED | 9 #define GrStrokeInfo_DEFINED |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 SkStrokeRec* getStrokeRecPtr() { return &fStroke; } | 49 SkStrokeRec* getStrokeRecPtr() { return &fStroke; } |
50 | 50 |
51 void setFillStyle() { fStroke.setFillStyle(); } | 51 void setFillStyle() { fStroke.setFillStyle(); } |
52 | 52 |
53 /* | 53 /* |
54 * This functions takes in a patheffect and fills in fDashInfo with the vari
ous dashing | 54 * This functions takes in a patheffect and fills in fDashInfo with the vari
ous dashing |
55 * information if the path effect is a Dash type. Returns true if the path e
ffect is a | 55 * information if the path effect is a Dash type. Returns true if the path e
ffect is a |
56 * dashed effect and we are stroking, otherwise it retruns false. | 56 * dashed effect and we are stroking, otherwise it retruns false. |
57 */ | 57 */ |
58 bool setDashInfo(const SkPathEffect* pe) { | 58 bool setDashInfo(const SkPathEffect* pe) { |
59 if (NULL != pe && !fStroke.isFillStyle()) { | 59 if (pe && !fStroke.isFillStyle()) { |
60 fDashInfo.fIntervals = NULL; | 60 fDashInfo.fIntervals = NULL; |
61 fDashType = pe->asADash(&fDashInfo); | 61 fDashType = pe->asADash(&fDashInfo); |
62 if (SkPathEffect::kDash_DashType == fDashType) { | 62 if (SkPathEffect::kDash_DashType == fDashType) { |
63 fIntervals.reset(fDashInfo.fCount); | 63 fIntervals.reset(fDashInfo.fCount); |
64 fDashInfo.fIntervals = fIntervals.get(); | 64 fDashInfo.fIntervals = fIntervals.get(); |
65 pe->asADash(&fDashInfo); | 65 pe->asADash(&fDashInfo); |
66 return true; | 66 return true; |
67 } | 67 } |
68 } | 68 } |
69 return false; | 69 return false; |
(...skipping 20 matching lines...) Expand all Loading... |
90 this->setDashInfo(pe); | 90 this->setDashInfo(pe); |
91 } | 91 } |
92 | 92 |
93 SkStrokeRec fStroke; | 93 SkStrokeRec fStroke; |
94 SkPathEffect::DashType fDashType; | 94 SkPathEffect::DashType fDashType; |
95 SkPathEffect::DashInfo fDashInfo; | 95 SkPathEffect::DashInfo fDashInfo; |
96 SkAutoSTArray<2, SkScalar> fIntervals; | 96 SkAutoSTArray<2, SkScalar> fIntervals; |
97 }; | 97 }; |
98 | 98 |
99 #endif | 99 #endif |
OLD | NEW |