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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 // Considering the inflation factor of shorter size to scale the radii seems appropriate here | 208 // Considering the inflation factor of shorter size to scale the radii seems appropriate here |
209 float factor; | 209 float factor; |
210 if (m_rect.width() < m_rect.height()) | 210 if (m_rect.width() < m_rect.height()) |
211 factor = old.width() ? (float)m_rect.width() / old.width() : int(0); | 211 factor = old.width() ? (float)m_rect.width() / old.width() : int(0); |
212 else | 212 else |
213 factor = old.height() ? (float)m_rect.height() / old.height() : int(0); | 213 factor = old.height() ? (float)m_rect.height() / old.height() : int(0); |
214 | 214 |
215 m_radii.scale(factor); | 215 m_radii.scale(factor); |
216 } | 216 } |
217 | 217 |
218 void FloatRoundedRect::shrink(const FloatRectOutsets& insets) | |
219 { | |
220 m_rect.expand(insets); | |
221 m_radii.shrink(-insets.top(), -insets.bottom(), -insets.left(), -insets.righ t()); | |
f(malita)
2015/05/11 18:09:14
Nit: I find the difference in Radii::shrink() vs.
fs
2015/05/12 08:53:55
Annoying indeed...
| |
222 } | |
223 | |
218 bool FloatRoundedRect::intersectsQuad(const FloatQuad& quad) const | 224 bool FloatRoundedRect::intersectsQuad(const FloatQuad& quad) const |
219 { | 225 { |
220 if (!quad.intersectsRect(m_rect)) | 226 if (!quad.intersectsRect(m_rect)) |
221 return false; | 227 return false; |
222 | 228 |
223 const FloatSize& topLeft = m_radii.topLeft(); | 229 const FloatSize& topLeft = m_radii.topLeft(); |
224 if (!topLeft.isEmpty()) { | 230 if (!topLeft.isEmpty()) { |
225 FloatRect rect(m_rect.x(), m_rect.y(), topLeft.width(), topLeft.height() ); | 231 FloatRect rect(m_rect.x(), m_rect.y(), topLeft.width(), topLeft.height() ); |
226 if (quad.intersectsRect(rect)) { | 232 if (quad.intersectsRect(rect)) { |
227 FloatPoint center(m_rect.x() + topLeft.width(), m_rect.y() + topLeft .height()); | 233 FloatPoint center(m_rect.x() + topLeft.width(), m_rect.y() + topLeft .height()); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 void FloatRoundedRect::show() | 358 void FloatRoundedRect::show() |
353 { | 359 { |
354 fprintf(stderr, "FloatRoundedRect:\n rect: "); | 360 fprintf(stderr, "FloatRoundedRect:\n rect: "); |
355 m_rect.show(); | 361 m_rect.show(); |
356 fprintf(stderr, " radii: "); | 362 fprintf(stderr, " radii: "); |
357 m_radii.show(); | 363 m_radii.show(); |
358 } | 364 } |
359 #endif | 365 #endif |
360 | 366 |
361 } // namespace blink | 367 } // namespace blink |
OLD | NEW |