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 11 matching lines...) Expand all Loading... |
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
27 * OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #include "core/layout/shapes/RectangleShape.h" | 30 #include "core/layout/shapes/RectangleShape.h" |
31 | 31 |
32 #include "wtf/MathExtras.h" | 32 #include "platform/wtf/MathExtras.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 static inline float EllipseXIntercept(float y, float rx, float ry) { | 36 static inline float EllipseXIntercept(float y, float rx, float ry) { |
37 DCHECK_GT(ry, 0); | 37 DCHECK_GT(ry, 0); |
38 return rx * sqrt(1 - (y * y) / (ry * ry)); | 38 return rx * sqrt(1 - (y * y) / (ry * ry)); |
39 } | 39 } |
40 | 40 |
41 FloatRect RectangleShape::ShapeMarginBounds() const { | 41 FloatRect RectangleShape::ShapeMarginBounds() const { |
42 DCHECK_GE(ShapeMargin(), 0); | 42 DCHECK_GE(ShapeMargin(), 0); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 void RectangleShape::BuildDisplayPaths(DisplayPaths& paths) const { | 89 void RectangleShape::BuildDisplayPaths(DisplayPaths& paths) const { |
90 paths.shape.AddRoundedRect(bounds_, radii_); | 90 paths.shape.AddRoundedRect(bounds_, radii_); |
91 if (ShapeMargin()) | 91 if (ShapeMargin()) |
92 paths.margin_shape.AddRoundedRect( | 92 paths.margin_shape.AddRoundedRect( |
93 ShapeMarginBounds(), FloatSize(radii_.Width() + ShapeMargin(), | 93 ShapeMarginBounds(), FloatSize(radii_.Width() + ShapeMargin(), |
94 radii_.Height() + ShapeMargin())); | 94 radii_.Height() + ShapeMargin())); |
95 } | 95 } |
96 | 96 |
97 } // namespace blink | 97 } // namespace blink |
OLD | NEW |