Index: Source/WebCore/platform/graphics/IntSize.h |
=================================================================== |
--- Source/WebCore/platform/graphics/IntSize.h (revision 116270) |
+++ Source/WebCore/platform/graphics/IntSize.h (working copy) |
@@ -80,13 +80,18 @@ |
m_width += width; |
m_height += height; |
} |
+ |
+ void scale(float widthScale, float heightScale) |
+ { |
+ m_width = static_cast<int>(static_cast<float>(m_width) * widthScale); |
+ m_height = static_cast<int>(static_cast<float>(m_height) * heightScale); |
+ } |
void scale(float scale) |
{ |
- m_width = static_cast<int>(static_cast<float>(m_width) * scale); |
- m_height = static_cast<int>(static_cast<float>(m_height) * scale); |
+ this->scale(scale, scale); |
} |
- |
+ |
IntSize expandedTo(const IntSize& other) const |
{ |
return IntSize(m_width > other.m_width ? m_width : other.m_width, |
@@ -104,6 +109,14 @@ |
*this = expandedTo(IntSize()); |
} |
+ void clampToMinimumSize(const IntSize& minimumSize) |
+ { |
+ if (m_width < minimumSize.width()) |
+ m_width = minimumSize.width(); |
+ if (m_height < minimumSize.height()) |
+ m_height = minimumSize.height(); |
+ } |
+ |
int diagonalLengthSquared() const |
{ |
return m_width * m_width + m_height * m_height; |