OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. |
3 * 2010 Dirk Schulze <krit@webkit.org> | 3 * 2010 Dirk Schulze <krit@webkit.org> |
4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 AffineTransform& AffineTransform::skewX(double angle) | 216 AffineTransform& AffineTransform::skewX(double angle) |
217 { | 217 { |
218 return shear(tan(deg2rad(angle)), 0); | 218 return shear(tan(deg2rad(angle)), 0); |
219 } | 219 } |
220 | 220 |
221 AffineTransform& AffineTransform::skewY(double angle) | 221 AffineTransform& AffineTransform::skewY(double angle) |
222 { | 222 { |
223 return shear(0, tan(deg2rad(angle))); | 223 return shear(0, tan(deg2rad(angle))); |
224 } | 224 } |
225 | 225 |
226 AffineTransform makeMapBetweenRects(const FloatRect& source, const FloatRect& de
st) | |
227 { | |
228 AffineTransform transform; | |
229 transform.translate(dest.x() - source.x(), dest.y() - source.y()); | |
230 transform.scale(dest.width() / source.width(), dest.height() / source.height
()); | |
231 return transform; | |
232 } | |
233 | |
234 void AffineTransform::map(double x, double y, double& x2, double& y2) const | 226 void AffineTransform::map(double x, double y, double& x2, double& y2) const |
235 { | 227 { |
236 x2 = (m_transform[0] * x + m_transform[2] * y + m_transform[4]); | 228 x2 = (m_transform[0] * x + m_transform[2] * y + m_transform[4]); |
237 y2 = (m_transform[1] * x + m_transform[3] * y + m_transform[5]); | 229 y2 = (m_transform[1] * x + m_transform[3] * y + m_transform[5]); |
238 } | 230 } |
239 | 231 |
240 IntPoint AffineTransform::mapPoint(const IntPoint& point) const | 232 IntPoint AffineTransform::mapPoint(const IntPoint& point) const |
241 { | 233 { |
242 double x2, y2; | 234 double x2, y2; |
243 map(point.x(), point.y(), x2, y2); | 235 map(point.x(), point.y(), x2, y2); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 this->setB(decomp.remainderB); | 355 this->setB(decomp.remainderB); |
364 this->setC(decomp.remainderC); | 356 this->setC(decomp.remainderC); |
365 this->setD(decomp.remainderD); | 357 this->setD(decomp.remainderD); |
366 this->setE(decomp.translateX); | 358 this->setE(decomp.translateX); |
367 this->setF(decomp.translateY); | 359 this->setF(decomp.translateY); |
368 this->rotateRadians(decomp.angle); | 360 this->rotateRadians(decomp.angle); |
369 this->scale(decomp.scaleX, decomp.scaleY); | 361 this->scale(decomp.scaleX, decomp.scaleY); |
370 } | 362 } |
371 | 363 |
372 } | 364 } |
OLD | NEW |