Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkPathEffect_DEFINED | 10 #ifndef SkPathEffect_DEFINED |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * Does applying this path effect to 'src' yield a set of points? If so, | 100 * Does applying this path effect to 'src' yield a set of points? If so, |
| 101 * optionally return the points in 'results'. | 101 * optionally return the points in 'results'. |
| 102 */ | 102 */ |
| 103 virtual bool asPoints(PointData* results, const SkPath& src, | 103 virtual bool asPoints(PointData* results, const SkPath& src, |
| 104 const SkStrokeRec&, const SkMatrix&, | 104 const SkStrokeRec&, const SkMatrix&, |
| 105 const SkRect* cullR) const; | 105 const SkRect* cullR) const; |
| 106 | 106 |
| 107 /** | |
| 108 * If the PathEffect can be represented as a dash pattern, asADash will ret urn kDash_DashType | |
| 109 * and None otherwise. If a non NULL info is passed in, the various DashInf o will be filled | |
| 110 * in if the PathEffect can be a dash pattern. If passed in info has an fCo unt equal or | |
| 111 * greater to that of the effect, it will memcpy the values of the dash int ervals into the | |
| 112 * info. Thus the general approach will be call asADash once with default i nfo to get DashType | |
| 113 * and fCount. If effect can be represented as a dash pattern, allocate spa ce for the intervals | |
| 114 * in info, then call asADash again with the same info and the intervals wi ll get copied in. | |
| 115 */ | |
| 116 | |
| 117 enum DashType { | |
| 118 kNone_DashType, //!< ignores the info parameter | |
| 119 kDash_DashType, //!< fills in all of the info parameter | |
| 120 }; | |
| 121 | |
| 122 struct DashInfo { | |
| 123 DashInfo() : fIntervals(0), fCount(0), fPhase(0.0) {} | |
|
reed1
2014/04/22 13:49:01
fPhase(0) is fine.
Sometimes saying 0.0 will make
| |
| 124 | |
| 125 SkScalar* fIntervals; //!< Length of on/off intervals for dash ed lines | |
| 126 // Even values represent ons, and odds offs | |
| 127 int32_t fCount; //!< Number of intervals in the dash. Sh ould be even number | |
| 128 SkScalar fPhase; //!< Offset into the dashed interval pat tern | |
| 129 // mod the sum of all intervals | |
| 130 }; | |
| 131 | |
| 132 virtual DashType asADash(DashInfo* info) const; | |
| 133 | |
| 107 SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect) | 134 SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect) |
| 108 | 135 |
| 109 protected: | 136 protected: |
| 110 SkPathEffect() {} | 137 SkPathEffect() {} |
| 111 SkPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {} | 138 SkPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {} |
| 112 | 139 |
| 113 private: | 140 private: |
| 114 // illegal | 141 // illegal |
| 115 SkPathEffect(const SkPathEffect&); | 142 SkPathEffect(const SkPathEffect&); |
| 116 SkPathEffect& operator=(const SkPathEffect&); | 143 SkPathEffect& operator=(const SkPathEffect&); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 | 237 |
| 211 private: | 238 private: |
| 212 // illegal | 239 // illegal |
| 213 SkSumPathEffect(const SkSumPathEffect&); | 240 SkSumPathEffect(const SkSumPathEffect&); |
| 214 SkSumPathEffect& operator=(const SkSumPathEffect&); | 241 SkSumPathEffect& operator=(const SkSumPathEffect&); |
| 215 | 242 |
| 216 typedef SkPairPathEffect INHERITED; | 243 typedef SkPairPathEffect INHERITED; |
| 217 }; | 244 }; |
| 218 | 245 |
| 219 #endif | 246 #endif |
| OLD | NEW |