Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2013 Xidorn Quan (quanxunzhen@gmail.com) | 4 * Copyright (C) 2013 Xidorn Quan (quanxunzhen@gmail.com) |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 if (m_bottomLeft.width() > 0 && m_bottomLeft.height() > 0) { | 73 if (m_bottomLeft.width() > 0 && m_bottomLeft.height() > 0) { |
| 74 m_bottomLeft.setWidth(max<int>(0, m_bottomLeft.width() + leftWidth)); | 74 m_bottomLeft.setWidth(max<int>(0, m_bottomLeft.width() + leftWidth)); |
| 75 m_bottomLeft.setHeight(max<int>(0, m_bottomLeft.height() + bottomWidth)) ; | 75 m_bottomLeft.setHeight(max<int>(0, m_bottomLeft.height() + bottomWidth)) ; |
| 76 } | 76 } |
| 77 if (m_bottomRight.width() > 0 && m_bottomRight.height() > 0) { | 77 if (m_bottomRight.width() > 0 && m_bottomRight.height() > 0) { |
| 78 m_bottomRight.setWidth(max<int>(0, m_bottomRight.width() + rightWidth)); | 78 m_bottomRight.setWidth(max<int>(0, m_bottomRight.width() + rightWidth)); |
| 79 m_bottomRight.setHeight(max<int>(0, m_bottomRight.height() + bottomWidth )); | 79 m_bottomRight.setHeight(max<int>(0, m_bottomRight.height() + bottomWidth )); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 IntRect RoundedRect::enclosedRect() const | |
|
Julien - ping for review
2013/06/19 19:42:58
This will return a smaller rectangle that what enc
jbroman
2013/08/02 14:28:17
What I want is "quickly give me a rect which is en
| |
| 84 { | |
| 85 int minX = m_rect.x() + max(m_radii.topLeft().width(), m_radii.bottomLeft(). width()); | |
| 86 int minY = m_rect.y() + max(m_radii.topLeft().height(), m_radii.topRight().h eight()); | |
| 87 int maxX = m_rect.maxX() - max(m_radii.topRight().width(), m_radii.bottomRig ht().width()); | |
| 88 int maxY = m_rect.maxY() - max(m_radii.bottomLeft().height(), m_radii.bottom Right().height()); | |
| 89 return IntRect(minX, minY, maxX - minX, maxY - minY); | |
| 90 } | |
| 91 | |
| 83 void RoundedRect::inflateWithRadii(int size) | 92 void RoundedRect::inflateWithRadii(int size) |
| 84 { | 93 { |
| 85 IntRect old = m_rect; | 94 IntRect old = m_rect; |
| 86 | 95 |
| 87 m_rect.inflate(size); | 96 m_rect.inflate(size); |
| 88 // Considering the inflation factor of shorter size to scale the radii seems appropriate here | 97 // Considering the inflation factor of shorter size to scale the radii seems appropriate here |
| 89 float factor; | 98 float factor; |
| 90 if (m_rect.width() < m_rect.height()) | 99 if (m_rect.width() < m_rect.height()) |
| 91 factor = old.width() ? (float)m_rect.width() / old.width() : int(0); | 100 factor = old.width() ? (float)m_rect.width() / old.width() : int(0); |
| 92 else | 101 else |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 FloatSize size(bottomRight.width(), bottomRight.height()); | 238 FloatSize size(bottomRight.width(), bottomRight.height()); |
| 230 if (!quad.intersectsEllipse(center, size)) | 239 if (!quad.intersectsEllipse(center, size)) |
| 231 return false; | 240 return false; |
| 232 } | 241 } |
| 233 } | 242 } |
| 234 | 243 |
| 235 return true; | 244 return true; |
| 236 } | 245 } |
| 237 | 246 |
| 238 } // namespace WebCore | 247 } // namespace WebCore |
| OLD | NEW |