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

Side by Side Diff: cc/base/math_util.cc

Issue 1135813005: Add detection for rotation and flip overlay transforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mojo surfaces unit test, chase flipped rename to TextureQuadState Created 5 years, 7 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 | « cc/base/math_util.h ('k') | cc/output/gl_renderer.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/base/math_util.h" 5 #include "cc/base/math_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 10
11 #include "base/trace_event/trace_event_argument.h" 11 #include "base/trace_event/trace_event_argument.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "ui/gfx/geometry/quad_f.h" 13 #include "ui/gfx/geometry/quad_f.h"
14 #include "ui/gfx/geometry/rect.h" 14 #include "ui/gfx/geometry/rect.h"
15 #include "ui/gfx/geometry/rect_conversions.h" 15 #include "ui/gfx/geometry/rect_conversions.h"
16 #include "ui/gfx/geometry/rect_f.h" 16 #include "ui/gfx/geometry/rect_f.h"
17 #include "ui/gfx/geometry/vector2d_f.h" 17 #include "ui/gfx/geometry/vector2d_f.h"
18 #include "ui/gfx/geometry/vector3d_f.h"
18 #include "ui/gfx/transform.h" 19 #include "ui/gfx/transform.h"
19 20
20 namespace cc { 21 namespace cc {
21 22
22 const double MathUtil::kPiDouble = 3.14159265358979323846; 23 const double MathUtil::kPiDouble = 3.14159265358979323846;
23 const float MathUtil::kPiFloat = 3.14159265358979323846f; 24 const float MathUtil::kPiFloat = 3.14159265358979323846f;
24 25
25 static HomogeneousCoordinate ProjectHomogeneousPoint( 26 static HomogeneousCoordinate ProjectHomogeneousPoint(
26 const gfx::Transform& transform, 27 const gfx::Transform& transform,
27 const gfx::PointF& p) { 28 const gfx::PointF& p) {
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 } 861 }
861 862
862 double MathUtil::AsDoubleSafely(double value) { 863 double MathUtil::AsDoubleSafely(double value) {
863 return std::min(value, std::numeric_limits<double>::max()); 864 return std::min(value, std::numeric_limits<double>::max());
864 } 865 }
865 866
866 float MathUtil::AsFloatSafely(float value) { 867 float MathUtil::AsFloatSafely(float value) {
867 return std::min(value, std::numeric_limits<float>::max()); 868 return std::min(value, std::numeric_limits<float>::max());
868 } 869 }
869 870
871 gfx::Vector3dF MathUtil::GetXAxis(const gfx::Transform& transform) {
872 return gfx::Vector3dF(transform.matrix().getFloat(0, 0),
873 transform.matrix().getFloat(1, 0),
874 transform.matrix().getFloat(2, 0));
875 }
876
877 gfx::Vector3dF MathUtil::GetYAxis(const gfx::Transform& transform) {
878 return gfx::Vector3dF(transform.matrix().getFloat(0, 1),
879 transform.matrix().getFloat(1, 1),
880 transform.matrix().getFloat(2, 1));
881 }
882
870 } // namespace cc 883 } // namespace cc
OLDNEW
« no previous file with comments | « cc/base/math_util.h ('k') | cc/output/gl_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698