| 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_util.h" | 5 #include "ui/gfx/transform_util.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "ui/gfx/point.h" | 9 #include "ui/gfx/point.h" |
| 10 | 10 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 for (int j = 0; j < 4; j++) | 104 for (int j = 0; j < 4; j++) |
| 105 MSET(m, i, j, MGET(m, i, j) * scale); | 105 MSET(m, i, j, MGET(m, i, j) * scale); |
| 106 | 106 |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace | 110 } // namespace |
| 111 | 111 |
| 112 Transform GetScaleTransform(const Point& anchor, float scale) { | 112 Transform GetScaleTransform(const Point& anchor, float scale) { |
| 113 Transform transform; | 113 Transform transform; |
| 114 transform.ConcatScale(scale, scale); | 114 transform.Translate(anchor.x() * (1 - scale), |
| 115 transform.ConcatTranslate(anchor.x() * (1 - scale), | 115 anchor.y() * (1 - scale)); |
| 116 anchor.y() * (1 - scale)); | 116 transform.Scale(scale, scale); |
| 117 return transform; | 117 return transform; |
| 118 } | 118 } |
| 119 | 119 |
| 120 DecomposedTransform::DecomposedTransform() { | 120 DecomposedTransform::DecomposedTransform() { |
| 121 translate[0] = translate[1] = translate[2] = 0.0; | 121 translate[0] = translate[1] = translate[2] = 0.0; |
| 122 scale[0] = scale[1] = scale[2] = 1.0; | 122 scale[0] = scale[1] = scale[2] = 1.0; |
| 123 skew[0] = skew[1] = skew[2] = 0.0; | 123 skew[0] = skew[1] = skew[2] = 0.0; |
| 124 perspective[0] = perspective[1] = perspective[2] = 0.0; | 124 perspective[0] = perspective[1] = perspective[2] = 0.0; |
| 125 quaternion[0] = quaternion[1] = quaternion[2] = 0.0; | 125 quaternion[0] = quaternion[1] = quaternion[2] = 0.0; |
| 126 perspective[3] = quaternion[3] = 1.0; | 126 perspective[3] = quaternion[3] = 1.0; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 SkDoubleToMScalar(decomp.scale[1]), | 324 SkDoubleToMScalar(decomp.scale[1]), |
| 325 SkDoubleToMScalar(decomp.scale[2])); | 325 SkDoubleToMScalar(decomp.scale[2])); |
| 326 matrix.preConcat(tempScale); | 326 matrix.preConcat(tempScale); |
| 327 | 327 |
| 328 Transform to_return; | 328 Transform to_return; |
| 329 to_return.matrix() = matrix; | 329 to_return.matrix() = matrix; |
| 330 return to_return; | 330 return to_return; |
| 331 } | 331 } |
| 332 | 332 |
| 333 } // namespace ui | 333 } // namespace ui |
| OLD | NEW |