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

Side by Side Diff: third_party/WebKit/Source/platform/geometry/FloatRect.h

Issue 1580363002: Implement FloatRect::squaredDistanceTo function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 { 162 {
163 m_location.setY(m_location.y() - dy); 163 m_location.setY(m_location.y() - dy);
164 m_size.setHeight(m_size.height() + dy + dy); 164 m_size.setHeight(m_size.height() + dy + dy);
165 } 165 }
166 void inflate(float d) { inflateX(d); inflateY(d); } 166 void inflate(float d) { inflateX(d); inflateY(d); }
167 void scale(float s) { scale(s, s); } 167 void scale(float s) { scale(s, s); }
168 void scale(float sx, float sy); 168 void scale(float sx, float sy);
169 169
170 FloatRect transposedRect() const { return FloatRect(m_location.transposedPoi nt(), m_size.transposedSize()); } 170 FloatRect transposedRect() const { return FloatRect(m_location.transposedPoi nt(), m_size.transposedSize()); }
171 171
172 float squaredDistanceTo(const FloatPoint&) const;
173
172 #if OS(MACOSX) 174 #if OS(MACOSX)
173 FloatRect(const CGRect&); 175 FloatRect(const CGRect&);
174 operator CGRect() const; 176 operator CGRect() const;
175 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) 177 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
176 FloatRect(const NSRect&); 178 FloatRect(const NSRect&);
177 operator NSRect() const; 179 operator NSRect() const;
178 #endif 180 #endif
179 #endif 181 #endif
180 182
181 operator SkRect() const { return SkRect::MakeXYWH(x(), y(), width(), height( )); } 183 operator SkRect() const { return SkRect::MakeXYWH(x(), y(), width(), height( )); }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // Map supplied rect from srcRect to an equivalent rect in destRect. 251 // Map supplied rect from srcRect to an equivalent rect in destRect.
250 PLATFORM_EXPORT FloatRect mapRect(const FloatRect&, const FloatRect& srcRect, co nst FloatRect& destRect); 252 PLATFORM_EXPORT FloatRect mapRect(const FloatRect&, const FloatRect& srcRect, co nst FloatRect& destRect);
251 253
252 // Redeclared here to avoid ODR issues. 254 // Redeclared here to avoid ODR issues.
253 // See platform/testing/GeometryPrinters.h. 255 // See platform/testing/GeometryPrinters.h.
254 void PrintTo(const FloatRect&, std::ostream*); 256 void PrintTo(const FloatRect&, std::ostream*);
255 257
256 } // namespace blink 258 } // namespace blink
257 259
258 #endif 260 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/blink_platform.gypi ('k') | third_party/WebKit/Source/platform/geometry/FloatRect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698