OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserve
d. | 2 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserve
d. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 91 } |
92 | 92 |
93 void clampToMinimumSize(const IntSize& minimumSize) | 93 void clampToMinimumSize(const IntSize& minimumSize) |
94 { | 94 { |
95 if (m_width < minimumSize.width()) | 95 if (m_width < minimumSize.width()) |
96 m_width = minimumSize.width(); | 96 m_width = minimumSize.width(); |
97 if (m_height < minimumSize.height()) | 97 if (m_height < minimumSize.height()) |
98 m_height = minimumSize.height(); | 98 m_height = minimumSize.height(); |
99 } | 99 } |
100 | 100 |
101 int area() const | |
102 { | |
103 return m_width * m_height; | |
104 } | |
105 | |
106 // Return area in a uint64_t to avoid overflow. | 101 // Return area in a uint64_t to avoid overflow. |
107 uint64_t area_safe() const | 102 uint64_t area() const |
108 { | 103 { |
109 return static_cast<uint64_t>(width()) * height(); | 104 return static_cast<uint64_t>(width()) * height(); |
110 } | 105 } |
111 | 106 |
112 int diagonalLengthSquared() const | 107 int diagonalLengthSquared() const |
113 { | 108 { |
114 return m_width * m_width + m_height * m_height; | 109 return m_width * m_width + m_height * m_height; |
115 } | 110 } |
116 | 111 |
117 IntSize transposedSize() const | 112 IntSize transposedSize() const |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 163 } |
169 | 164 |
170 inline bool operator!=(const IntSize& a, const IntSize& b) | 165 inline bool operator!=(const IntSize& a, const IntSize& b) |
171 { | 166 { |
172 return a.width() != b.width() || a.height() != b.height(); | 167 return a.width() != b.width() || a.height() != b.height(); |
173 } | 168 } |
174 | 169 |
175 } // namespace WebCore | 170 } // namespace WebCore |
176 | 171 |
177 #endif // IntSize_h | 172 #endif // IntSize_h |
OLD | NEW |