| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 FloatRect unionRect(const Vector<FloatRect>& rects) { | 177 FloatRect unionRect(const Vector<FloatRect>& rects) { |
| 178 FloatRect result; | 178 FloatRect result; |
| 179 | 179 |
| 180 size_t count = rects.size(); | 180 size_t count = rects.size(); |
| 181 for (size_t i = 0; i < count; ++i) | 181 for (size_t i = 0; i < count; ++i) |
| 182 result.unite(rects[i]); | 182 result.unite(rects[i]); |
| 183 | 183 |
| 184 return result; | 184 return result; |
| 185 } | 185 } |
| 186 | 186 |
| 187 IntRect enclosingIntRect(const FloatRect& rect) { | |
| 188 IntPoint location = flooredIntPoint(rect.minXMinYCorner()); | |
| 189 IntPoint maxPoint = ceiledIntPoint(rect.maxXMaxYCorner()); | |
| 190 | |
| 191 return IntRect(location, maxPoint - location); | |
| 192 } | |
| 193 | |
| 194 IntRect enclosedIntRect(const FloatRect& rect) { | 187 IntRect enclosedIntRect(const FloatRect& rect) { |
| 195 IntPoint location = ceiledIntPoint(rect.minXMinYCorner()); | 188 IntPoint location = ceiledIntPoint(rect.minXMinYCorner()); |
| 196 IntPoint maxPoint = flooredIntPoint(rect.maxXMaxYCorner()); | 189 IntPoint maxPoint = flooredIntPoint(rect.maxXMaxYCorner()); |
| 197 IntSize size = maxPoint - location; | 190 IntSize size = maxPoint - location; |
| 198 size.clampNegativeToZero(); | 191 size.clampNegativeToZero(); |
| 199 | 192 |
| 200 return IntRect(location, size); | 193 return IntRect(location, size); |
| 201 } | 194 } |
| 202 | 195 |
| 203 IntRect roundedIntRect(const FloatRect& rect) { | 196 IntRect roundedIntRect(const FloatRect& rect) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 216 destRect.y() + (r.y() - srcRect.y()) * heightScale, | 209 destRect.y() + (r.y() - srcRect.y()) * heightScale, |
| 217 r.width() * widthScale, r.height() * heightScale); | 210 r.width() * widthScale, r.height() * heightScale); |
| 218 } | 211 } |
| 219 | 212 |
| 220 String FloatRect::toString() const { | 213 String FloatRect::toString() const { |
| 221 return String::format("%s %s", location().toString().ascii().data(), | 214 return String::format("%s %s", location().toString().ascii().data(), |
| 222 size().toString().ascii().data()); | 215 size().toString().ascii().data()); |
| 223 } | 216 } |
| 224 | 217 |
| 225 } // namespace blink | 218 } // namespace blink |
| OLD | NEW |