OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/gfx/size_base.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "base/stringprintf.h" | |
9 | |
10 // This file provides the implementation for SizeBaese template and | |
11 // used to instantiate the base class for Size and SizeF classes. | |
12 #if !defined(UI_IMPLEMENTATION) | |
13 #error "This file is intended for UI implementation only" | |
14 #endif | |
15 | |
16 namespace gfx { | |
17 | |
18 template<typename Class, typename Type> | |
19 SizeBase<Class, Type>::SizeBase(Type width, Type height) { | |
20 set_width(width); | |
21 set_height(height); | |
22 } | |
23 | |
24 template<typename Class, typename Type> | |
25 SizeBase<Class, Type>::~SizeBase() {} | |
26 | |
27 template<typename Class, typename Type> | |
28 void SizeBase<Class, Type>::set_width(Type width) { | |
29 if (width < 0) { | |
30 NOTREACHED() << "negative width:" << width; | |
31 width = 0; | |
32 } | |
33 width_ = width; | |
34 } | |
35 | |
36 template<typename Class, typename Type> | |
37 void SizeBase<Class, Type>::set_height(Type height) { | |
38 if (height < 0) { | |
39 NOTREACHED() << "negative height:" << height; | |
40 height = 0; | |
41 } | |
42 height_ = height; | |
43 } | |
44 | |
45 } // namespace gfx | |
OLD | NEW |