OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 FloatPoint center = | 85 FloatPoint center = |
86 FloatPointForCenterCoordinate(center_x_, center_y_, box_size); | 86 FloatPointForCenterCoordinate(center_x_, center_y_, box_size); |
87 | 87 |
88 float width_delta = std::abs(box_size.Width() - center.X()); | 88 float width_delta = std::abs(box_size.Width() - center.X()); |
89 float height_delta = std::abs(box_size.Height() - center.Y()); | 89 float height_delta = std::abs(box_size.Height() - center.Y()); |
90 if (radius_.GetType() == BasicShapeRadius::kClosestSide) | 90 if (radius_.GetType() == BasicShapeRadius::kClosestSide) |
91 return std::min(std::min(std::abs(center.X()), width_delta), | 91 return std::min(std::min(std::abs(center.X()), width_delta), |
92 std::min(std::abs(center.Y()), height_delta)); | 92 std::min(std::abs(center.Y()), height_delta)); |
93 | 93 |
94 // If radius.type() == BasicShapeRadius::FarthestSide. | 94 // If radius.type() == BasicShapeRadius::kFarthestSide. |
95 return std::max(std::max(center.X(), width_delta), | 95 return std::max(std::max(center.X(), width_delta), |
96 std::max(center.Y(), height_delta)); | 96 std::max(center.Y(), height_delta)); |
97 } | 97 } |
98 | 98 |
99 void BasicShapeCircle::GetPath(Path& path, const FloatRect& bounding_box) { | 99 void BasicShapeCircle::GetPath(Path& path, const FloatRect& bounding_box) { |
100 DCHECK(path.IsEmpty()); | 100 DCHECK(path.IsEmpty()); |
101 FloatPoint center = | 101 FloatPoint center = |
102 FloatPointForCenterCoordinate(center_x_, center_y_, bounding_box.size()); | 102 FloatPointForCenterCoordinate(center_x_, center_y_, bounding_box.size()); |
103 float radius = FloatValueForRadiusInBox(bounding_box.size()); | 103 float radius = FloatValueForRadiusInBox(bounding_box.size()); |
104 path.AddEllipse(FloatRect(center.X() - radius + bounding_box.X(), | 104 path.AddEllipse(FloatRect(center.X() - radius + bounding_box.X(), |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 const BasicShapeInset& other = ToBasicShapeInset(o); | 303 const BasicShapeInset& other = ToBasicShapeInset(o); |
304 return right_ == other.right_ && top_ == other.top_ && | 304 return right_ == other.right_ && top_ == other.top_ && |
305 bottom_ == other.bottom_ && left_ == other.left_ && | 305 bottom_ == other.bottom_ && left_ == other.left_ && |
306 top_left_radius_ == other.top_left_radius_ && | 306 top_left_radius_ == other.top_left_radius_ && |
307 top_right_radius_ == other.top_right_radius_ && | 307 top_right_radius_ == other.top_right_radius_ && |
308 bottom_right_radius_ == other.bottom_right_radius_ && | 308 bottom_right_radius_ == other.bottom_right_radius_ && |
309 bottom_left_radius_ == other.bottom_left_radius_; | 309 bottom_left_radius_ == other.bottom_left_radius_; |
310 } | 310 } |
311 | 311 |
312 } // namespace blink | 312 } // namespace blink |
OLD | NEW |