OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2013 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 void scaleAndFloor(float factor); | 79 void scaleAndFloor(float factor); |
80 | 80 |
81 void expand(float topWidth, float bottomWidth, float leftWidth, float ri
ghtWidth); | 81 void expand(float topWidth, float bottomWidth, float leftWidth, float ri
ghtWidth); |
82 void expand(float size) { expand(size, size, size, size); } | 82 void expand(float size) { expand(size, size, size, size); } |
83 | 83 |
84 void shrink(float topWidth, float bottomWidth, float leftWidth, float ri
ghtWidth); | 84 void shrink(float topWidth, float bottomWidth, float leftWidth, float ri
ghtWidth); |
85 void shrink(float size) { shrink(size, size, size, size); } | 85 void shrink(float size) { shrink(size, size, size, size); } |
86 | 86 |
87 void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool inc
ludeLogicalLeftEdge, bool includeLogicalRightEdge); | 87 void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool inc
ludeLogicalLeftEdge, bool includeLogicalRightEdge); |
88 | 88 |
89 #ifndef NDEBUG | 89 String toString() const; |
90 // Prints debugging information. | |
91 void show() const; | |
92 #endif | |
93 | 90 |
94 private: | 91 private: |
95 FloatSize m_topLeft; | 92 FloatSize m_topLeft; |
96 FloatSize m_topRight; | 93 FloatSize m_topRight; |
97 FloatSize m_bottomLeft; | 94 FloatSize m_bottomLeft; |
98 FloatSize m_bottomRight; | 95 FloatSize m_bottomRight; |
99 }; | 96 }; |
100 | 97 |
101 FloatRoundedRect() { } | 98 FloatRoundedRect() { } |
102 explicit FloatRoundedRect(const FloatRect&, const Radii& = Radii()); | 99 explicit FloatRoundedRect(const FloatRect&, const Radii& = Radii()); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 142 |
146 void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool include
LogicalLeftEdge, bool includeLogicalRightEdge); | 143 void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool include
LogicalLeftEdge, bool includeLogicalRightEdge); |
147 | 144 |
148 // Tests whether the quad intersects any part of this rounded rectangle. | 145 // Tests whether the quad intersects any part of this rounded rectangle. |
149 // This only works for convex quads. | 146 // This only works for convex quads. |
150 bool intersectsQuad(const FloatQuad&) const; | 147 bool intersectsQuad(const FloatQuad&) const; |
151 | 148 |
152 void adjustRadii(); | 149 void adjustRadii(); |
153 bool isRenderable() const; | 150 bool isRenderable() const; |
154 | 151 |
155 #ifndef NDEBUG | |
156 // Prints debugging information. | |
157 void show() const; | |
158 #endif | |
159 | |
160 // Constrains the radii to be no more than the size of rect(); radii outside
of this range are not | 152 // Constrains the radii to be no more than the size of rect(); radii outside
of this range are not |
161 // defined. | 153 // defined. |
162 // In addition, the radii of the corners are floored to the nearest integer. | 154 // In addition, the radii of the corners are floored to the nearest integer. |
163 // FIXME: the flooring should not be necessary. At the moment it causes back
ground bleed in some cases. | 155 // FIXME: the flooring should not be necessary. At the moment it causes back
ground bleed in some cases. |
164 // FIXME: this code is almost the same as adjustRadii()/isRenderable(). Get
rid of one of them. | 156 // FIXME: this code is almost the same as adjustRadii()/isRenderable(). Get
rid of one of them. |
165 void constrainRadii(); | 157 void constrainRadii(); |
166 | 158 |
167 operator SkRRect() const; | 159 operator SkRRect() const; |
168 | 160 |
| 161 String toString() const; |
| 162 |
169 private: | 163 private: |
170 FloatRect m_rect; | 164 FloatRect m_rect; |
171 Radii m_radii; | 165 Radii m_radii; |
172 }; | 166 }; |
173 | 167 |
174 inline FloatRoundedRect::operator SkRRect() const | 168 inline FloatRoundedRect::operator SkRRect() const |
175 { | 169 { |
176 SkRRect rrect; | 170 SkRRect rrect; |
177 | 171 |
178 if (isRounded()) { | 172 if (isRounded()) { |
(...skipping 29 matching lines...) Expand all Loading... |
208 } | 202 } |
209 | 203 |
210 // Redeclared here to avoid ODR issues. | 204 // Redeclared here to avoid ODR issues. |
211 // See platform/testing/GeometryPrinters.h. | 205 // See platform/testing/GeometryPrinters.h. |
212 void PrintTo(const FloatRoundedRect&, std::ostream*); | 206 void PrintTo(const FloatRoundedRect&, std::ostream*); |
213 void PrintTo(const FloatRoundedRect::Radii&, std::ostream*); | 207 void PrintTo(const FloatRoundedRect::Radii&, std::ostream*); |
214 | 208 |
215 } // namespace blink | 209 } // namespace blink |
216 | 210 |
217 #endif // FloatRoundedRect_h | 211 #endif // FloatRoundedRect_h |
OLD | NEW |