| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
| 6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
| 7 | 7 |
| 8 #include "ui/gfx/transform.h" | 8 #include "ui/gfx/transform.h" |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 void Transform::FlattenTo2d() { | 387 void Transform::FlattenTo2d() { |
| 388 matrix_.set(2, 0, 0.0); | 388 matrix_.set(2, 0, 0.0); |
| 389 matrix_.set(2, 1, 0.0); | 389 matrix_.set(2, 1, 0.0); |
| 390 matrix_.set(0, 2, 0.0); | 390 matrix_.set(0, 2, 0.0); |
| 391 matrix_.set(1, 2, 0.0); | 391 matrix_.set(1, 2, 0.0); |
| 392 matrix_.set(2, 2, 1.0); | 392 matrix_.set(2, 2, 1.0); |
| 393 matrix_.set(3, 2, 0.0); | 393 matrix_.set(3, 2, 0.0); |
| 394 matrix_.set(2, 3, 0.0); | 394 matrix_.set(2, 3, 0.0); |
| 395 } | 395 } |
| 396 | 396 |
| 397 bool Transform::IsFlat() const { |
| 398 return matrix_.get(2, 0) == 0.0 && matrix_.get(2, 1) == 0.0 && |
| 399 matrix_.get(0, 2) == 0.0 && matrix_.get(1, 2) == 0.0 && |
| 400 matrix_.get(2, 2) == 1.0 && matrix_.get(3, 2) == 0.0 && |
| 401 matrix_.get(2, 3) == 0.0; |
| 402 } |
| 403 |
| 397 Vector2dF Transform::To2dTranslation() const { | 404 Vector2dF Transform::To2dTranslation() const { |
| 398 return gfx::Vector2dF(SkMScalarToFloat(matrix_.get(0, 3)), | 405 return gfx::Vector2dF(SkMScalarToFloat(matrix_.get(0, 3)), |
| 399 SkMScalarToFloat(matrix_.get(1, 3))); | 406 SkMScalarToFloat(matrix_.get(1, 3))); |
| 400 } | 407 } |
| 401 | 408 |
| 402 void Transform::TransformPoint(Point* point) const { | 409 void Transform::TransformPoint(Point* point) const { |
| 403 DCHECK(point); | 410 DCHECK(point); |
| 404 TransformPointInternal(matrix_, point); | 411 TransformPointInternal(matrix_, point); |
| 405 } | 412 } |
| 406 | 413 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 matrix_.get(2, 1), | 561 matrix_.get(2, 1), |
| 555 matrix_.get(2, 2), | 562 matrix_.get(2, 2), |
| 556 matrix_.get(2, 3), | 563 matrix_.get(2, 3), |
| 557 matrix_.get(3, 0), | 564 matrix_.get(3, 0), |
| 558 matrix_.get(3, 1), | 565 matrix_.get(3, 1), |
| 559 matrix_.get(3, 2), | 566 matrix_.get(3, 2), |
| 560 matrix_.get(3, 3)); | 567 matrix_.get(3, 3)); |
| 561 } | 568 } |
| 562 | 569 |
| 563 } // namespace gfx | 570 } // namespace gfx |
| OLD | NEW |