| 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 #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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 void Transform::SetTranslate(float x, float y) { | 70 void Transform::SetTranslate(float x, float y) { |
| 71 matrix_.setTranslate(SkFloatToScalar(x), | 71 matrix_.setTranslate(SkFloatToScalar(x), |
| 72 SkFloatToScalar(y), | 72 SkFloatToScalar(y), |
| 73 matrix_.get(2, 3)); | 73 matrix_.get(2, 3)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void Transform::SetPerspectiveDepth(float depth) { | 76 void Transform::SetPerspectiveDepth(float depth) { |
| 77 SkMatrix44 m; | 77 SkMatrix44 m; |
| 78 m.set(3, 2, -1 / depth); | 78 m.set(3, 2, -1 / depth); |
| 79 matrix_ = m; | 79 matrix_.postConcat(m); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void Transform::ConcatRotate(float degree) { | 82 void Transform::ConcatRotate(float degree) { |
| 83 SkMatrix44 rot; | 83 SkMatrix44 rot; |
| 84 rot.setRotateDegreesAbout(0, 0, 1, SkFloatToScalar(degree)); | 84 rot.setRotateDegreesAbout(0, 0, 1, SkFloatToScalar(degree)); |
| 85 matrix_.postConcat(rot); | 85 matrix_.postConcat(rot); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void Transform::ConcatRotateAbout(const gfx::Point3f& axis, float degree) { | 88 void Transform::ConcatRotateAbout(const gfx::Point3f& axis, float degree) { |
| 89 SkMatrix44 rot; | 89 SkMatrix44 rot; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 0, | 197 0, |
| 198 1 }; | 198 1 }; |
| 199 | 199 |
| 200 xform.map(p); | 200 xform.map(p); |
| 201 | 201 |
| 202 point.SetPoint(SymmetricRound(p[0]), | 202 point.SetPoint(SymmetricRound(p[0]), |
| 203 SymmetricRound(p[1])); | 203 SymmetricRound(p[1])); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace ui | 206 } // namespace ui |
| OLD | NEW |