Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Side by Side Diff: Source/platform/geometry/FloatRect.cpp

Issue 328163003: Inline FloatRect::operator SkRect. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/platform/geometry/FloatRect.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « Source/platform/geometry/FloatRect.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698