| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 float fromValue = blendMode == BlendHorizontal ? m_fromCurrentPoint.x() | 86 float fromValue = blendMode == BlendHorizontal ? m_fromCurrentPoint.x() |
| 87 : m_fromCurrentPoint.y(); | 87 : m_fromCurrentPoint.y(); |
| 88 float toValue = blendMode == BlendHorizontal ? m_toCurrentPoint.x() | 88 float toValue = blendMode == BlendHorizontal ? m_toCurrentPoint.x() |
| 89 : m_toCurrentPoint.y(); | 89 : m_toCurrentPoint.y(); |
| 90 | 90 |
| 91 // Transform toY to the coordinate mode of fromY | 91 // Transform toY to the coordinate mode of fromY |
| 92 float animValue = | 92 float animValue = |
| 93 blend(from, m_fromIsAbsolute ? to + toValue : to - toValue, m_progress); | 93 blend(from, m_fromIsAbsolute ? to + toValue : to - toValue, m_progress); |
| 94 | 94 |
| 95 // If we're in the first half of the animation, we should use the type of the
from segment. | 95 // If we're in the first half of the animation, we should use the type of the |
| 96 // from segment. |
| 96 if (m_isInFirstHalfOfAnimation) | 97 if (m_isInFirstHalfOfAnimation) |
| 97 return animValue; | 98 return animValue; |
| 98 | 99 |
| 99 // Transform the animated point to the coordinate mode, needed for the current
progress. | 100 // Transform the animated point to the coordinate mode, needed for the current |
| 101 // progress. |
| 100 float currentValue = blend(fromValue, toValue, m_progress); | 102 float currentValue = blend(fromValue, toValue, m_progress); |
| 101 return !m_fromIsAbsolute ? animValue + currentValue | 103 return !m_fromIsAbsolute ? animValue + currentValue |
| 102 : animValue - currentValue; | 104 : animValue - currentValue; |
| 103 } | 105 } |
| 104 | 106 |
| 105 FloatPoint SVGPathBlender::BlendState::blendAnimatedFloatPointSameCoordinates( | 107 FloatPoint SVGPathBlender::BlendState::blendAnimatedFloatPointSameCoordinates( |
| 106 const FloatPoint& fromPoint, | 108 const FloatPoint& fromPoint, |
| 107 const FloatPoint& toPoint) { | 109 const FloatPoint& toPoint) { |
| 108 if (m_addTypesCount) { | 110 if (m_addTypesCount) { |
| 109 FloatPoint repeatedToPoint = toPoint; | 111 FloatPoint repeatedToPoint = toPoint; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 121 | 123 |
| 122 // Transform toPoint to the coordinate mode of fromPoint | 124 // Transform toPoint to the coordinate mode of fromPoint |
| 123 FloatPoint animatedPoint = toPoint; | 125 FloatPoint animatedPoint = toPoint; |
| 124 if (m_fromIsAbsolute) | 126 if (m_fromIsAbsolute) |
| 125 animatedPoint += m_toCurrentPoint; | 127 animatedPoint += m_toCurrentPoint; |
| 126 else | 128 else |
| 127 animatedPoint.move(-m_toCurrentPoint.x(), -m_toCurrentPoint.y()); | 129 animatedPoint.move(-m_toCurrentPoint.x(), -m_toCurrentPoint.y()); |
| 128 | 130 |
| 129 animatedPoint = blendFloatPoint(fromPoint, animatedPoint, m_progress); | 131 animatedPoint = blendFloatPoint(fromPoint, animatedPoint, m_progress); |
| 130 | 132 |
| 131 // If we're in the first half of the animation, we should use the type of the
from segment. | 133 // If we're in the first half of the animation, we should use the type of the |
| 134 // from segment. |
| 132 if (m_isInFirstHalfOfAnimation) | 135 if (m_isInFirstHalfOfAnimation) |
| 133 return animatedPoint; | 136 return animatedPoint; |
| 134 | 137 |
| 135 // Transform the animated point to the coordinate mode, needed for the current
progress. | 138 // Transform the animated point to the coordinate mode, needed for the current |
| 139 // progress. |
| 136 FloatPoint currentPoint = | 140 FloatPoint currentPoint = |
| 137 blendFloatPoint(m_fromCurrentPoint, m_toCurrentPoint, m_progress); | 141 blendFloatPoint(m_fromCurrentPoint, m_toCurrentPoint, m_progress); |
| 138 if (!m_fromIsAbsolute) | 142 if (!m_fromIsAbsolute) |
| 139 return animatedPoint + currentPoint; | 143 return animatedPoint + currentPoint; |
| 140 | 144 |
| 141 animatedPoint.move(-currentPoint.x(), -currentPoint.y()); | 145 animatedPoint.move(-currentPoint.x(), -currentPoint.y()); |
| 142 return animatedPoint; | 146 return animatedPoint; |
| 143 } | 147 } |
| 144 | 148 |
| 145 bool SVGPathBlender::BlendState::canBlend(const PathSegmentData& fromSeg, | 149 bool SVGPathBlender::BlendState::canBlend(const PathSegmentData& fromSeg, |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 329 |
| 326 if (fromSourceIsEmpty) | 330 if (fromSourceIsEmpty) |
| 327 continue; | 331 continue; |
| 328 if (m_fromSource->hasMoreData() != m_toSource->hasMoreData()) | 332 if (m_fromSource->hasMoreData() != m_toSource->hasMoreData()) |
| 329 return false; | 333 return false; |
| 330 } | 334 } |
| 331 return true; | 335 return true; |
| 332 } | 336 } |
| 333 | 337 |
| 334 } // namespace blink | 338 } // namespace blink |
| OLD | NEW |