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

Side by Side Diff: ui/gfx/geometry/rect.h

Issue 503953002: Do not use extern template declarations for RectBase etc for NaCl builds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 6 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
« no previous file with comments | « ui/gfx/geometry/point_f.h ('k') | ui/gfx/geometry/rect_f.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Defines a simple integer rectangle class. The containment semantics 5 // Defines a simple integer rectangle class. The containment semantics
6 // are array-like; that is, the coordinate (x, y) is considered to be 6 // are array-like; that is, the coordinate (x, y) is considered to be
7 // contained by the rectangle, but the coordinate (x + width, y) is not. 7 // contained by the rectangle, but the coordinate (x + width, y) is not.
8 // The class will happily let you create malformed rectangles (that is, 8 // The class will happily let you create malformed rectangles (that is,
9 // rectangles with negative width and/or height), but there will be assertions 9 // rectangles with negative width and/or height), but there will be assertions
10 // in the operations (such as Contains()) to complain in this case. 10 // in the operations (such as Contains()) to complain in this case.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 int y = std::ceil(rect.y() * y_scale); 124 int y = std::ceil(rect.y() * y_scale);
125 int r = rect.width() == 0 ? x : std::floor(rect.right() * x_scale); 125 int r = rect.width() == 0 ? x : std::floor(rect.right() * x_scale);
126 int b = rect.height() == 0 ? y : std::floor(rect.bottom() * y_scale); 126 int b = rect.height() == 0 ? y : std::floor(rect.bottom() * y_scale);
127 return Rect(x, y, r - x, b - y); 127 return Rect(x, y, r - x, b - y);
128 } 128 }
129 129
130 inline Rect ScaleToEnclosedRect(const Rect& rect, float scale) { 130 inline Rect ScaleToEnclosedRect(const Rect& rect, float scale) {
131 return ScaleToEnclosedRect(rect, scale, scale); 131 return ScaleToEnclosedRect(rect, scale, scale);
132 } 132 }
133 133
134 #if !defined(COMPILER_MSVC) 134 #if !defined(COMPILER_MSVC) && !defined(__native_client__)
135 extern template class RectBase<Rect, Point, Size, Insets, Vector2d, int>; 135 extern template class RectBase<Rect, Point, Size, Insets, Vector2d, int>;
136 #endif 136 #endif
137 137
138 // This is declared here for use in gtest-based unit tests but is defined in 138 // This is declared here for use in gtest-based unit tests but is defined in
139 // the gfx_test_support target. Depend on that to use this in your unit test. 139 // the gfx_test_support target. Depend on that to use this in your unit test.
140 // This should not be used in production code - call ToString() instead. 140 // This should not be used in production code - call ToString() instead.
141 void PrintTo(const Rect& rect, ::std::ostream* os); 141 void PrintTo(const Rect& rect, ::std::ostream* os);
142 142
143 } // namespace gfx 143 } // namespace gfx
144 144
145 #endif // UI_GFX_GEOMETRY_RECT_H_ 145 #endif // UI_GFX_GEOMETRY_RECT_H_
OLDNEW
« no previous file with comments | « ui/gfx/geometry/point_f.h ('k') | ui/gfx/geometry/rect_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698