diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/root_window.cc | 6 | ||||
-rw-r--r-- | ui/base/animation/tween.cc | 2 | ||||
-rw-r--r-- | ui/base/events/event.cc | 9 | ||||
-rw-r--r-- | ui/compositor/debug_utils.cc | 7 | ||||
-rw-r--r-- | ui/compositor/layer.cc | 11 | ||||
-rw-r--r-- | ui/gfx/interpolated_transform.cc | 26 | ||||
-rw-r--r-- | ui/gfx/interpolated_transform.h | 22 | ||||
-rw-r--r-- | ui/gfx/interpolated_transform_unittest.cc | 14 | ||||
-rw-r--r-- | ui/gfx/point3_f.h (renamed from ui/gfx/point3.h) | 27 | ||||
-rw-r--r-- | ui/gfx/transform.cc | 12 | ||||
-rw-r--r-- | ui/gfx/transform.h | 12 | ||||
-rw-r--r-- | ui/gfx/transform_unittest.cc | 29 | ||||
-rw-r--r-- | ui/ui.gyp | 2 | ||||
-rw-r--r-- | ui/views/view.cc | 15 |
14 files changed, 97 insertions, 97 deletions
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index b9712bd..d9e70ea 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -37,7 +37,7 @@ #include "ui/compositor/layer.h" #include "ui/compositor/layer_animator.h" #include "ui/gfx/display.h" -#include "ui/gfx/point3.h" +#include "ui/gfx/point3_f.h" #include "ui/gfx/point_conversions.h" #include "ui/gfx/screen.h" @@ -1017,12 +1017,12 @@ void RootWindow::SynthesizeMouseMoveEvent() { synthesize_mouse_move_ = false; #if !defined(OS_WIN) // Temporarily disabled for windows. See crbug.com/112222. - gfx::Point3f point(GetLastMouseLocationInRoot()); + gfx::Point3F point(GetLastMouseLocationInRoot()); gfx::Transform transform = layer()->transform(); float scale = ui::GetDeviceScaleFactor(layer()); transform.ConcatScale(scale, scale); transform.TransformPoint(point); - gfx::Point orig_mouse_location = point.AsPoint(); + gfx::Point orig_mouse_location = gfx::ToFlooredPoint(point.AsPointF()); // TODO(derat|oshima): Don't use mouse_button_flags_ as it's // currently broken. See/ crbug.com/107931. diff --git a/ui/base/animation/tween.cc b/ui/base/animation/tween.cc index 3c81ca1..a67ab56 100644 --- a/ui/base/animation/tween.cc +++ b/ui/base/animation/tween.cc @@ -107,7 +107,7 @@ gfx::Transform Tween::ValueBetween(double value, gfx::Transform to_return; gfx::Point start_translation, end_translation; float start_rotation, end_rotation; - gfx::Point3f start_scale, end_scale; + gfx::Point3F start_scale, end_scale; if (InterpolatedTransform::FactorTRS(start_transform, &start_translation, &start_rotation, diff --git a/ui/base/events/event.cc b/ui/base/events/event.cc index 604a239..e684f1a 100644 --- a/ui/base/events/event.cc +++ b/ui/base/events/event.cc @@ -13,7 +13,8 @@ #include "ui/base/keycodes/keyboard_code_conversion.h" #include "ui/gfx/interpolated_transform.h" -#include "ui/gfx/point3.h" +#include "ui/gfx/point_conversions.h" +#include "ui/gfx/point3_f.h" #include "ui/gfx/transform.h" #if defined(USE_X11) @@ -147,9 +148,9 @@ LocatedEvent::LocatedEvent(EventType type, void LocatedEvent::UpdateForRootTransform( const gfx::Transform& root_transform) { // Transform has to be done at root level. - gfx::Point3f p(location_); + gfx::Point3F p(location_); root_transform.TransformPointReverse(p); - root_location_ = location_ = p.AsPoint(); + root_location_ = location_ = gfx::ToFlooredPoint(p.AsPointF()); } //////////////////////////////////////////////////////////////////////////////// @@ -333,7 +334,7 @@ void TouchEvent::CalibrateLocation(const gfx::Size& from, const gfx::Size& to) { void TouchEvent::UpdateForRootTransform(const gfx::Transform& root_transform) { LocatedEvent::UpdateForRootTransform(root_transform); - gfx::Point3f scale; + gfx::Point3F scale; InterpolatedTransform::FactorTRS(root_transform, NULL, NULL, &scale); if (scale.x()) radius_x_ /= scale.x(); diff --git a/ui/compositor/debug_utils.cc b/ui/compositor/debug_utils.cc index 9b531ff..fff9281 100644 --- a/ui/compositor/debug_utils.cc +++ b/ui/compositor/debug_utils.cc @@ -15,6 +15,7 @@ #include "ui/compositor/layer.h" #include "ui/gfx/interpolated_transform.h" #include "ui/gfx/point.h" +#include "ui/gfx/point_conversions.h" #include "ui/gfx/transform.h" namespace ui { @@ -68,12 +69,12 @@ void PrintLayerHierarchyImp(const Layer* layer, int indent, if (layer->transform().HasChange()) { gfx::Point translation; float rotation; - gfx::Point3f scale; + gfx::Point3F scale; if (ui::InterpolatedTransform::FactorTRS(layer->transform(), &translation, &rotation, &scale)) { - if (translation != gfx::Point()) { + if (!translation.IsOrigin()) { buf << L'\n' << UTF8ToWide(content_indent_str); buf << L"translation: " << translation.x() << L", " << translation.y(); } @@ -83,7 +84,7 @@ void PrintLayerHierarchyImp(const Layer* layer, int indent, buf << L"rotation: " << std::setprecision(4) << rotation; } - if (scale.AsPoint() != gfx::Point()) { + if (!gfx::ToFlooredPoint(scale.AsPointF()).IsOrigin()) { buf << L'\n' << UTF8ToWide(content_indent_str); buf << std::setprecision(4); buf << L"scale: " << scale.x() << L", " << scale.y(); diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc index 3a76901..d3dc6ca 100644 --- a/ui/compositor/layer.cc +++ b/ui/compositor/layer.cc @@ -26,7 +26,8 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/display.h" #include "ui/gfx/interpolated_transform.h" -#include "ui/gfx/point3.h" +#include "ui/gfx/point_conversions.h" +#include "ui/gfx/point3_f.h" #include "ui/gfx/size_conversions.h" namespace { @@ -560,9 +561,9 @@ bool Layer::ConvertPointForAncestor(const Layer* ancestor, gfx::Point* point) const { gfx::Transform transform; bool result = GetTransformRelativeTo(ancestor, &transform); - gfx::Point3f p(*point); + gfx::Point3F p(*point); transform.TransformPoint(p); - *point = p.AsPoint(); + *point = gfx::ToFlooredPoint(p.AsPointF()); return result; } @@ -570,9 +571,9 @@ bool Layer::ConvertPointFromAncestor(const Layer* ancestor, gfx::Point* point) const { gfx::Transform transform; bool result = GetTransformRelativeTo(ancestor, &transform); - gfx::Point3f p(*point); + gfx::Point3F p(*point); transform.TransformPointReverse(p); - *point = p.AsPoint(); + *point = gfx::ToFlooredPoint(p.AsPointF()); return result; } diff --git a/ui/gfx/interpolated_transform.cc b/ui/gfx/interpolated_transform.cc index 2db6adf..a3cf87a 100644 --- a/ui/gfx/interpolated_transform.cc +++ b/ui/gfx/interpolated_transform.cc @@ -105,7 +105,7 @@ void InterpolatedTransform::SetChild(InterpolatedTransform* child) { bool InterpolatedTransform::FactorTRS(const gfx::Transform& transform, gfx::Point* translation, float* rotation, - gfx::Point3f* scale) { + gfx::Point3F* scale) { const SkMatrix44& m = transform.matrix(); float m00 = m.get(0, 0); float m01 = m.get(0, 1); @@ -152,7 +152,7 @@ bool InterpolatedTransform::FactorTRS(const gfx::Transform& transform, if (rotation) *rotation = radians * 180 / M_PI; if (scale) - *scale = gfx::Point3f(scale_x, scale_y, 1.0f); + *scale = gfx::Point3F(scale_x, scale_y, 1.0f); return true; } @@ -217,7 +217,7 @@ gfx::Transform InterpolatedRotation::InterpolateButDoNotCompose(float t) const { // InterpolatedAxisAngleRotation::InterpolatedAxisAngleRotation( - gfx::Point3f axis, + gfx::Point3F axis, float start_degrees, float end_degrees) : InterpolatedTransform(), @@ -227,7 +227,7 @@ InterpolatedAxisAngleRotation::InterpolatedAxisAngleRotation( } InterpolatedAxisAngleRotation::InterpolatedAxisAngleRotation( - gfx::Point3f axis, + gfx::Point3F axis, float start_degrees, float end_degrees, float start_time, @@ -253,26 +253,26 @@ InterpolatedAxisAngleRotation::InterpolateButDoNotCompose(float t) const { InterpolatedScale::InterpolatedScale(float start_scale, float end_scale) : InterpolatedTransform(), - start_scale_(gfx::Point3f(start_scale, start_scale, start_scale)), - end_scale_(gfx::Point3f(end_scale, end_scale, end_scale)) { + start_scale_(gfx::Point3F(start_scale, start_scale, start_scale)), + end_scale_(gfx::Point3F(end_scale, end_scale, end_scale)) { } InterpolatedScale::InterpolatedScale(float start_scale, float end_scale, float start_time, float end_time) : InterpolatedTransform(start_time, end_time), - start_scale_(gfx::Point3f(start_scale, start_scale, start_scale)), - end_scale_(gfx::Point3f(end_scale, end_scale, end_scale)) { + start_scale_(gfx::Point3F(start_scale, start_scale, start_scale)), + end_scale_(gfx::Point3F(end_scale, end_scale, end_scale)) { } -InterpolatedScale::InterpolatedScale(const gfx::Point3f& start_scale, - const gfx::Point3f& end_scale) +InterpolatedScale::InterpolatedScale(const gfx::Point3F& start_scale, + const gfx::Point3F& end_scale) : InterpolatedTransform(), start_scale_(start_scale), end_scale_(end_scale) { } -InterpolatedScale::InterpolatedScale(const gfx::Point3f& start_scale, - const gfx::Point3f& end_scale, +InterpolatedScale::InterpolatedScale(const gfx::Point3F& start_scale, + const gfx::Point3F& end_scale, float start_time, float end_time) : InterpolatedTransform(start_time, end_time), @@ -415,7 +415,7 @@ InterpolatedTRSTransform::InterpolateButDoNotCompose(float t) const { void InterpolatedTRSTransform::Init(const gfx::Transform& start_transform, const gfx::Transform& end_transform) { gfx::Point start_translation, end_translation; - gfx::Point3f start_scale, end_scale; + gfx::Point3F start_scale, end_scale; float start_degrees, end_degrees; if (FactorTRS(start_transform, &start_translation, diff --git a/ui/gfx/interpolated_transform.h b/ui/gfx/interpolated_transform.h index 097c2b1..979eedf 100644 --- a/ui/gfx/interpolated_transform.h +++ b/ui/gfx/interpolated_transform.h @@ -8,7 +8,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "ui/gfx/point.h" -#include "ui/gfx/point3.h" +#include "ui/gfx/point3_f.h" #include "ui/gfx/transform.h" namespace ui { @@ -49,7 +49,7 @@ class UI_EXPORT InterpolatedTransform { static bool FactorTRS(const gfx::Transform& transform, gfx::Point* translation, float* rotation, - gfx::Point3f* scale); + gfx::Point3F* scale); protected: // Calculates the interpolated transform without considering our child. @@ -114,10 +114,10 @@ class UI_EXPORT InterpolatedRotation : public InterpolatedTransform { /////////////////////////////////////////////////////////////////////////////// class UI_EXPORT InterpolatedAxisAngleRotation : public InterpolatedTransform { public: - InterpolatedAxisAngleRotation(gfx::Point3f axis, + InterpolatedAxisAngleRotation(gfx::Point3F axis, float start_degrees, float end_degrees); - InterpolatedAxisAngleRotation(gfx::Point3f axis, + InterpolatedAxisAngleRotation(gfx::Point3F axis, float start_degrees, float end_degrees, float start_time, @@ -128,7 +128,7 @@ class UI_EXPORT InterpolatedAxisAngleRotation : public InterpolatedTransform { virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; private: - gfx::Point3f axis_; + gfx::Point3F axis_; const float start_degrees_; const float end_degrees_; @@ -146,10 +146,10 @@ class UI_EXPORT InterpolatedScale : public InterpolatedTransform { InterpolatedScale(float start_scale, float end_scale); InterpolatedScale(float start_scale, float end_scale, float start_time, float end_time); - InterpolatedScale(const gfx::Point3f& start_scale, - const gfx::Point3f& end_scale); - InterpolatedScale(const gfx::Point3f& start_scale, - const gfx::Point3f& end_scale, + InterpolatedScale(const gfx::Point3F& start_scale, + const gfx::Point3F& end_scale); + InterpolatedScale(const gfx::Point3F& start_scale, + const gfx::Point3F& end_scale, float start_time, float end_time); virtual ~InterpolatedScale(); @@ -158,8 +158,8 @@ class UI_EXPORT InterpolatedScale : public InterpolatedTransform { virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; private: - const gfx::Point3f start_scale_; - const gfx::Point3f end_scale_; + const gfx::Point3F start_scale_; + const gfx::Point3F end_scale_; DISALLOW_COPY_AND_ASSIGN(InterpolatedScale); }; diff --git a/ui/gfx/interpolated_transform_unittest.cc b/ui/gfx/interpolated_transform_unittest.cc index 5beac94..65c5e2c 100644 --- a/ui/gfx/interpolated_transform_unittest.cc +++ b/ui/gfx/interpolated_transform_unittest.cc @@ -47,10 +47,10 @@ TEST(InterpolatedTransformTest, InterpolatedRotation) { } TEST(InterpolatedTransformTest, InterpolatedScale) { - ui::InterpolatedScale interpolated_scale(gfx::Point3f(0, 0, 0), - gfx::Point3f(100, 100, 100)); + ui::InterpolatedScale interpolated_scale(gfx::Point3F(0, 0, 0), + gfx::Point3F(100, 100, 100)); ui::InterpolatedScale interpolated_scale_diff_start_end( - gfx::Point3f(0, 0, 0), gfx::Point3f(100, 100, 100), 100, 200); + gfx::Point3F(0, 0, 0), gfx::Point3F(100, 100, 100), 100, 200); for (int i = 0; i <= 100; ++i) { gfx::Transform scale; @@ -102,7 +102,7 @@ TEST(InterpolatedTransformTest, InterpolatedScaleAboutPivot) { gfx::Point above_pivot(100, 200); ui::InterpolatedTransformAboutPivot interpolated_xform( pivot, - new ui::InterpolatedScale(gfx::Point3f(1, 1, 1), gfx::Point3f(2, 2, 2))); + new ui::InterpolatedScale(gfx::Point3F(1, 1, 1), gfx::Point3F(2, 2, 2))); gfx::Transform result = interpolated_xform.Interpolate(0.0f); CheckApproximatelyEqual(gfx::Transform(), result); result = interpolated_xform.Interpolate(1.0f); @@ -125,7 +125,7 @@ TEST(InterpolatedTransformTest, FactorTRS) { // factor the matrix gfx::Point translation; float rotation; - gfx::Point3f scale; + gfx::Point3F scale; bool success = ui::InterpolatedTransform::FactorTRS(transform, &translation, &rotation, @@ -219,8 +219,8 @@ ui::InterpolatedTransform* GetMaximize() { target_bounds.width()) / initial_bounds.height(); scoped_ptr<ui::InterpolatedTransform> scale( - new ui::InterpolatedScale(gfx::Point3f(1, 1, 1), - gfx::Point3f(scale_x, scale_y, 1))); + new ui::InterpolatedScale(gfx::Point3F(1, 1, 1), + gfx::Point3F(scale_x, scale_y, 1))); scoped_ptr<ui::InterpolatedTransform> translation( new ui::InterpolatedTranslation( diff --git a/ui/gfx/point3.h b/ui/gfx/point3_f.h index 06caa5e..c0aefb5 100644 --- a/ui/gfx/point3.h +++ b/ui/gfx/point3_f.h @@ -2,25 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GFX_POINT3_H_ -#define UI_GFX_POINT3_H_ +#ifndef UI_GFX_POINT3_F_H_ +#define UI_GFX_POINT3_F_H_ -#include <cmath> - -#include "ui/gfx/point.h" +#include "ui/gfx/point_f.h" namespace gfx { // A point has an x, y and z coordinate. -class Point3f { +class Point3F { public: - Point3f() : x_(0), y_(0), z_(0) {} + Point3F() : x_(0), y_(0), z_(0) {} - Point3f(float x, float y, float z) : x_(x), y_(y), z_(z) {} + Point3F(float x, float y, float z) : x_(x), y_(y), z_(z) {} - explicit Point3f(const Point& point) : x_(point.x()), y_(point.y()), z_(0) {} + explicit Point3F(const PointF& point) : x_(point.x()), y_(point.y()), z_(0) {} - ~Point3f() {} + ~Point3F() {} float x() const { return x_; } float y() const { return y_; } @@ -37,17 +35,14 @@ class Point3f { } // Returns the squared euclidean distance between two points. - float SquaredDistanceTo(const Point3f& other) const { + float SquaredDistanceTo(const Point3F& other) const { float dx = x_ - other.x_; float dy = y_ - other.y_; float dz = z_ - other.z_; return dx * dx + dy * dy + dz * dz; } - Point AsPoint() const { - return Point(static_cast<int>(std::floor(x_)), - static_cast<int>(std::floor(y_))); - } + PointF AsPointF() const { return PointF(x_, y_); } private: float x_; @@ -59,4 +54,4 @@ class Point3f { } // namespace gfx -#endif // UI_GFX_POINT3_H_ +#endif // UI_GFX_POINT3_F_H_ diff --git a/ui/gfx/transform.cc b/ui/gfx/transform.cc index 4dd6709..d34c907 100644 --- a/ui/gfx/transform.cc +++ b/ui/gfx/transform.cc @@ -4,7 +4,7 @@ #include "ui/gfx/transform.h" -#include "ui/gfx/point3.h" +#include "ui/gfx/point3_f.h" #include "ui/gfx/rect.h" #include "ui/gfx/safe_integer_conversions.h" #include "ui/gfx/skia_util.h" @@ -29,7 +29,7 @@ void Transform::SetRotate(float degree) { matrix_.setRotateDegreesAbout(0, 0, 1, SkFloatToScalar(degree)); } -void Transform::SetRotateAbout(const Point3f& axis, float degree) { +void Transform::SetRotateAbout(const Point3F& axis, float degree) { matrix_.setRotateDegreesAbout(axis.x(), axis.y(), axis.z(), @@ -76,7 +76,7 @@ void Transform::ConcatRotate(float degree) { matrix_.postConcat(rot); } -void Transform::ConcatRotateAbout(const Point3f& axis, float degree) { +void Transform::ConcatRotateAbout(const Point3F& axis, float degree) { SkMatrix44 rot; rot.setRotateDegreesAbout(axis.x(), axis.y(), @@ -127,7 +127,7 @@ void Transform::TransformPoint(Point& point) const { TransformPointInternal(matrix_, point); } -void Transform::TransformPoint(Point3f& point) const { +void Transform::TransformPoint(Point3F& point) const { TransformPointInternal(matrix_, point); } @@ -141,7 +141,7 @@ bool Transform::TransformPointReverse(Point& point) const { return true; } -bool Transform::TransformPointReverse(Point3f& point) const { +bool Transform::TransformPointReverse(Point3F& point) const { // TODO(sad): Try to avoid trying to invert the matrix. SkMatrix44 inverse; if (!matrix_.invert(&inverse)) @@ -170,7 +170,7 @@ bool Transform::TransformRectReverse(Rect* rect) const { } void Transform::TransformPointInternal(const SkMatrix44& xform, - Point3f& point) const { + Point3F& point) const { SkScalar p[4] = { SkFloatToScalar(point.x()), SkFloatToScalar(point.y()), diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h index d09ed3d..4385c1c 100644 --- a/ui/gfx/transform.h +++ b/ui/gfx/transform.h @@ -12,7 +12,7 @@ namespace gfx { class Rect; class Point; -class Point3f; +class Point3F; // 4x4 transformation matrix. Transform is cheap and explicitly allows // copy/assign. @@ -37,7 +37,7 @@ class UI_EXPORT Transform { void SetRotate(float degree); // Sets the rotation of the transform (about a vector). - void SetRotateAbout(const Point3f& point, float degree); + void SetRotateAbout(const Point3F& point, float degree); // Sets the scaling parameters. void SetScaleX(float x); @@ -58,7 +58,7 @@ class UI_EXPORT Transform { void ConcatRotate(float degree); // Applies an axis-angle rotation on the current transformation. - void ConcatRotateAbout(const Point3f& point, float degree); + void ConcatRotateAbout(const Point3F& point, float degree); // Applies scaling on current transform. void ConcatScale(float x, float y); @@ -85,7 +85,7 @@ class UI_EXPORT Transform { // Applies the transformation on the point. Returns true if the point is // transformed successfully. - void TransformPoint(Point3f& point) const; + void TransformPoint(Point3F& point) const; // Applies the transformation on the point. Returns true if the point is // transformed successfully. Rounds the result to the nearest point. @@ -93,7 +93,7 @@ class UI_EXPORT Transform { // Applies the reverse transformation on the point. Returns true if the // transformation can be inverted. - bool TransformPointReverse(Point3f& point) const; + bool TransformPointReverse(Point3F& point) const; // Applies the reverse transformation on the point. Returns true if the // transformation can be inverted. Rounds the result to the nearest point. @@ -119,7 +119,7 @@ class UI_EXPORT Transform { Point& point) const; void TransformPointInternal(const SkMatrix44& xform, - Point3f& point) const; + Point3F& point) const; SkMatrix44 matrix_; diff --git a/ui/gfx/transform_unittest.cc b/ui/gfx/transform_unittest.cc index 4d30e61..52bb1c6 100644 --- a/ui/gfx/transform_unittest.cc +++ b/ui/gfx/transform_unittest.cc @@ -9,12 +9,13 @@ #include "base/basictypes.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/gfx/point3.h" +#include "ui/gfx/point.h" +#include "ui/gfx/point3_f.h" namespace { -bool PointsAreNearlyEqual(const gfx::Point3f& lhs, - const gfx::Point3f& rhs) { +bool PointsAreNearlyEqual(const gfx::Point3F& lhs, + const gfx::Point3F& rhs) { float epsilon = 0.0001f; return lhs.SquaredDistanceTo(rhs) < epsilon; } @@ -73,8 +74,8 @@ TEST(XFormTest, ConcatTranslate) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { const TestCase& value = test_cases[i]; xform.ConcatTranslate(value.tx, value.ty); - gfx::Point3f p1(value.x1, value.y1, 0); - gfx::Point3f p2(value.x2, value.y2, 0); + gfx::Point3F p1(value.x1, value.y1, 0); + gfx::Point3F p2(value.x2, value.y2, 0); xform.TransformPoint(p1); if (value.tx == value.tx && value.ty == value.ty) { @@ -100,8 +101,8 @@ TEST(XFormTest, ConcatScale) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { const TestCase& value = test_cases[i]; xform.ConcatScale(value.scale, value.scale); - gfx::Point3f p1(value.before, value.before, 0); - gfx::Point3f p2(value.after, value.after, 0); + gfx::Point3F p1(value.before, value.before, 0); + gfx::Point3F p2(value.after, value.after, 0); xform.TransformPoint(p1); if (value.scale == value.scale) { EXPECT_TRUE(PointsAreNearlyEqual(p1, p2)); @@ -129,8 +130,8 @@ TEST(XFormTest, ConcatRotate) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { const TestCase& value = test_cases[i]; xform.ConcatRotate(value.degrees); - gfx::Point3f p1(value.x1, value.y1, 0); - gfx::Point3f p2(value.x2, value.y2, 0); + gfx::Point3F p1(value.x1, value.y1, 0); + gfx::Point3F p2(value.x2, value.y2, 0); xform.TransformPoint(p1); if (value.degrees == value.degrees) { EXPECT_TRUE(PointsAreNearlyEqual(p1, p2)); @@ -156,7 +157,7 @@ TEST(XFormTest, SetTranslate) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { const TestCase& value = test_cases[i]; for (int k = 0; k < 3; ++k) { - gfx::Point3f p0, p1, p2; + gfx::Point3F p0, p1, p2; gfx::Transform xform; switch (k) { case 0: @@ -203,7 +204,7 @@ TEST(XFormTest, SetScale) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { const TestCase& value = test_cases[i]; for (int k = 0; k < 3; ++k) { - gfx::Point3f p0, p1, p2; + gfx::Point3F p0, p1, p2; gfx::Transform xform; switch (k) { case 0: @@ -255,9 +256,9 @@ TEST(XFormTest, SetRotate) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(set_rotate_cases); ++i) { const SetRotateCase& value = set_rotate_cases[i]; - gfx::Point3f p0; - gfx::Point3f p1(value.x, value.y, 0); - gfx::Point3f p2(value.xprime, value.yprime, 0); + gfx::Point3F p0; + gfx::Point3F p1(value.x, value.y, 0); + gfx::Point3F p2(value.xprime, value.yprime, 0); p0 = p1; gfx::Transform xform; xform.SetRotate(value.degree); @@ -447,7 +447,7 @@ 'gfx/platform_font_win.h', 'gfx/point.cc', 'gfx/point.h', - 'gfx/point3.h', + 'gfx/point3_f.h', 'gfx/point_base.h', 'gfx/point_conversions.cc', 'gfx/point_conversions.h', diff --git a/ui/views/view.cc b/ui/views/view.cc index fd1ac7f..660128b 100644 --- a/ui/views/view.cc +++ b/ui/views/view.cc @@ -21,7 +21,8 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/interpolated_transform.h" #include "ui/gfx/path.h" -#include "ui/gfx/point3.h" +#include "ui/gfx/point_conversions.h" +#include "ui/gfx/point3_f.h" #include "ui/gfx/skia_util.h" #include "ui/gfx/transform.h" #include "ui/views/background.h" @@ -1410,7 +1411,7 @@ std::string View::DoPrintViewGraph(bool first, View* view_with_children) { if (GetTransform().HasChange()) { gfx::Point translation; float rotation; - gfx::Point3f scale; + gfx::Point3F scale; if (ui::InterpolatedTransform::FactorTRS(GetTransform(), &translation, &rotation, @@ -1431,7 +1432,7 @@ std::string View::DoPrintViewGraph(bool first, View* view_with_children) { result.append(bounds_buffer); } - if (scale.AsPoint() != gfx::Point(0, 0)) { + if (!gfx::ToFlooredPoint(scale.AsPointF()).IsOrigin()) { base::snprintf(bounds_buffer, arraysize(bounds_buffer), "\\n scale: (%2.4f, %2.4f)", @@ -1786,9 +1787,9 @@ bool View::ConvertPointForAncestor(const View* ancestor, gfx::Transform trans; // TODO(sad): Have some way of caching the transformation results. bool result = GetTransformRelativeTo(ancestor, &trans); - gfx::Point3f p(*point); + gfx::Point3F p(*point); trans.TransformPoint(p); - *point = p.AsPoint(); + *point = gfx::ToFlooredPoint(p.AsPointF()); return result; } @@ -1796,9 +1797,9 @@ bool View::ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const { gfx::Transform trans; bool result = GetTransformRelativeTo(ancestor, &trans); - gfx::Point3f p(*point); + gfx::Point3F p(*point); trans.TransformPointReverse(p); - *point = p.AsPoint(); + *point = gfx::ToFlooredPoint(p.AsPointF()); return result; } |