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

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

Issue 2191233002: Add platform/geometry pretty printers for logging and testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fewer redundant spaces, more toString tests Created 4 years, 4 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) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 #if OS(MACOSX) 94 #if OS(MACOSX)
95 explicit IntPoint(const CGPoint&); // don't do this implicitly since it's lo ssy 95 explicit IntPoint(const CGPoint&); // don't do this implicitly since it's lo ssy
96 operator CGPoint() const; 96 operator CGPoint() const;
97 97
98 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) 98 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
99 explicit IntPoint(const NSPoint&); // don't do this implicitly since it's lo ssy 99 explicit IntPoint(const NSPoint&); // don't do this implicitly since it's lo ssy
100 operator NSPoint() const; 100 operator NSPoint() const;
101 #endif 101 #endif
102 #endif 102 #endif
103 103
104 #ifndef NDEBUG
105 String toString() const; 104 String toString() const;
106 #endif
107 105
108 private: 106 private:
109 int m_x, m_y; 107 int m_x, m_y;
110 }; 108 };
111 109
112 inline IntPoint& operator+=(IntPoint& a, const IntSize& b) 110 inline IntPoint& operator+=(IntPoint& a, const IntSize& b)
113 { 111 {
114 a.move(b.width(), b.height()); 112 a.move(b.width(), b.height());
115 return a; 113 return a;
116 } 114 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 inline IntSize toIntSize(const IntPoint& a) 157 inline IntSize toIntSize(const IntPoint& a)
160 { 158 {
161 return IntSize(a.x(), a.y()); 159 return IntSize(a.x(), a.y());
162 } 160 }
163 161
164 inline int IntPoint::distanceSquaredToPoint(const IntPoint& point) const 162 inline int IntPoint::distanceSquaredToPoint(const IntPoint& point) const
165 { 163 {
166 return ((*this) - point).diagonalLengthSquared(); 164 return ((*this) - point).diagonalLengthSquared();
167 } 165 }
168 166
167 // Redeclared here to avoid ODR issues.
168 // See platform/testing/GeometryPrinters.h.
169 void PrintTo(const IntPoint&, std::ostream*);
170
169 } // namespace blink 171 } // namespace blink
170 172
171 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::IntPoint); 173 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::IntPoint);
172 174
173 #endif // IntPoint_h 175 #endif // IntPoint_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/geometry/FloatSize.cpp ('k') | third_party/WebKit/Source/platform/geometry/IntPoint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698