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

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: Adjust tests to work around uninteresting cross-platform differences 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 14 matching lines...) Expand all
25 */ 25 */
26 26
27 #ifndef IntPoint_h 27 #ifndef IntPoint_h
28 #define IntPoint_h 28 #define IntPoint_h
29 29
30 #include "platform/geometry/IntSize.h" 30 #include "platform/geometry/IntSize.h"
31 #include "wtf/Allocator.h" 31 #include "wtf/Allocator.h"
32 #include "wtf/Forward.h" 32 #include "wtf/Forward.h"
33 #include "wtf/MathExtras.h" 33 #include "wtf/MathExtras.h"
34 #include "wtf/VectorTraits.h" 34 #include "wtf/VectorTraits.h"
35 #include <iosfwd>
35 36
36 #if OS(MACOSX) 37 #if OS(MACOSX)
37 typedef struct CGPoint CGPoint; 38 typedef struct CGPoint CGPoint;
38 39
39 #ifdef __OBJC__ 40 #ifdef __OBJC__
40 #import <Foundation/Foundation.h> 41 #import <Foundation/Foundation.h>
41 #endif 42 #endif
42 #endif 43 #endif
43 44
44 namespace blink { 45 namespace blink {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 #if OS(MACOSX) 95 #if OS(MACOSX)
95 explicit IntPoint(const CGPoint&); // don't do this implicitly since it's lo ssy 96 explicit IntPoint(const CGPoint&); // don't do this implicitly since it's lo ssy
96 operator CGPoint() const; 97 operator CGPoint() const;
97 98
98 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) 99 #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 100 explicit IntPoint(const NSPoint&); // don't do this implicitly since it's lo ssy
100 operator NSPoint() const; 101 operator NSPoint() const;
101 #endif 102 #endif
102 #endif 103 #endif
103 104
104 #ifndef NDEBUG
105 String toString() const;
106 #endif
107
108 private: 105 private:
109 int m_x, m_y; 106 int m_x, m_y;
110 }; 107 };
111 108
112 inline IntPoint& operator+=(IntPoint& a, const IntSize& b) 109 inline IntPoint& operator+=(IntPoint& a, const IntSize& b)
113 { 110 {
114 a.move(b.width(), b.height()); 111 a.move(b.width(), b.height());
115 return a; 112 return a;
116 } 113 }
117 114
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 inline IntSize toIntSize(const IntPoint& a) 156 inline IntSize toIntSize(const IntPoint& a)
160 { 157 {
161 return IntSize(a.x(), a.y()); 158 return IntSize(a.x(), a.y());
162 } 159 }
163 160
164 inline int IntPoint::distanceSquaredToPoint(const IntPoint& point) const 161 inline int IntPoint::distanceSquaredToPoint(const IntPoint& point) const
165 { 162 {
166 return ((*this) - point).diagonalLengthSquared(); 163 return ((*this) - point).diagonalLengthSquared();
167 } 164 }
168 165
166 PLATFORM_EXPORT std::ostream& operator<<(std::ostream&, const IntPoint&);
167
169 } // namespace blink 168 } // namespace blink
170 169
171 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::IntPoint); 170 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::IntPoint);
172 171
173 #endif // IntPoint_h 172 #endif // IntPoint_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698