diff options
Diffstat (limited to 'Source/WebCore/svg/SVGPathBlender.h')
-rw-r--r-- | Source/WebCore/svg/SVGPathBlender.h | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/Source/WebCore/svg/SVGPathBlender.h b/Source/WebCore/svg/SVGPathBlender.h index eee57bf96..9c0d746ff 100644 --- a/Source/WebCore/svg/SVGPathBlender.h +++ b/Source/WebCore/svg/SVGPathBlender.h @@ -1,5 +1,6 @@ /* * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -17,10 +18,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGPathBlender_h -#define SVGPathBlender_h +#pragma once -#if ENABLE(SVG) #include "SVGPathConsumer.h" namespace WebCore { @@ -35,41 +34,44 @@ class SVGPathSource; class SVGPathBlender { WTF_MAKE_NONCOPYABLE(SVGPathBlender); WTF_MAKE_FAST_ALLOCATED; public: - SVGPathBlender(); - bool addAnimatedPath(SVGPathSource*, SVGPathSource*, SVGPathConsumer*, unsigned repeatCount); - bool blendAnimatedPath(float, SVGPathSource*, SVGPathSource*, SVGPathConsumer*); - void cleanup(); + static bool addAnimatedPath(SVGPathSource& from, SVGPathSource& to, SVGPathConsumer&, unsigned repeatCount); + static bool blendAnimatedPath(SVGPathSource& from, SVGPathSource& to, SVGPathConsumer&, float); + + static bool canBlendPaths(SVGPathSource& from, SVGPathSource& to); private: - bool blendMoveToSegment(); - bool blendLineToSegment(); - bool blendLineToHorizontalSegment(); - bool blendLineToVerticalSegment(); - bool blendCurveToCubicSegment(); - bool blendCurveToCubicSmoothSegment(); - bool blendCurveToQuadraticSegment(); - bool blendCurveToQuadraticSmoothSegment(); - bool blendArcToSegment(); - - float blendAnimatedDimensonalFloat(float, float, FloatBlendMode); - FloatPoint blendAnimatedFloatPoint(const FloatPoint& from, const FloatPoint& to); - - SVGPathSource* m_fromSource; - SVGPathSource* m_toSource; - SVGPathConsumer* m_consumer; + SVGPathBlender(SVGPathSource&, SVGPathSource&, SVGPathConsumer* = nullptr); + + bool canBlendPaths(); + + bool addAnimatedPath(unsigned repeatCount); + bool blendAnimatedPath(float progress); + + bool blendMoveToSegment(float progress); + bool blendLineToSegment(float progress); + bool blendLineToHorizontalSegment(float progress); + bool blendLineToVerticalSegment(float progress); + bool blendCurveToCubicSegment(float progress); + bool blendCurveToCubicSmoothSegment(float progress); + bool blendCurveToQuadraticSegment(float progress); + bool blendCurveToQuadraticSmoothSegment(float progress); + bool blendArcToSegment(float progress); + + float blendAnimatedDimensonalFloat(float from, float to, FloatBlendMode, float progress); + FloatPoint blendAnimatedFloatPoint(const FloatPoint& from, const FloatPoint& to, float progress); + + SVGPathSource& m_fromSource; + SVGPathSource& m_toSource; + SVGPathConsumer* m_consumer; // A null consumer indicates that we're just checking blendability. FloatPoint m_fromCurrentPoint; FloatPoint m_toCurrentPoint; - PathCoordinateMode m_fromMode; - PathCoordinateMode m_toMode; - float m_progress; - unsigned m_addTypesCount; - bool m_isInFirstHalfOfAnimation; + PathCoordinateMode m_fromMode { AbsoluteCoordinates }; + PathCoordinateMode m_toMode { AbsoluteCoordinates }; + unsigned m_addTypesCount { 0 }; + bool m_isInFirstHalfOfAnimation { false }; }; } // namespace WebCore - -#endif // ENABLE(SVG) -#endif // SVGPathBlender_h |