| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
| 15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
| 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 #ifndef SVGPathBlender_h | 20 #ifndef SVGPathBlender_h |
| 21 #define SVGPathBlender_h | 21 #define SVGPathBlender_h |
| 22 | 22 |
| 23 #include "platform/geometry/FloatPoint.h" | |
| 24 #include "platform/heap/Handle.h" | 23 #include "platform/heap/Handle.h" |
| 25 #include "wtf/Noncopyable.h" | 24 #include "wtf/Noncopyable.h" |
| 26 | 25 |
| 27 namespace blink { | 26 namespace blink { |
| 28 | 27 |
| 29 enum FloatBlendMode { | |
| 30 BlendHorizontal, | |
| 31 BlendVertical | |
| 32 }; | |
| 33 | |
| 34 struct PathSegmentData; | 28 struct PathSegmentData; |
| 35 class SVGPathConsumer; | 29 class SVGPathConsumer; |
| 36 class SVGPathSource; | 30 class SVGPathSource; |
| 37 | 31 |
| 38 class SVGPathBlender : public NoBaseWillBeGarbageCollectedFinalized<SVGPathBlend
er> { | 32 class SVGPathBlender : public NoBaseWillBeGarbageCollectedFinalized<SVGPathBlend
er> { |
| 39 WTF_MAKE_NONCOPYABLE(SVGPathBlender); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVE
D(SVGPathBlender); | 33 WTF_MAKE_NONCOPYABLE(SVGPathBlender); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVE
D(SVGPathBlender); |
| 40 public: | 34 public: |
| 41 SVGPathBlender(SVGPathSource* fromSource, SVGPathSource* toSource, SVGPathCo
nsumer*); | 35 SVGPathBlender(SVGPathSource* fromSource, SVGPathSource* toSource, SVGPathCo
nsumer*); |
| 42 | 36 |
| 43 bool addAnimatedPath(unsigned repeatCount); | 37 bool addAnimatedPath(unsigned repeatCount); |
| 44 bool blendAnimatedPath(float); | 38 bool blendAnimatedPath(float); |
| 45 | 39 |
| 46 DECLARE_TRACE(); | 40 DECLARE_TRACE(); |
| 47 | 41 |
| 48 private: | 42 private: |
| 49 PathSegmentData blendMoveToSegment(const PathSegmentData& fromSeg, const Pat
hSegmentData& toSeg); | 43 class BlendState; |
| 50 PathSegmentData blendLineToSegment(const PathSegmentData& fromSeg, const Pat
hSegmentData& toSeg); | 44 bool blendAnimatedPath(BlendState&); |
| 51 PathSegmentData blendLineToHorizontalSegment(const PathSegmentData& fromSeg,
const PathSegmentData& toSeg); | |
| 52 PathSegmentData blendLineToVerticalSegment(const PathSegmentData& fromSeg, c
onst PathSegmentData& toSeg); | |
| 53 PathSegmentData blendCurveToCubicSegment(const PathSegmentData& fromSeg, con
st PathSegmentData& toSeg); | |
| 54 PathSegmentData blendCurveToCubicSmoothSegment(const PathSegmentData& fromSe
g, const PathSegmentData& toSeg); | |
| 55 PathSegmentData blendCurveToQuadraticSegment(const PathSegmentData& fromSeg,
const PathSegmentData& toSeg); | |
| 56 PathSegmentData blendCurveToQuadraticSmoothSegment(const PathSegmentData& fr
omSeg, const PathSegmentData& toSeg); | |
| 57 PathSegmentData blendArcToSegment(const PathSegmentData& fromSeg, const Path
SegmentData& toSeg); | |
| 58 void blendSegments(const PathSegmentData& fromSeg, const PathSegmentData& to
Seg); | |
| 59 | |
| 60 float blendAnimatedDimensonalFloat(float, float, FloatBlendMode); | |
| 61 FloatPoint blendAnimatedFloatPoint(const FloatPoint& from, const FloatPoint&
to); | |
| 62 FloatPoint blendAnimatedFloatPointSameCoordinates(const FloatPoint& from, co
nst FloatPoint& to); | |
| 63 | 45 |
| 64 RawPtrWillBeMember<SVGPathSource> m_fromSource; | 46 RawPtrWillBeMember<SVGPathSource> m_fromSource; |
| 65 RawPtrWillBeMember<SVGPathSource> m_toSource; | 47 RawPtrWillBeMember<SVGPathSource> m_toSource; |
| 66 RawPtrWillBeMember<SVGPathConsumer> m_consumer; | 48 RawPtrWillBeMember<SVGPathConsumer> m_consumer; |
| 67 | |
| 68 FloatPoint m_fromCurrentPoint; | |
| 69 FloatPoint m_toCurrentPoint; | |
| 70 | |
| 71 float m_progress; | |
| 72 unsigned m_addTypesCount; | |
| 73 bool m_isInFirstHalfOfAnimation; | |
| 74 // This is per-segment blend state corresponding to the 'from' and 'to' | |
| 75 // segments currently being blended, and only used within blendSegments(). | |
| 76 bool m_typesAreEqual; | |
| 77 bool m_fromIsAbsolute; | |
| 78 bool m_toIsAbsolute; | |
| 79 }; | 49 }; |
| 80 | 50 |
| 81 } // namespace blink | 51 } // namespace blink |
| 82 | 52 |
| 83 #endif // SVGPathBlender_h | 53 #endif // SVGPathBlender_h |
| OLD | NEW |