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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 void FloatRect::fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const Fl
oatPoint& p2, const FloatPoint& p3) | 218 void FloatRect::fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const Fl
oatPoint& p2, const FloatPoint& p3) |
219 { | 219 { |
220 float left = min4(p0.x(), p1.x(), p2.x(), p3.x()); | 220 float left = min4(p0.x(), p1.x(), p2.x(), p3.x()); |
221 float top = min4(p0.y(), p1.y(), p2.y(), p3.y()); | 221 float top = min4(p0.y(), p1.y(), p2.y(), p3.y()); |
222 float right = max4(p0.x(), p1.x(), p2.x(), p3.x()); | 222 float right = max4(p0.x(), p1.x(), p2.x(), p3.x()); |
223 float bottom = max4(p0.y(), p1.y(), p2.y(), p3.y()); | 223 float bottom = max4(p0.y(), p1.y(), p2.y(), p3.y()); |
224 | 224 |
225 setLocationAndSizeFromEdges(left, top, right, bottom); | 225 setLocationAndSizeFromEdges(left, top, right, bottom); |
226 } | 226 } |
227 | 227 |
228 FloatRect::operator SkRect() const | |
229 { | |
230 SkRect rect = { x(), y(), maxX(), maxY() }; | |
231 return rect; | |
232 } | |
233 | |
234 IntRect enclosingIntRect(const FloatRect& rect) | 228 IntRect enclosingIntRect(const FloatRect& rect) |
235 { | 229 { |
236 IntPoint location = flooredIntPoint(rect.minXMinYCorner()); | 230 IntPoint location = flooredIntPoint(rect.minXMinYCorner()); |
237 IntPoint maxPoint = ceiledIntPoint(rect.maxXMaxYCorner()); | 231 IntPoint maxPoint = ceiledIntPoint(rect.maxXMaxYCorner()); |
238 | 232 |
239 return IntRect(location, maxPoint - location); | 233 return IntRect(location, maxPoint - location); |
240 } | 234 } |
241 | 235 |
242 IntRect enclosedIntRect(const FloatRect& rect) | 236 IntRect enclosedIntRect(const FloatRect& rect) |
243 { | 237 { |
(...skipping 16 matching lines...) Expand all Loading... |
260 return FloatRect(); | 254 return FloatRect(); |
261 | 255 |
262 float widthScale = destRect.width() / srcRect.width(); | 256 float widthScale = destRect.width() / srcRect.width(); |
263 float heightScale = destRect.height() / srcRect.height(); | 257 float heightScale = destRect.height() / srcRect.height(); |
264 return FloatRect(destRect.x() + (r.x() - srcRect.x()) * widthScale, | 258 return FloatRect(destRect.x() + (r.x() - srcRect.x()) * widthScale, |
265 destRect.y() + (r.y() - srcRect.y()) * heightScale, | 259 destRect.y() + (r.y() - srcRect.y()) * heightScale, |
266 r.width() * widthScale, r.height() * heightScale); | 260 r.width() * widthScale, r.height() * heightScale); |
267 } | 261 } |
268 | 262 |
269 } | 263 } |
OLD | NEW |