Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 m_transform[5] = f; | 61 m_transform[5] = f; |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool AffineTransform::isIdentity() const | 64 bool AffineTransform::isIdentity() const |
| 65 { | 65 { |
| 66 return (m_transform[0] == 1 && m_transform[1] == 0 | 66 return (m_transform[0] == 1 && m_transform[1] == 0 |
| 67 && m_transform[2] == 0 && m_transform[3] == 1 | 67 && m_transform[2] == 0 && m_transform[3] == 1 |
| 68 && m_transform[4] == 0 && m_transform[5] == 0); | 68 && m_transform[4] == 0 && m_transform[5] == 0); |
| 69 } | 69 } |
| 70 | 70 |
| 71 double AffineTransform::xScaleSquared() const | |
| 72 { | |
| 73 return m_transform[0] * m_transform[0] + m_transform[1] * m_transform[1]; | |
|
pdr.
2016/06/15 12:15:17
A little out of scope for this patch, just noting
fs
2016/06/15 22:10:33
It's more like "x/y basis magnitude" than "x/y sca
| |
| 74 } | |
| 75 | |
| 71 double AffineTransform::xScale() const | 76 double AffineTransform::xScale() const |
| 72 { | 77 { |
| 73 return sqrt(m_transform[0] * m_transform[0] + m_transform[1] * m_transform[1 ]); | 78 return sqrt(xScaleSquared()); |
| 79 } | |
| 80 | |
| 81 double AffineTransform::yScaleSquared() const | |
| 82 { | |
| 83 return m_transform[2] * m_transform[2] + m_transform[3] * m_transform[3]; | |
| 74 } | 84 } |
| 75 | 85 |
| 76 double AffineTransform::yScale() const | 86 double AffineTransform::yScale() const |
| 77 { | 87 { |
| 78 return sqrt(m_transform[2] * m_transform[2] + m_transform[3] * m_transform[3 ]); | 88 return sqrt(yScaleSquared()); |
| 79 } | 89 } |
| 80 | 90 |
| 81 double AffineTransform::det() const | 91 double AffineTransform::det() const |
| 82 { | 92 { |
| 83 return m_transform[0] * m_transform[3] - m_transform[1] * m_transform[2]; | 93 return m_transform[0] * m_transform[3] - m_transform[1] * m_transform[2]; |
| 84 } | 94 } |
| 85 | 95 |
| 86 bool AffineTransform::isInvertible() const | 96 bool AffineTransform::isInvertible() const |
| 87 { | 97 { |
| 88 return det() != 0.0; | 98 return det() != 0.0; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 this->setB(decomp.remainderB); | 394 this->setB(decomp.remainderB); |
| 385 this->setC(decomp.remainderC); | 395 this->setC(decomp.remainderC); |
| 386 this->setD(decomp.remainderD); | 396 this->setD(decomp.remainderD); |
| 387 this->setE(decomp.translateX); | 397 this->setE(decomp.translateX); |
| 388 this->setF(decomp.translateY); | 398 this->setF(decomp.translateY); |
| 389 this->rotateRadians(decomp.angle); | 399 this->rotateRadians(decomp.angle); |
| 390 this->scale(decomp.scaleX, decomp.scaleY); | 400 this->scale(decomp.scaleX, decomp.scaleY); |
| 391 } | 401 } |
| 392 | 402 |
| 393 } // namespace blink | 403 } // namespace blink |
| OLD | NEW |