OLD | NEW |
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 #include "ui/gfx/rect_base.h" | 5 #include "ui/gfx/rect_base.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 | 9 |
10 // This file provides the implementation for RectBaese template and | 10 // This file provides the implementation for RectBaese template and |
(...skipping 16 matching lines...) Expand all Loading... |
27 } // namespace | 27 } // namespace |
28 | 28 |
29 namespace gfx { | 29 namespace gfx { |
30 | 30 |
31 template<typename Class, | 31 template<typename Class, |
32 typename PointClass, | 32 typename PointClass, |
33 typename SizeClass, | 33 typename SizeClass, |
34 typename InsetsClass, | 34 typename InsetsClass, |
35 typename VectorClass, | 35 typename VectorClass, |
36 typename Type> | 36 typename Type> |
37 RectBase<Class, PointClass, SizeClass, InsetsClass, VectorClass, Type>:: | |
38 RectBase(const PointClass& origin, const SizeClass& size) | |
39 : origin_(origin), size_(size) { | |
40 } | |
41 | |
42 template<typename Class, | |
43 typename PointClass, | |
44 typename SizeClass, | |
45 typename InsetsClass, | |
46 typename VectorClass, | |
47 typename Type> | |
48 RectBase<Class, PointClass, SizeClass, InsetsClass, VectorClass, Type>:: | |
49 RectBase(const SizeClass& size) | |
50 : size_(size) { | |
51 } | |
52 | |
53 template<typename Class, | |
54 typename PointClass, | |
55 typename SizeClass, | |
56 typename InsetsClass, | |
57 typename VectorClass, | |
58 typename Type> | |
59 RectBase<Class, PointClass, SizeClass, InsetsClass, VectorClass, Type>:: | |
60 RectBase(const PointClass& origin) | |
61 : origin_(origin) { | |
62 } | |
63 | |
64 template<typename Class, | |
65 typename PointClass, | |
66 typename SizeClass, | |
67 typename InsetsClass, | |
68 typename VectorClass, | |
69 typename Type> | |
70 RectBase<Class, PointClass, SizeClass, InsetsClass, VectorClass, Type>:: | |
71 ~RectBase() {} | |
72 | |
73 template<typename Class, | |
74 typename PointClass, | |
75 typename SizeClass, | |
76 typename InsetsClass, | |
77 typename VectorClass, | |
78 typename Type> | |
79 void RectBase<Class, PointClass, SizeClass, InsetsClass, VectorClass, Type>:: | 37 void RectBase<Class, PointClass, SizeClass, InsetsClass, VectorClass, Type>:: |
80 SetRect(Type x, Type y, Type width, Type height) { | 38 SetRect(Type x, Type y, Type width, Type height) { |
81 origin_.SetPoint(x, y); | 39 origin_.SetPoint(x, y); |
82 set_width(width); | 40 set_width(width); |
83 set_height(height); | 41 set_height(height); |
84 } | 42 } |
85 | 43 |
86 template<typename Class, | 44 template<typename Class, |
87 typename PointClass, | 45 typename PointClass, |
88 typename SizeClass, | 46 typename SizeClass, |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 typename Type> | 307 typename Type> |
350 bool RectBase<Class, PointClass, SizeClass, InsetsClass, VectorClass, Type>:: | 308 bool RectBase<Class, PointClass, SizeClass, InsetsClass, VectorClass, Type>:: |
351 SharesEdgeWith(const Class& rect) const { | 309 SharesEdgeWith(const Class& rect) const { |
352 return (y() == rect.y() && height() == rect.height() && | 310 return (y() == rect.y() && height() == rect.height() && |
353 (x() == rect.right() || right() == rect.x())) || | 311 (x() == rect.right() || right() == rect.x())) || |
354 (x() == rect.x() && width() == rect.width() && | 312 (x() == rect.x() && width() == rect.width() && |
355 (y() == rect.bottom() || bottom() == rect.y())); | 313 (y() == rect.bottom() || bottom() == rect.y())); |
356 } | 314 } |
357 | 315 |
358 } // namespace gfx | 316 } // namespace gfx |
OLD | NEW |