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

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

Issue 2195903002: Add Double{Size, Point, Rect} pretty printers for logging and testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@geometryPrettyPrinters2
Patch Set: Remove unnecessary String casts Created 4 years, 3 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DoubleSize_h 5 #ifndef DoubleSize_h
6 #define DoubleSize_h 6 #define DoubleSize_h
7 7
8 #include "platform/geometry/FloatSize.h" 8 #include "platform/geometry/FloatSize.h"
9 #include "platform/geometry/IntSize.h" 9 #include "platform/geometry/IntSize.h"
10 #include "wtf/Allocator.h" 10 #include "wtf/Allocator.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 { 44 {
45 m_width = m_width * widthScale; 45 m_width = m_width * widthScale;
46 m_height = m_height * heightScale; 46 m_height = m_height * heightScale;
47 } 47 }
48 48
49 void scale(float scale) 49 void scale(float scale)
50 { 50 {
51 this->scale(scale, scale); 51 this->scale(scale, scale);
52 } 52 }
53 53
54 #ifndef NDEBUG
55 String toString() const; 54 String toString() const;
56 #endif
57 55
58 private: 56 private:
59 double m_width, m_height; 57 double m_width, m_height;
60 }; 58 };
61 59
62 inline DoubleSize& operator+=(DoubleSize& a, const DoubleSize& b) 60 inline DoubleSize& operator+=(DoubleSize& a, const DoubleSize& b)
63 { 61 {
64 a.setWidth(a.width() + b.width()); 62 a.setWidth(a.width() + b.width());
65 a.setHeight(a.height() + b.height()); 63 a.setHeight(a.height() + b.height());
66 return a; 64 return a;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 inline IntSize expandedIntSize(const DoubleSize& p) 104 inline IntSize expandedIntSize(const DoubleSize& p)
107 { 105 {
108 return IntSize(clampTo<int>(ceilf(p.width())), clampTo<int>(ceilf(p.height() ))); 106 return IntSize(clampTo<int>(ceilf(p.width())), clampTo<int>(ceilf(p.height() )));
109 } 107 }
110 108
111 inline FloatSize toFloatSize(const DoubleSize& p) 109 inline FloatSize toFloatSize(const DoubleSize& p)
112 { 110 {
113 return FloatSize(p.width(), p.height()); 111 return FloatSize(p.width(), p.height());
114 } 112 }
115 113
114 // Redeclared here to avoid ODR issues.
115 // See platform/testing/GeometryPrinters.h.
116 void PrintTo(const DoubleSize&, std::ostream*);
117
116 } // namespace blink 118 } // namespace blink
117 119
118 #endif // DoubleSize_h 120 #endif // DoubleSize_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698