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 "remoting/base/util.h" | 5 #include "remoting/base/util.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
13 #include "media/base/yuv_convert.h" | 13 #include "media/base/yuv_convert.h" |
14 #include "third_party/skia/include/core/SkRegion.h" | 14 #include "third_party/skia/include/core/SkRegion.h" |
15 | 15 |
16 using media::VideoFrame; | 16 using media::VideoFrame; |
17 | 17 |
18 namespace remoting { | 18 namespace remoting { |
19 | 19 |
20 enum { kBytesPerPixelRGB32 = 4 }; | 20 enum { kBytesPerPixelRGB32 = 4 }; |
21 | 21 |
22 // Do not write LOG messages in this routine since it is called from within | 22 // Do not write LOG messages in this routine since it is called from within |
23 // our LOG message handler. Bad things will happen. | 23 // our LOG message handler. Bad things will happen. |
24 std::string GetTimestampString() { | 24 std::string GetTimestampString() { |
25 base::Time t = base::Time::NowFromSystemTime(); | 25 base::Time t = base::Time::NowFromSystemTime(); |
26 base::Time::Exploded tex; | 26 base::Time::Exploded tex; |
27 t.LocalExplode(&tex); | 27 t.LocalExplode(&tex); |
28 return StringPrintf("%02d%02d/%02d%02d%02d:", | 28 return base::StringPrintf("%02d%02d/%02d%02d%02d:", |
29 tex.month, tex.day_of_month, | 29 tex.month, tex.day_of_month, |
30 tex.hour, tex.minute, tex.second); | 30 tex.hour, tex.minute, tex.second); |
31 } | 31 } |
32 | 32 |
33 int CalculateRGBOffset(int x, int y, int stride) { | 33 int CalculateRGBOffset(int x, int y, int stride) { |
34 return stride * y + kBytesPerPixelRGB32 * x; | 34 return stride * y + kBytesPerPixelRGB32 * x; |
35 } | 35 } |
36 | 36 |
37 int CalculateYOffset(int x, int y, int stride) { | 37 int CalculateYOffset(int x, int y, int stride) { |
38 DCHECK(((x & 1) == 0) && ((y & 1) == 0)); | 38 DCHECK(((x & 1) == 0) && ((y & 1) == 0)); |
39 return stride * y + x; | 39 return stride * y + x; |
40 } | 40 } |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 } | 305 } |
306 | 306 |
307 ++ptr; | 307 ++ptr; |
308 } | 308 } |
309 } | 309 } |
310 | 310 |
311 return true; | 311 return true; |
312 } | 312 } |
313 | 313 |
314 } // namespace remoting | 314 } // namespace remoting |
OLD | NEW |