| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #include "core/svg/SVGTransform.h" | 21 #include "core/svg/SVGTransform.h" |
| 22 | 22 |
| 23 #include "platform/FloatConversion.h" | |
| 24 #include "platform/geometry/FloatSize.h" | 23 #include "platform/geometry/FloatSize.h" |
| 25 #include "wtf/MathExtras.h" | 24 #include "wtf/MathExtras.h" |
| 26 #include "wtf/text/StringBuilder.h" | 25 #include "wtf/text/StringBuilder.h" |
| 27 | 26 |
| 28 namespace blink { | 27 namespace blink { |
| 29 | 28 |
| 30 SVGTransform::SVGTransform() | 29 SVGTransform::SVGTransform() |
| 31 : m_transformType(kSvgTransformUnknown) | 30 : m_transformType(kSvgTransformUnknown) |
| 32 , m_angle(0) | 31 , m_angle(0) |
| 33 { | 32 { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 arguments[argumentCount++] = m_matrix.a(); | 194 arguments[argumentCount++] = m_matrix.a(); |
| 196 arguments[argumentCount++] = m_matrix.d(); | 195 arguments[argumentCount++] = m_matrix.d(); |
| 197 break; | 196 break; |
| 198 } | 197 } |
| 199 case kSvgTransformRotate: { | 198 case kSvgTransformRotate: { |
| 200 arguments[argumentCount++] = m_angle; | 199 arguments[argumentCount++] = m_angle; |
| 201 | 200 |
| 202 double angleInRad = deg2rad(m_angle); | 201 double angleInRad = deg2rad(m_angle); |
| 203 double cosAngle = cos(angleInRad); | 202 double cosAngle = cos(angleInRad); |
| 204 double sinAngle = sin(angleInRad); | 203 double sinAngle = sin(angleInRad); |
| 205 float cx = narrowPrecisionToFloat(cosAngle != 1 ? (m_matrix.e() * (1 - c
osAngle) - m_matrix.f() * sinAngle) / (1 - cosAngle) / 2 : 0); | 204 float cx = clampTo<float>(cosAngle != 1 ? (m_matrix.e() * (1 - cosAngle)
- m_matrix.f() * sinAngle) / (1 - cosAngle) / 2 : 0); |
| 206 float cy = narrowPrecisionToFloat(cosAngle != 1 ? (m_matrix.e() * sinAng
le / (1 - cosAngle) + m_matrix.f()) / 2 : 0); | 205 float cy = clampTo<float>(cosAngle != 1 ? (m_matrix.e() * sinAngle / (1
- cosAngle) + m_matrix.f()) / 2 : 0); |
| 207 if (cx || cy) { | 206 if (cx || cy) { |
| 208 arguments[argumentCount++] = cx; | 207 arguments[argumentCount++] = cx; |
| 209 arguments[argumentCount++] = cy; | 208 arguments[argumentCount++] = cy; |
| 210 } | 209 } |
| 211 break; | 210 break; |
| 212 } | 211 } |
| 213 case kSvgTransformSkewx: | 212 case kSvgTransformSkewx: |
| 214 arguments[argumentCount++] = m_angle; | 213 arguments[argumentCount++] = m_angle; |
| 215 break; | 214 break; |
| 216 case kSvgTransformSkewy: | 215 case kSvgTransformSkewy: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 245 | 244 |
| 246 float SVGTransform::calculateDistance(SVGPropertyBase*, SVGElement*) | 245 float SVGTransform::calculateDistance(SVGPropertyBase*, SVGElement*) |
| 247 { | 246 { |
| 248 // SVGTransform is not animated by itself. | 247 // SVGTransform is not animated by itself. |
| 249 ASSERT_NOT_REACHED(); | 248 ASSERT_NOT_REACHED(); |
| 250 | 249 |
| 251 return -1; | 250 return -1; |
| 252 } | 251 } |
| 253 | 252 |
| 254 } // namespace blink | 253 } // namespace blink |
| OLD | NEW |