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

Side by Side Diff: third_party/WebKit/Source/platform/geometry/FloatSize.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) 2003, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2005 Nokia. All rights reserved. 3 * Copyright (C) 2005 Nokia. All rights reserved.
4 * 2008 Eric Seidel <eric@webkit.org> 4 * 2008 Eric Seidel <eric@webkit.org>
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 explicit FloatSize(const CGSize&); // don't do this implicitly since it's lo ssy 128 explicit FloatSize(const CGSize&); // don't do this implicitly since it's lo ssy
129 operator CGSize() const; 129 operator CGSize() const;
130 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) 130 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
131 explicit FloatSize(const NSSize &); // don't do this implicitly since it's l ossy 131 explicit FloatSize(const NSSize &); // don't do this implicitly since it's l ossy
132 operator NSSize() const; 132 operator NSSize() const;
133 #endif 133 #endif
134 #endif 134 #endif
135 135
136 operator SkSize() const { return SkSize::Make(m_width, m_height); } 136 operator SkSize() const { return SkSize::Make(m_width, m_height); }
137 137
138 #ifndef NDEBUG
139 String toString() const;
140 #endif
141
142 private: 138 private:
143 float m_width, m_height; 139 float m_width, m_height;
144 }; 140 };
145 141
146 inline FloatSize& operator+=(FloatSize& a, const FloatSize& b) 142 inline FloatSize& operator+=(FloatSize& a, const FloatSize& b)
147 { 143 {
148 a.setWidth(a.width() + b.width()); 144 a.setWidth(a.width() + b.width());
149 a.setHeight(a.height() + b.height()); 145 a.setHeight(a.height() + b.height());
150 return a; 146 return a;
151 } 147 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 inline IntSize expandedIntSize(const FloatSize& p) 201 inline IntSize expandedIntSize(const FloatSize& p)
206 { 202 {
207 return IntSize(clampTo<int>(ceilf(p.width())), clampTo<int>(ceilf(p.height() ))); 203 return IntSize(clampTo<int>(ceilf(p.width())), clampTo<int>(ceilf(p.height() )));
208 } 204 }
209 205
210 inline IntPoint flooredIntPoint(const FloatSize& p) 206 inline IntPoint flooredIntPoint(const FloatSize& p)
211 { 207 {
212 return IntPoint(clampTo<int>(floorf(p.width())), clampTo<int>(floorf(p.heigh t()))); 208 return IntPoint(clampTo<int>(floorf(p.width())), clampTo<int>(floorf(p.heigh t())));
213 } 209 }
214 210
215 // Redeclared here to avoid ODR issues. 211 PLATFORM_EXPORT std::ostream& operator<<(std::ostream&, const FloatSize&);
216 // See platform/testing/GeometryPrinters.h.
217 void PrintTo(const FloatSize&, std::ostream*);
218 212
219 } // namespace blink 213 } // namespace blink
220 214
221 #endif // FloatSize_h 215 #endif // FloatSize_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698