Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: ui/gfx/transform_util.cc

Issue 11418040: gfx::Transform API clean-up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/transform_unittest.cc ('k') | ui/views/controls/slide_out_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 for (int j = 0; j < 4; j++) 92 for (int j = 0; j < 4; j++)
93 m.setDouble(i, j, m.getDouble(i, j) * scale); 93 m.setDouble(i, j, m.getDouble(i, j) * scale);
94 94
95 return true; 95 return true;
96 } 96 }
97 97
98 } // namespace 98 } // namespace
99 99
100 Transform GetScaleTransform(const Point& anchor, float scale) { 100 Transform GetScaleTransform(const Point& anchor, float scale) {
101 Transform transform; 101 Transform transform;
102 transform.ConcatScale(scale, scale); 102 transform.Translate(anchor.x() * (1 - scale),
103 transform.ConcatTranslate(anchor.x() * (1 - scale), 103 anchor.y() * (1 - scale));
104 anchor.y() * (1 - scale)); 104 transform.Scale(scale, scale);
105 return transform; 105 return transform;
106 } 106 }
107 107
108 DecomposedTransform::DecomposedTransform() { 108 DecomposedTransform::DecomposedTransform() {
109 translate[0] = translate[1] = translate[2] = 0.0; 109 translate[0] = translate[1] = translate[2] = 0.0;
110 scale[0] = scale[1] = scale[2] = 1.0; 110 scale[0] = scale[1] = scale[2] = 1.0;
111 skew[0] = skew[1] = skew[2] = 0.0; 111 skew[0] = skew[1] = skew[2] = 0.0;
112 perspective[0] = perspective[1] = perspective[2] = 0.0; 112 perspective[0] = perspective[1] = perspective[2] = 0.0;
113 quaternion[0] = quaternion[1] = quaternion[2] = 0.0; 113 quaternion[0] = quaternion[1] = quaternion[2] = 0.0;
114 perspective[3] = quaternion[3] = 1.0; 114 perspective[3] = quaternion[3] = 1.0;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 SkDoubleToMScalar(decomp.scale[1]), 309 SkDoubleToMScalar(decomp.scale[1]),
310 SkDoubleToMScalar(decomp.scale[2])); 310 SkDoubleToMScalar(decomp.scale[2]));
311 matrix.preConcat(tempScale); 311 matrix.preConcat(tempScale);
312 312
313 Transform to_return; 313 Transform to_return;
314 to_return.matrix() = matrix; 314 to_return.matrix() = matrix;
315 return to_return; 315 return to_return;
316 } 316 }
317 317
318 } // namespace ui 318 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/transform_unittest.cc ('k') | ui/views/controls/slide_out_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698