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

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

Issue 295193002: Get rid of graphics layer anchor points, and replace with transform origin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/base/math_util.h ('k') | cc/layers/delegated_renderer_layer_impl_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 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
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 return true; 584 return true;
585 } 585 }
586 586
587 scoped_ptr<base::Value> MathUtil::AsValue(const gfx::PointF& pt) { 587 scoped_ptr<base::Value> MathUtil::AsValue(const gfx::PointF& pt) {
588 scoped_ptr<base::ListValue> res(new base::ListValue()); 588 scoped_ptr<base::ListValue> res(new base::ListValue());
589 res->AppendDouble(pt.x()); 589 res->AppendDouble(pt.x());
590 res->AppendDouble(pt.y()); 590 res->AppendDouble(pt.y());
591 return res.PassAs<base::Value>(); 591 return res.PassAs<base::Value>();
592 } 592 }
593 593
594 scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Point3F& pt) {
595 scoped_ptr<base::ListValue> res(new base::ListValue());
596 res->AppendDouble(pt.x());
597 res->AppendDouble(pt.y());
598 res->AppendDouble(pt.z());
599 return res.PassAs<base::Value>();
600 }
601
594 scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Vector2d& v) { 602 scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Vector2d& v) {
595 scoped_ptr<base::ListValue> res(new base::ListValue()); 603 scoped_ptr<base::ListValue> res(new base::ListValue());
596 res->AppendInteger(v.x()); 604 res->AppendInteger(v.x());
597 res->AppendInteger(v.y()); 605 res->AppendInteger(v.y());
598 return res.PassAs<base::Value>(); 606 return res.PassAs<base::Value>();
599 } 607 }
600 608
601 scoped_ptr<base::Value> MathUtil::AsValue(const gfx::QuadF& q) { 609 scoped_ptr<base::Value> MathUtil::AsValue(const gfx::QuadF& q) {
602 scoped_ptr<base::ListValue> res(new base::ListValue()); 610 scoped_ptr<base::ListValue> res(new base::ListValue());
603 res->AppendDouble(q.p1().x()); 611 res->AppendDouble(q.p1().x());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 return scoped_ptr<base::Value>(base::Value::CreateDoubleValue( 653 return scoped_ptr<base::Value>(base::Value::CreateDoubleValue(
646 std::min(value, std::numeric_limits<double>::max()))); 654 std::min(value, std::numeric_limits<double>::max())));
647 } 655 }
648 656
649 scoped_ptr<base::Value> MathUtil::AsValueSafely(float value) { 657 scoped_ptr<base::Value> MathUtil::AsValueSafely(float value) {
650 return scoped_ptr<base::Value>(base::Value::CreateDoubleValue( 658 return scoped_ptr<base::Value>(base::Value::CreateDoubleValue(
651 std::min(value, std::numeric_limits<float>::max()))); 659 std::min(value, std::numeric_limits<float>::max())));
652 } 660 }
653 661
654 } // namespace cc 662 } // namespace cc
OLDNEW
« no previous file with comments | « cc/base/math_util.h ('k') | cc/layers/delegated_renderer_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698