OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2010, 2011. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010, 2011. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 // Transform the animated point to the coordinate mode, needed for the curre
nt progress. | 107 // Transform the animated point to the coordinate mode, needed for the curre
nt progress. |
108 FloatPoint currentPoint = blendFloatPoint(m_fromCurrentPoint, m_toCurrentPoi
nt, m_progress); | 108 FloatPoint currentPoint = blendFloatPoint(m_fromCurrentPoint, m_toCurrentPoi
nt, m_progress); |
109 if (m_toMode == AbsoluteCoordinates) | 109 if (m_toMode == AbsoluteCoordinates) |
110 return animatedPoint + currentPoint; | 110 return animatedPoint + currentPoint; |
111 | 111 |
112 animatedPoint.move(-currentPoint.x(), -currentPoint.y()); | 112 animatedPoint.move(-currentPoint.x(), -currentPoint.y()); |
113 return animatedPoint; | 113 return animatedPoint; |
114 } | 114 } |
115 | 115 |
116 bool SVGPathBlender::blendMoveToSegment() | 116 void SVGPathBlender::blendMoveToSegment(const PathSegmentData& fromSeg, const Pa
thSegmentData& toSeg) |
117 { | 117 { |
118 FloatPoint fromTargetPoint; | 118 m_consumer->moveTo(blendAnimatedFloatPoint(fromSeg.targetPoint, toSeg.target
Point), m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); |
119 FloatPoint toTargetPoint; | 119 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromSeg.targetPoint
: m_fromCurrentPoint + fromSeg.targetPoint; |
120 if ((m_fromSource->hasMoreData() && !m_fromSource->parseMoveToSegment(fromTa
rgetPoint)) | 120 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toSeg.targetPoint : m_t
oCurrentPoint + toSeg.targetPoint; |
121 || !m_toSource->parseMoveToSegment(toTargetPoint)) | |
122 return false; | |
123 | |
124 m_consumer->moveTo(blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint),
m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); | |
125 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromTargetPoint : m
_fromCurrentPoint + fromTargetPoint; | |
126 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toTargetPoint : m_toCur
rentPoint + toTargetPoint; | |
127 return true; | |
128 } | 121 } |
129 | 122 |
130 bool SVGPathBlender::blendLineToSegment() | 123 void SVGPathBlender::blendLineToSegment(const PathSegmentData& fromSeg, const Pa
thSegmentData& toSeg) |
131 { | 124 { |
132 FloatPoint fromTargetPoint; | 125 m_consumer->lineTo(blendAnimatedFloatPoint(fromSeg.targetPoint, toSeg.target
Point), m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); |
133 FloatPoint toTargetPoint; | 126 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromSeg.targetPoint
: m_fromCurrentPoint + fromSeg.targetPoint; |
134 if ((m_fromSource->hasMoreData() && !m_fromSource->parseLineToSegment(fromTa
rgetPoint)) | 127 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toSeg.targetPoint : m_t
oCurrentPoint + toSeg.targetPoint; |
135 || !m_toSource->parseLineToSegment(toTargetPoint)) | |
136 return false; | |
137 | |
138 m_consumer->lineTo(blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint),
m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); | |
139 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromTargetPoint : m
_fromCurrentPoint + fromTargetPoint; | |
140 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toTargetPoint : m_toCur
rentPoint + toTargetPoint; | |
141 return true; | |
142 } | 128 } |
143 | 129 |
144 bool SVGPathBlender::blendLineToHorizontalSegment() | 130 void SVGPathBlender::blendLineToHorizontalSegment(const PathSegmentData& fromSeg
, const PathSegmentData& toSeg) |
145 { | 131 { |
146 float fromX = 0; | 132 float fromX = fromSeg.targetPoint.x(); |
147 float toX = 0; | 133 float toX = toSeg.targetPoint.x(); |
148 if ((m_fromSource->hasMoreData() && !m_fromSource->parseLineToHorizontalSegm
ent(fromX)) | |
149 || !m_toSource->parseLineToHorizontalSegment(toX)) | |
150 return false; | |
151 | |
152 m_consumer->lineToHorizontal(blendAnimatedDimensonalFloat(fromX, toX, BlendH
orizontal), m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); | 134 m_consumer->lineToHorizontal(blendAnimatedDimensonalFloat(fromX, toX, BlendH
orizontal), m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); |
153 m_fromCurrentPoint.setX(m_fromMode == AbsoluteCoordinates ? fromX : m_fromCu
rrentPoint.x() + fromX); | 135 m_fromCurrentPoint.setX(m_fromMode == AbsoluteCoordinates ? fromX : m_fromCu
rrentPoint.x() + fromX); |
154 m_toCurrentPoint.setX(m_toMode == AbsoluteCoordinates ? toX : m_toCurrentPoi
nt.x() + toX); | 136 m_toCurrentPoint.setX(m_toMode == AbsoluteCoordinates ? toX : m_toCurrentPoi
nt.x() + toX); |
155 return true; | |
156 } | 137 } |
157 | 138 |
158 bool SVGPathBlender::blendLineToVerticalSegment() | 139 void SVGPathBlender::blendLineToVerticalSegment(const PathSegmentData& fromSeg,
const PathSegmentData& toSeg) |
159 { | 140 { |
160 float fromY = 0; | 141 float fromY = fromSeg.targetPoint.y(); |
161 float toY = 0; | 142 float toY = toSeg.targetPoint.y(); |
162 if ((m_fromSource->hasMoreData() && !m_fromSource->parseLineToVerticalSegmen
t(fromY)) | |
163 || !m_toSource->parseLineToVerticalSegment(toY)) | |
164 return false; | |
165 | |
166 m_consumer->lineToVertical(blendAnimatedDimensonalFloat(fromY, toY, BlendVer
tical), m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); | 143 m_consumer->lineToVertical(blendAnimatedDimensonalFloat(fromY, toY, BlendVer
tical), m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); |
167 m_fromCurrentPoint.setY(m_fromMode == AbsoluteCoordinates ? fromY : m_fromCu
rrentPoint.y() + fromY); | 144 m_fromCurrentPoint.setY(m_fromMode == AbsoluteCoordinates ? fromY : m_fromCu
rrentPoint.y() + fromY); |
168 m_toCurrentPoint.setY(m_toMode == AbsoluteCoordinates ? toY : m_toCurrentPoi
nt.y() + toY); | 145 m_toCurrentPoint.setY(m_toMode == AbsoluteCoordinates ? toY : m_toCurrentPoi
nt.y() + toY); |
169 return true; | |
170 } | 146 } |
171 | 147 |
172 bool SVGPathBlender::blendCurveToCubicSegment() | 148 void SVGPathBlender::blendCurveToCubicSegment(const PathSegmentData& fromSeg, co
nst PathSegmentData& toSeg) |
173 { | 149 { |
174 FloatPoint fromTargetPoint; | 150 m_consumer->curveToCubic( |
175 FloatPoint fromPoint1; | 151 blendAnimatedFloatPoint(fromSeg.point1, toSeg.point1), |
176 FloatPoint fromPoint2; | 152 blendAnimatedFloatPoint(fromSeg.point2, toSeg.point2), |
177 FloatPoint toTargetPoint; | 153 blendAnimatedFloatPoint(fromSeg.targetPoint, toSeg.targetPoint), |
178 FloatPoint toPoint1; | 154 m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); |
179 FloatPoint toPoint2; | 155 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromSeg.targetPoint
: m_fromCurrentPoint + fromSeg.targetPoint; |
180 if ((m_fromSource->hasMoreData() && !m_fromSource->parseCurveToCubicSegment(
fromPoint1, fromPoint2, fromTargetPoint)) | 156 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toSeg.targetPoint : m_t
oCurrentPoint + toSeg.targetPoint; |
181 || !m_toSource->parseCurveToCubicSegment(toPoint1, toPoint2, toTargetPoi
nt)) | |
182 return false; | |
183 | |
184 m_consumer->curveToCubic(blendAnimatedFloatPoint(fromPoint1, toPoint1), | |
185 blendAnimatedFloatPoint(fromPoint2, toPoint2), | |
186 blendAnimatedFloatPoint(fromTargetPoint, toTargetPo
int), | |
187 m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode)
; | |
188 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromTargetPoint : m
_fromCurrentPoint + fromTargetPoint; | |
189 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toTargetPoint : m_toCur
rentPoint + toTargetPoint; | |
190 return true; | |
191 } | 157 } |
192 | 158 |
193 bool SVGPathBlender::blendCurveToCubicSmoothSegment() | 159 void SVGPathBlender::blendCurveToCubicSmoothSegment(const PathSegmentData& fromS
eg, const PathSegmentData& toSeg) |
194 { | 160 { |
195 FloatPoint fromTargetPoint; | 161 m_consumer->curveToCubicSmooth( |
196 FloatPoint fromPoint2; | 162 blendAnimatedFloatPoint(fromSeg.point2, toSeg.point2), |
197 FloatPoint toTargetPoint; | 163 blendAnimatedFloatPoint(fromSeg.targetPoint, toSeg.targetPoint), |
198 FloatPoint toPoint2; | 164 m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); |
199 if ((m_fromSource->hasMoreData() && !m_fromSource->parseCurveToCubicSmoothSe
gment(fromPoint2, fromTargetPoint)) | 165 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromSeg.targetPoint
: m_fromCurrentPoint + fromSeg.targetPoint; |
200 || !m_toSource->parseCurveToCubicSmoothSegment(toPoint2, toTargetPoint)) | 166 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toSeg.targetPoint : m_t
oCurrentPoint + toSeg.targetPoint; |
201 return false; | |
202 | |
203 m_consumer->curveToCubicSmooth(blendAnimatedFloatPoint(fromPoint2, toPoint2)
, | |
204 blendAnimatedFloatPoint(fromTargetPoint, toTa
rgetPoint), | |
205 m_isInFirstHalfOfAnimation ? m_fromMode : m_t
oMode); | |
206 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromTargetPoint : m
_fromCurrentPoint + fromTargetPoint; | |
207 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toTargetPoint : m_toCur
rentPoint + toTargetPoint; | |
208 return true; | |
209 } | 167 } |
210 | 168 |
211 bool SVGPathBlender::blendCurveToQuadraticSegment() | 169 void SVGPathBlender::blendCurveToQuadraticSegment(const PathSegmentData& fromSeg
, const PathSegmentData& toSeg) |
212 { | 170 { |
213 FloatPoint fromTargetPoint; | 171 m_consumer->curveToQuadratic( |
214 FloatPoint fromPoint1; | 172 blendAnimatedFloatPoint(fromSeg.point1, toSeg.point1), |
215 FloatPoint toTargetPoint; | 173 blendAnimatedFloatPoint(fromSeg.targetPoint, toSeg.targetPoint), |
216 FloatPoint toPoint1; | 174 m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); |
217 if ((m_fromSource->hasMoreData() && !m_fromSource->parseCurveToQuadraticSegm
ent(fromPoint1, fromTargetPoint)) | 175 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromSeg.targetPoint
: m_fromCurrentPoint + fromSeg.targetPoint; |
218 || !m_toSource->parseCurveToQuadraticSegment(toPoint1, toTargetPoint)) | 176 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toSeg.targetPoint : m_t
oCurrentPoint + toSeg.targetPoint; |
219 return false; | |
220 | |
221 m_consumer->curveToQuadratic(blendAnimatedFloatPoint(fromPoint1, toPoint1), | |
222 blendAnimatedFloatPoint(fromTargetPoint, toTarg
etPoint), | |
223 m_isInFirstHalfOfAnimation ? m_fromMode : m_toM
ode); | |
224 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromTargetPoint : m
_fromCurrentPoint + fromTargetPoint; | |
225 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toTargetPoint : m_toCur
rentPoint + toTargetPoint; | |
226 return true; | |
227 } | 177 } |
228 | 178 |
229 bool SVGPathBlender::blendCurveToQuadraticSmoothSegment() | 179 void SVGPathBlender::blendCurveToQuadraticSmoothSegment(const PathSegmentData& f
romSeg, const PathSegmentData& toSeg) |
230 { | 180 { |
231 FloatPoint fromTargetPoint; | 181 m_consumer->curveToQuadraticSmooth(blendAnimatedFloatPoint(fromSeg.targetPoi
nt, toSeg.targetPoint), m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); |
232 FloatPoint toTargetPoint; | 182 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromSeg.targetPoint
: m_fromCurrentPoint + fromSeg.targetPoint; |
233 if ((m_fromSource->hasMoreData() && !m_fromSource->parseCurveToQuadraticSmoo
thSegment(fromTargetPoint)) | 183 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toSeg.targetPoint : m_t
oCurrentPoint + toSeg.targetPoint; |
234 || !m_toSource->parseCurveToQuadraticSmoothSegment(toTargetPoint)) | |
235 return false; | |
236 | |
237 m_consumer->curveToQuadraticSmooth(blendAnimatedFloatPoint(fromTargetPoint,
toTargetPoint), m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); | |
238 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromTargetPoint : m
_fromCurrentPoint + fromTargetPoint; | |
239 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toTargetPoint : m_toCur
rentPoint + toTargetPoint; | |
240 return true; | |
241 } | 184 } |
242 | 185 |
243 bool SVGPathBlender::blendArcToSegment() | 186 void SVGPathBlender::blendArcToSegment(const PathSegmentData& fromSeg, const Pat
hSegmentData& toSeg) |
244 { | 187 { |
245 float fromRx = 0; | 188 ASSERT(!m_addTypesCount || fromSeg.command == toSeg.command); |
246 float fromRy = 0; | |
247 float fromAngle = 0; | |
248 bool fromLargeArc = false; | |
249 bool fromSweep = false; | |
250 FloatPoint fromTargetPoint; | |
251 float toRx = 0; | |
252 float toRy = 0; | |
253 float toAngle = 0; | |
254 bool toLargeArc = false; | |
255 bool toSweep = false; | |
256 FloatPoint toTargetPoint; | |
257 if ((m_fromSource->hasMoreData() && !m_fromSource->parseArcToSegment(fromRx,
fromRy, fromAngle, fromLargeArc, fromSweep, fromTargetPoint)) | |
258 || !m_toSource->parseArcToSegment(toRx, toRy, toAngle, toLargeArc, toSwe
ep, toTargetPoint)) | |
259 return false; | |
260 | 189 |
261 ASSERT(!m_addTypesCount || m_fromMode == m_toMode); | |
262 | |
263 FloatPoint blendedRadii = blendAnimatedFloatPointSameCoordinates(FloatPoint(
fromRx, fromRy), FloatPoint(toRx, toRy)); | |
264 float blendedAngle = blendAnimatedFloatPointSameCoordinates(FloatPoint(fromA
ngle, 0), FloatPoint(toAngle, 0)).x(); | |
265 bool blendedLargeArc; | 190 bool blendedLargeArc; |
266 bool blendedSweep; | 191 bool blendedSweep; |
267 | 192 |
268 if (m_addTypesCount) { | 193 if (m_addTypesCount) { |
269 blendedLargeArc = fromLargeArc || toLargeArc; | 194 blendedLargeArc = fromSeg.arcLarge || toSeg.arcLarge; |
270 blendedSweep = fromSweep || toSweep; | 195 blendedSweep = fromSeg.arcSweep || toSeg.arcSweep; |
271 } else { | 196 } else { |
272 blendedLargeArc = m_isInFirstHalfOfAnimation ? fromLargeArc : toLargeArc
; | 197 blendedLargeArc = m_isInFirstHalfOfAnimation ? fromSeg.arcLarge : toSeg.
arcLarge; |
273 blendedSweep = m_isInFirstHalfOfAnimation ? fromSweep : toSweep; | 198 blendedSweep = m_isInFirstHalfOfAnimation ? fromSeg.arcSweep : toSeg.arc
Sweep; |
274 } | 199 } |
275 | 200 |
| 201 FloatPoint blendedRadii = blendAnimatedFloatPointSameCoordinates(fromSeg.arc
Radii(), toSeg.arcRadii()); |
| 202 float blendedAngle = blendAnimatedFloatPointSameCoordinates(fromSeg.point2,
toSeg.point2).x(); |
| 203 |
276 m_consumer->arcTo( | 204 m_consumer->arcTo( |
277 blendedRadii.x(), blendedRadii.y(), blendedAngle, blendedLargeArc, blend
edSweep, | 205 blendedRadii.x(), blendedRadii.y(), blendedAngle, blendedLargeArc, blend
edSweep, |
278 blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint), | 206 blendAnimatedFloatPoint(fromSeg.targetPoint, toSeg.targetPoint), |
279 m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); | 207 m_isInFirstHalfOfAnimation ? m_fromMode : m_toMode); |
280 | 208 |
281 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromTargetPoint : m
_fromCurrentPoint + fromTargetPoint; | 209 m_fromCurrentPoint = m_fromMode == AbsoluteCoordinates ? fromSeg.targetPoint
: m_fromCurrentPoint + fromSeg.targetPoint; |
282 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toTargetPoint : m_toCur
rentPoint + toTargetPoint; | 210 m_toCurrentPoint = m_toMode == AbsoluteCoordinates ? toSeg.targetPoint : m_t
oCurrentPoint + toSeg.targetPoint; |
283 return true; | |
284 } | 211 } |
285 | 212 |
286 static inline PathCoordinateMode coordinateModeOfCommand(const SVGPathSegType& t
ype) | 213 static inline PathCoordinateMode coordinateModeOfCommand(const SVGPathSegType& t
ype) |
287 { | 214 { |
288 if (type < PathSegMoveToAbs) | 215 if (type < PathSegMoveToAbs) |
289 return AbsoluteCoordinates; | 216 return AbsoluteCoordinates; |
290 | 217 |
291 // Odd number = relative command | 218 // Odd number = relative command |
292 if (type % 2) | 219 if (type % 2) |
293 return RelativeCoordinates; | 220 return RelativeCoordinates; |
294 | 221 |
295 return AbsoluteCoordinates; | 222 return AbsoluteCoordinates; |
296 } | 223 } |
297 | 224 |
298 static inline bool isSegmentEqual(const SVGPathSegType& fromType, const SVGPathS
egType& toType, const PathCoordinateMode& fromMode, const PathCoordinateMode& to
Mode) | |
299 { | |
300 if (fromType == toType && (fromType == PathSegUnknown || fromType == PathSeg
ClosePath)) | |
301 return true; | |
302 | |
303 unsigned short from = fromType; | |
304 unsigned short to = toType; | |
305 if (fromMode == toMode) | |
306 return from == to; | |
307 if (fromMode == AbsoluteCoordinates) | |
308 return from == to - 1; | |
309 return to == from - 1; | |
310 } | |
311 | |
312 bool SVGPathBlender::addAnimatedPath(unsigned repeatCount) | 225 bool SVGPathBlender::addAnimatedPath(unsigned repeatCount) |
313 { | 226 { |
314 TemporaryChange<unsigned> change(m_addTypesCount, repeatCount); | 227 TemporaryChange<unsigned> change(m_addTypesCount, repeatCount); |
315 return blendAnimatedPath(0); | 228 return blendAnimatedPath(0); |
316 } | 229 } |
317 | 230 |
318 bool SVGPathBlender::blendAnimatedPath(float progress) | 231 bool SVGPathBlender::blendAnimatedPath(float progress) |
319 { | 232 { |
320 m_isInFirstHalfOfAnimation = progress < 0.5f; | 233 m_isInFirstHalfOfAnimation = progress < 0.5f; |
321 m_progress = progress; | 234 m_progress = progress; |
322 | 235 |
323 bool fromSourceHadData = m_fromSource->hasMoreData(); | 236 bool fromSourceHadData = m_fromSource->hasMoreData(); |
324 while (m_toSource->hasMoreData()) { | 237 while (m_toSource->hasMoreData()) { |
325 SVGPathSegType fromCommand; | 238 PathSegmentData toSeg = m_toSource->parseSegment(); |
326 SVGPathSegType toCommand; | 239 if (toSeg.command == PathSegUnknown) |
327 if ((fromSourceHadData && !m_fromSource->parseSVGSegmentType(fromCommand
)) || !m_toSource->parseSVGSegmentType(toCommand)) | |
328 return false; | 240 return false; |
329 | 241 |
330 m_toMode = coordinateModeOfCommand(toCommand); | 242 PathSegmentData fromSeg; |
331 m_fromMode = fromSourceHadData ? coordinateModeOfCommand(fromCommand) :
m_toMode; | 243 fromSeg.command = toSeg.command; |
332 if (m_fromMode != m_toMode && m_addTypesCount) | 244 |
| 245 if (m_fromSource->hasMoreData()) { |
| 246 fromSeg = m_fromSource->parseSegment(); |
| 247 if (fromSeg.command == PathSegUnknown) |
| 248 return false; |
| 249 } |
| 250 |
| 251 if (toAbsolutePathSegType(fromSeg.command) != toAbsolutePathSegType(toSe
g.command)) |
333 return false; | 252 return false; |
334 | 253 |
335 if (fromSourceHadData && !isSegmentEqual(fromCommand, toCommand, m_fromM
ode, m_toMode)) | 254 m_fromMode = coordinateModeOfCommand(fromSeg.command); |
| 255 m_toMode = coordinateModeOfCommand(toSeg.command); |
| 256 |
| 257 if (m_addTypesCount && m_fromMode != m_toMode) |
336 return false; | 258 return false; |
337 | 259 |
338 switch (toCommand) { | 260 switch (toSeg.command) { |
339 case PathSegMoveToRel: | 261 case PathSegMoveToRel: |
340 case PathSegMoveToAbs: | 262 case PathSegMoveToAbs: |
341 if (!blendMoveToSegment()) | 263 blendMoveToSegment(fromSeg, toSeg); |
342 return false; | |
343 break; | 264 break; |
344 case PathSegLineToRel: | 265 case PathSegLineToRel: |
345 case PathSegLineToAbs: | 266 case PathSegLineToAbs: |
346 if (!blendLineToSegment()) | 267 blendLineToSegment(fromSeg, toSeg); |
347 return false; | |
348 break; | 268 break; |
349 case PathSegLineToHorizontalRel: | 269 case PathSegLineToHorizontalRel: |
350 case PathSegLineToHorizontalAbs: | 270 case PathSegLineToHorizontalAbs: |
351 if (!blendLineToHorizontalSegment()) | 271 blendLineToHorizontalSegment(fromSeg, toSeg); |
352 return false; | |
353 break; | 272 break; |
354 case PathSegLineToVerticalRel: | 273 case PathSegLineToVerticalRel: |
355 case PathSegLineToVerticalAbs: | 274 case PathSegLineToVerticalAbs: |
356 if (!blendLineToVerticalSegment()) | 275 blendLineToVerticalSegment(fromSeg, toSeg); |
357 return false; | |
358 break; | 276 break; |
359 case PathSegClosePath: | 277 case PathSegClosePath: |
360 m_consumer->closePath(); | 278 m_consumer->closePath(); |
361 break; | 279 break; |
362 case PathSegCurveToCubicRel: | 280 case PathSegCurveToCubicRel: |
363 case PathSegCurveToCubicAbs: | 281 case PathSegCurveToCubicAbs: |
364 if (!blendCurveToCubicSegment()) | 282 blendCurveToCubicSegment(fromSeg, toSeg); |
365 return false; | |
366 break; | 283 break; |
367 case PathSegCurveToCubicSmoothRel: | 284 case PathSegCurveToCubicSmoothRel: |
368 case PathSegCurveToCubicSmoothAbs: | 285 case PathSegCurveToCubicSmoothAbs: |
369 if (!blendCurveToCubicSmoothSegment()) | 286 blendCurveToCubicSmoothSegment(fromSeg, toSeg); |
370 return false; | |
371 break; | 287 break; |
372 case PathSegCurveToQuadraticRel: | 288 case PathSegCurveToQuadraticRel: |
373 case PathSegCurveToQuadraticAbs: | 289 case PathSegCurveToQuadraticAbs: |
374 if (!blendCurveToQuadraticSegment()) | 290 blendCurveToQuadraticSegment(fromSeg, toSeg); |
375 return false; | |
376 break; | 291 break; |
377 case PathSegCurveToQuadraticSmoothRel: | 292 case PathSegCurveToQuadraticSmoothRel: |
378 case PathSegCurveToQuadraticSmoothAbs: | 293 case PathSegCurveToQuadraticSmoothAbs: |
379 if (!blendCurveToQuadraticSmoothSegment()) | 294 blendCurveToQuadraticSmoothSegment(fromSeg, toSeg); |
380 return false; | |
381 break; | 295 break; |
382 case PathSegArcRel: | 296 case PathSegArcRel: |
383 case PathSegArcAbs: | 297 case PathSegArcAbs: |
384 if (!blendArcToSegment()) | 298 blendArcToSegment(fromSeg, toSeg); |
385 return false; | |
386 break; | 299 break; |
387 case PathSegUnknown: | 300 default: |
388 return false; | 301 ASSERT_NOT_REACHED(); |
389 } | 302 } |
390 | 303 |
391 if (!fromSourceHadData) | 304 if (!fromSourceHadData) |
392 continue; | 305 continue; |
393 if (m_fromSource->hasMoreData() != m_toSource->hasMoreData()) | 306 if (m_fromSource->hasMoreData() != m_toSource->hasMoreData()) |
394 return false; | 307 return false; |
395 if (!m_fromSource->hasMoreData() || !m_toSource->hasMoreData()) | |
396 return true; | |
397 } | 308 } |
398 | |
399 return true; | 309 return true; |
400 } | 310 } |
401 | 311 |
402 } | 312 } |
OLD | NEW |