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

Side by Side Diff: third_party/WebKit/Source/platform/geometry/FloatRoundedRect.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) 2013 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void scaleAndFloor(float factor); 79 void scaleAndFloor(float factor);
80 80
81 void expand(float topWidth, float bottomWidth, float leftWidth, float ri ghtWidth); 81 void expand(float topWidth, float bottomWidth, float leftWidth, float ri ghtWidth);
82 void expand(float size) { expand(size, size, size, size); } 82 void expand(float size) { expand(size, size, size, size); }
83 83
84 void shrink(float topWidth, float bottomWidth, float leftWidth, float ri ghtWidth); 84 void shrink(float topWidth, float bottomWidth, float leftWidth, float ri ghtWidth);
85 void shrink(float size) { shrink(size, size, size, size); } 85 void shrink(float size) { shrink(size, size, size, size); }
86 86
87 void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool inc ludeLogicalLeftEdge, bool includeLogicalRightEdge); 87 void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool inc ludeLogicalLeftEdge, bool includeLogicalRightEdge);
88 88
89 #ifndef NDEBUG
90 // Prints debugging information.
91 void show() const;
92 #endif
93
94 private: 89 private:
95 FloatSize m_topLeft; 90 FloatSize m_topLeft;
96 FloatSize m_topRight; 91 FloatSize m_topRight;
97 FloatSize m_bottomLeft; 92 FloatSize m_bottomLeft;
98 FloatSize m_bottomRight; 93 FloatSize m_bottomRight;
99 }; 94 };
100 95
101 FloatRoundedRect() { } 96 FloatRoundedRect() { }
102 explicit FloatRoundedRect(const FloatRect&, const Radii& = Radii()); 97 explicit FloatRoundedRect(const FloatRect&, const Radii& = Radii());
103 FloatRoundedRect(float x, float y, float width, float height); 98 FloatRoundedRect(float x, float y, float width, float height);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 140
146 void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool include LogicalLeftEdge, bool includeLogicalRightEdge); 141 void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool include LogicalLeftEdge, bool includeLogicalRightEdge);
147 142
148 // Tests whether the quad intersects any part of this rounded rectangle. 143 // Tests whether the quad intersects any part of this rounded rectangle.
149 // This only works for convex quads. 144 // This only works for convex quads.
150 bool intersectsQuad(const FloatQuad&) const; 145 bool intersectsQuad(const FloatQuad&) const;
151 146
152 void adjustRadii(); 147 void adjustRadii();
153 bool isRenderable() const; 148 bool isRenderable() const;
154 149
155 #ifndef NDEBUG
156 // Prints debugging information.
157 void show() const;
158 #endif
159
160 // Constrains the radii to be no more than the size of rect(); radii outside of this range are not 150 // Constrains the radii to be no more than the size of rect(); radii outside of this range are not
161 // defined. 151 // defined.
162 // In addition, the radii of the corners are floored to the nearest integer. 152 // In addition, the radii of the corners are floored to the nearest integer.
163 // FIXME: the flooring should not be necessary. At the moment it causes back ground bleed in some cases. 153 // FIXME: the flooring should not be necessary. At the moment it causes back ground bleed in some cases.
164 // FIXME: this code is almost the same as adjustRadii()/isRenderable(). Get rid of one of them. 154 // FIXME: this code is almost the same as adjustRadii()/isRenderable(). Get rid of one of them.
165 void constrainRadii(); 155 void constrainRadii();
166 156
167 operator SkRRect() const; 157 operator SkRRect() const;
168 158
169 private: 159 private:
(...skipping 30 matching lines...) Expand all
200 { 190 {
201 return !(a == b); 191 return !(a == b);
202 } 192 }
203 193
204 194
205 inline bool operator==(const FloatRoundedRect& a, const FloatRoundedRect& b) 195 inline bool operator==(const FloatRoundedRect& a, const FloatRoundedRect& b)
206 { 196 {
207 return a.rect() == b.rect() && a.getRadii() == b.getRadii(); 197 return a.rect() == b.rect() && a.getRadii() == b.getRadii();
208 } 198 }
209 199
210 // Redeclared here to avoid ODR issues. 200 PLATFORM_EXPORT std::ostream& operator<<(std::ostream&, const FloatRoundedRect:: Radii&);
211 // See platform/testing/GeometryPrinters.h. 201 PLATFORM_EXPORT std::ostream& operator<<(std::ostream&, const FloatRoundedRect&) ;
212 void PrintTo(const FloatRoundedRect&, std::ostream*);
213 void PrintTo(const FloatRoundedRect::Radii&, std::ostream*);
214 202
215 } // namespace blink 203 } // namespace blink
216 204
217 #endif // FloatRoundedRect_h 205 #endif // FloatRoundedRect_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698