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

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

Issue 1013463003: Update from https://crrev.com/320931 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 months 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
« no previous file with comments | « ui/gfx/transform.h ('k') | ui/gfx/transform_unittest.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 // 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
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
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
OLDNEW
« no previous file with comments | « ui/gfx/transform.h ('k') | ui/gfx/transform_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698