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 #include "SkCornerPathEffect.h" | 10 #include "SkCornerPathEffect.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 case SkPath::kQuad_Verb: | 87 case SkPath::kQuad_Verb: |
88 // TBD - just replicate the curve for now | 88 // TBD - just replicate the curve for now |
89 if (!prevIsValid) { | 89 if (!prevIsValid) { |
90 dst->moveTo(pts[0]); | 90 dst->moveTo(pts[0]); |
91 prevIsValid = true; | 91 prevIsValid = true; |
92 } | 92 } |
93 dst->quadTo(pts[1], pts[2]); | 93 dst->quadTo(pts[1], pts[2]); |
94 lastCorner = pts[2]; | 94 lastCorner = pts[2]; |
95 firstStep.set(0, 0); | 95 firstStep.set(0, 0); |
96 break; | 96 break; |
| 97 case SkPath::kConic_Verb: |
| 98 // TBD - just replicate the curve for now |
| 99 if (!prevIsValid) { |
| 100 dst->moveTo(pts[0]); |
| 101 prevIsValid = true; |
| 102 } |
| 103 dst->conicTo(pts[1], pts[2], iter.conicWeight()); |
| 104 lastCorner = pts[2]; |
| 105 firstStep.set(0, 0); |
| 106 break; |
97 case SkPath::kCubic_Verb: | 107 case SkPath::kCubic_Verb: |
98 if (!prevIsValid) { | 108 if (!prevIsValid) { |
99 dst->moveTo(pts[0]); | 109 dst->moveTo(pts[0]); |
100 prevIsValid = true; | 110 prevIsValid = true; |
101 } | 111 } |
102 // TBD - just replicate the curve for now | 112 // TBD - just replicate the curve for now |
103 dst->cubicTo(pts[1], pts[2], pts[3]); | 113 dst->cubicTo(pts[1], pts[2], pts[3]); |
104 lastCorner = pts[3]; | 114 lastCorner = pts[3]; |
105 firstStep.set(0, 0); | 115 firstStep.set(0, 0); |
106 break; | 116 break; |
107 case SkPath::kClose_Verb: | 117 case SkPath::kClose_Verb: |
108 if (firstStep.fX || firstStep.fY) { | 118 if (firstStep.fX || firstStep.fY) { |
109 dst->quadTo(lastCorner.fX, lastCorner.fY, | 119 dst->quadTo(lastCorner.fX, lastCorner.fY, |
110 lastCorner.fX + firstStep.fX, | 120 lastCorner.fX + firstStep.fX, |
111 lastCorner.fY + firstStep.fY); | 121 lastCorner.fY + firstStep.fY); |
112 } | 122 } |
113 dst->close(); | 123 dst->close(); |
114 break; | 124 prevIsValid = false; |
115 case SkPath::kConic_Verb: | |
116 SkASSERT(0); | |
117 break; | 125 break; |
118 case SkPath::kDone_Verb: | 126 case SkPath::kDone_Verb: |
| 127 if (prevIsValid) { |
| 128 dst->lineTo(lastCorner); |
| 129 } |
119 goto DONE; | 130 goto DONE; |
120 } | 131 } |
121 | 132 |
122 if (SkPath::kMove_Verb == prevVerb) { | 133 if (SkPath::kMove_Verb == prevVerb) { |
123 firstStep = step; | 134 firstStep = step; |
124 } | 135 } |
125 prevVerb = verb; | 136 prevVerb = verb; |
126 } | 137 } |
127 DONE: | 138 DONE: |
128 return true; | 139 return true; |
129 } | 140 } |
130 | 141 |
131 SkFlattenable* SkCornerPathEffect::CreateProc(SkReadBuffer& buffer) { | 142 SkFlattenable* SkCornerPathEffect::CreateProc(SkReadBuffer& buffer) { |
132 return SkCornerPathEffect::Create(buffer.readScalar()); | 143 return SkCornerPathEffect::Create(buffer.readScalar()); |
133 } | 144 } |
134 | 145 |
135 void SkCornerPathEffect::flatten(SkWriteBuffer& buffer) const { | 146 void SkCornerPathEffect::flatten(SkWriteBuffer& buffer) const { |
136 buffer.writeScalar(fRadius); | 147 buffer.writeScalar(fRadius); |
137 } | 148 } |
OLD | NEW |