OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 "window_manager/util.h" | 5 #include "window_manager/util.h" |
6 | 6 |
7 #include <cstdarg> | 7 #include <cstdarg> |
8 #include <cstdlib> | 8 #include <cstdlib> |
9 #include <ctime> | 9 #include <ctime> |
10 #include <string.h> | 10 #include <string.h> |
11 | 11 |
12 #include <iomanip> | 12 #include <iomanip> |
13 #include <sstream> | 13 #include <sstream> |
14 | 14 |
15 #include "chromeos/obsolete_logging.h" | 15 #include "chromeos/obsolete_logging.h" |
16 | 16 |
17 namespace chromeos { | 17 namespace window_manager { |
18 | 18 |
19 ByteMap::ByteMap(int width, int height) | 19 ByteMap::ByteMap(int width, int height) |
20 : width_(width), | 20 : width_(width), |
21 height_(height) { | 21 height_(height) { |
22 CHECK_GT(width, 0); | 22 CHECK_GT(width, 0); |
23 CHECK_GT(height, 0); | 23 CHECK_GT(height, 0); |
24 bytes_ = new unsigned char[width * height]; | 24 bytes_ = new unsigned char[width * height]; |
25 Clear(0); | 25 Clear(0); |
26 } | 26 } |
27 | 27 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 | 64 |
65 | 65 |
66 void FillTimeval(double time, struct timeval* tv) { | 66 void FillTimeval(double time, struct timeval* tv) { |
67 CHECK(tv); | 67 CHECK(tv); |
68 tv->tv_sec = static_cast<__time_t>(time); | 68 tv->tv_sec = static_cast<__time_t>(time); |
69 tv->tv_usec = | 69 tv->tv_usec = |
70 static_cast<__suseconds_t>(1000000 * (time - static_cast<int>(time))); | 70 static_cast<__suseconds_t>(1000000 * (time - static_cast<int>(time))); |
71 } | 71 } |
72 | 72 |
73 } // namespace chromeos | 73 } // namespace window_manager |
OLD | NEW |