| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ui/gfx/transform.h" | 5 #include "ui/gfx/transform.h" |
| 6 #include "ui/gfx/point3.h" | 6 #include "ui/gfx/point3.h" |
| 7 #include "ui/gfx/rect.h" | 7 #include "ui/gfx/rect.h" |
| 8 #include "ui/gfx/skia_util.h" | 8 #include "ui/gfx/skia_util.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 void Transform::ConcatTransform(const Transform& transform) { | 95 void Transform::ConcatTransform(const Transform& transform) { |
| 96 if (!transform.matrix_.isIdentity()) { | 96 if (!transform.matrix_.isIdentity()) { |
| 97 matrix_.postConcat(transform.matrix_); | 97 matrix_.postConcat(transform.matrix_); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool Transform::HasChange() const { | 101 bool Transform::HasChange() const { |
| 102 return !matrix_.isIdentity(); | 102 return !matrix_.isIdentity(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool Transform::Invert() { |
| 106 return matrix_.invert(&matrix_); |
| 107 } |
| 108 |
| 105 void Transform::TransformPoint(gfx::Point& point) const { | 109 void Transform::TransformPoint(gfx::Point& point) const { |
| 106 TransformPointInternal(matrix_, point); | 110 TransformPointInternal(matrix_, point); |
| 107 } | 111 } |
| 108 | 112 |
| 109 void Transform::TransformPoint(gfx::Point3f& point) const { | 113 void Transform::TransformPoint(gfx::Point3f& point) const { |
| 110 TransformPointInternal(matrix_, point); | 114 TransformPointInternal(matrix_, point); |
| 111 } | 115 } |
| 112 | 116 |
| 113 bool Transform::TransformPointReverse(gfx::Point& point) const { | 117 bool Transform::TransformPointReverse(gfx::Point& point) const { |
| 114 // TODO(sad): Try to avoid trying to invert the matrix. | 118 // TODO(sad): Try to avoid trying to invert the matrix. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 0, | 177 0, |
| 174 1 }; | 178 1 }; |
| 175 | 179 |
| 176 xform.map(p); | 180 xform.map(p); |
| 177 | 181 |
| 178 point.SetPoint(SymmetricRound(p[0]), | 182 point.SetPoint(SymmetricRound(p[0]), |
| 179 SymmetricRound(p[1])); | 183 SymmetricRound(p[1])); |
| 180 } | 184 } |
| 181 | 185 |
| 182 } // namespace ui | 186 } // namespace ui |
| OLD | NEW |