OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 | 87 |
88 float animatedGreen = animatedColor.green(); | 88 float animatedGreen = animatedColor.green(); |
89 m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor .green(), toColor.green(), toAtEndOfDurationColor.green(), animatedGreen); | 89 m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor .green(), toColor.green(), toAtEndOfDurationColor.green(), animatedGreen); |
90 | 90 |
91 float animatedBlue = animatedColor.blue(); | 91 float animatedBlue = animatedColor.blue(); |
92 m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor .blue(), toColor.blue(), toAtEndOfDurationColor.blue(), animatedBlue); | 92 m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor .blue(), toColor.blue(), toAtEndOfDurationColor.blue(), animatedBlue); |
93 | 93 |
94 float animatedAlpha = animatedColor.alpha(); | 94 float animatedAlpha = animatedColor.alpha(); |
95 m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor .alpha(), toColor.alpha(), toAtEndOfDurationColor.alpha(), animatedAlpha); | 95 m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor .alpha(), toColor.alpha(), toAtEndOfDurationColor.alpha(), animatedAlpha); |
96 | 96 |
97 animatedColor = ColorDistance::clampColor(static_cast<int>(roundf(animatedRe d)), static_cast<int>(roundf(animatedGreen)), static_cast<int>(roundf(animatedBl ue)), static_cast<int>(roundf(animatedAlpha))); | 97 animatedColor = makeRGBA(static_cast<int>(roundf(animatedRed)), static_cast< int>(roundf(animatedGreen)), static_cast<int>(roundf(animatedBlue)), static_cast <int>(roundf(animatedAlpha))); |
eseidel
2013/12/31 21:59:59
What about the clamping?
| |
98 } | 98 } |
99 | 99 |
100 float SVGAnimatedColorAnimator::calculateDistance(const String& fromString, cons t String& toString) | 100 float SVGAnimatedColorAnimator::calculateDistance(const String& fromString, cons t String& toString) |
101 { | 101 { |
102 ASSERT(m_contextElement); | 102 ASSERT(m_contextElement); |
103 Color from = SVGColor::colorFromRGBColorString(fromString); | 103 Color from = SVGColor::colorFromRGBColorString(fromString); |
104 if (!from.isValid()) | 104 if (!from.isValid()) |
105 return -1; | 105 return -1; |
106 Color to = SVGColor::colorFromRGBColorString(toString); | 106 Color to = SVGColor::colorFromRGBColorString(toString); |
107 if (!to.isValid()) | 107 if (!to.isValid()) |
108 return -1; | 108 return -1; |
109 return ColorDistance(from, to).distance(); | 109 return ColorDistance::distance(from, to); |
110 } | 110 } |
111 | 111 |
112 } | 112 } |
OLD | NEW |