OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2005 Nokia. All rights reserved. | 3 * Copyright (C) 2005 Nokia. 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 { | 190 { |
191 FloatRect result; | 191 FloatRect result; |
192 | 192 |
193 size_t count = rects.size(); | 193 size_t count = rects.size(); |
194 for (size_t i = 0; i < count; ++i) | 194 for (size_t i = 0; i < count; ++i) |
195 result.unite(rects[i]); | 195 result.unite(rects[i]); |
196 | 196 |
197 return result; | 197 return result; |
198 } | 198 } |
199 | 199 |
200 #ifndef NDEBUG | |
201 void FloatRect::show() const | |
202 { | |
203 LayoutRect(*this).show(); | |
204 } | |
205 | |
206 String FloatRect::toString() const | |
207 { | |
208 return String::format("%s %s", location().toString().ascii().data(), size().
toString().ascii().data()); | |
209 } | |
210 #endif | |
211 | |
212 IntRect enclosingIntRect(const FloatRect& rect) | 200 IntRect enclosingIntRect(const FloatRect& rect) |
213 { | 201 { |
214 IntPoint location = flooredIntPoint(rect.minXMinYCorner()); | 202 IntPoint location = flooredIntPoint(rect.minXMinYCorner()); |
215 IntPoint maxPoint = ceiledIntPoint(rect.maxXMaxYCorner()); | 203 IntPoint maxPoint = ceiledIntPoint(rect.maxXMaxYCorner()); |
216 | 204 |
217 return IntRect(location, maxPoint - location); | 205 return IntRect(location, maxPoint - location); |
218 } | 206 } |
219 | 207 |
220 IntRect enclosedIntRect(const FloatRect& rect) | 208 IntRect enclosedIntRect(const FloatRect& rect) |
221 { | 209 { |
(...skipping 15 matching lines...) Expand all Loading... |
237 if (!srcRect.width() || !srcRect.height()) | 225 if (!srcRect.width() || !srcRect.height()) |
238 return FloatRect(); | 226 return FloatRect(); |
239 | 227 |
240 float widthScale = destRect.width() / srcRect.width(); | 228 float widthScale = destRect.width() / srcRect.width(); |
241 float heightScale = destRect.height() / srcRect.height(); | 229 float heightScale = destRect.height() / srcRect.height(); |
242 return FloatRect(destRect.x() + (r.x() - srcRect.x()) * widthScale, | 230 return FloatRect(destRect.x() + (r.x() - srcRect.x()) * widthScale, |
243 destRect.y() + (r.y() - srcRect.y()) * heightScale, | 231 destRect.y() + (r.y() - srcRect.y()) * heightScale, |
244 r.width() * widthScale, r.height() * heightScale); | 232 r.width() * widthScale, r.height() * heightScale); |
245 } | 233 } |
246 | 234 |
| 235 String FloatRect::toString() const |
| 236 { |
| 237 return String::format("%s %s", |
| 238 location().toString().ascii().data(), |
| 239 size().toString().ascii().data()); |
| 240 } |
| 241 |
247 } // namespace blink | 242 } // namespace blink |
OLD | NEW |