[email protected] | a101cf3 | 2012-01-14 00:34:23 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | c3af26f33 | 2010-10-06 22:46:00 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef REMOTING_BASE_UTIL_H_ | ||||
6 | #define REMOTING_BASE_UTIL_H_ | ||||
7 | |||||
avi | 5a080f01 | 2015-12-22 23:15:43 | [diff] [blame] | 8 | #include <stddef.h> |
sergeyu | 80f771b | 2015-08-21 23:37:02 | [diff] [blame] | 9 | #include <stdint.h> |
[email protected] | 82156e8 | 2011-12-20 07:09:01 | [diff] [blame] | 10 | #include <string> |
11 | |||||
[email protected] | e59d659 | 2013-09-25 22:16:21 | [diff] [blame] | 12 | #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
[email protected] | c3af26f33 | 2010-10-06 22:46:00 | [diff] [blame] | 13 | |
14 | namespace remoting { | ||||
15 | |||||
[email protected] | a101cf3 | 2012-01-14 00:34:23 | [diff] [blame] | 16 | // Return a string that contains the current date formatted as 'MMDD/HHMMSS:'. |
[email protected] | 82d105e | 2011-08-04 03:19:35 | [diff] [blame] | 17 | std::string GetTimestampString(); |
18 | |||||
[email protected] | 47379e9 | 2011-07-26 15:33:15 | [diff] [blame] | 19 | int RoundToTwosMultiple(int x); |
20 | |||||
21 | // Align the sides of the rectangle to multiples of 2 (expanding outwards). | ||||
[email protected] | e59d659 | 2013-09-25 22:16:21 | [diff] [blame] | 22 | webrtc::DesktopRect AlignRect(const webrtc::DesktopRect& rect); |
[email protected] | 47379e9 | 2011-07-26 15:33:15 | [diff] [blame] | 23 | |
[email protected] | 420a5e4 | 2012-12-18 21:42:12 | [diff] [blame] | 24 | // Copy content of a rectangle in a RGB32 image. |
sergeyu | 80f771b | 2015-08-21 23:37:02 | [diff] [blame] | 25 | void CopyRGB32Rect(const uint8_t* source_buffer, |
[email protected] | b3ca1f5 | 2012-02-09 19:00:51 | [diff] [blame] | 26 | int source_stride, |
[email protected] | e59d659 | 2013-09-25 22:16:21 | [diff] [blame] | 27 | const webrtc::DesktopRect& source_buffer_rect, |
sergeyu | 80f771b | 2015-08-21 23:37:02 | [diff] [blame] | 28 | uint8_t* dest_buffer, |
[email protected] | b3ca1f5 | 2012-02-09 19:00:51 | [diff] [blame] | 29 | int dest_stride, |
[email protected] | e59d659 | 2013-09-25 22:16:21 | [diff] [blame] | 30 | const webrtc::DesktopRect& dest_buffer_rect, |
31 | const webrtc::DesktopRect& dest_rect); | ||||
[email protected] | b3ca1f5 | 2012-02-09 19:00:51 | [diff] [blame] | 32 | |
[email protected] | a93c8c84 | 2012-06-02 22:17:03 | [diff] [blame] | 33 | // Replaces every occurrence of "\n" in a string by "\r\n". |
34 | std::string ReplaceLfByCrLf(const std::string& in); | ||||
35 | |||||
36 | // Replaces every occurrence of "\r\n" in a string by "\n". | ||||
37 | std::string ReplaceCrLfByLf(const std::string& in); | ||||
38 | |||||
[email protected] | 31014af | 2012-11-30 04:04:57 | [diff] [blame] | 39 | // Checks if the given string is a valid UTF-8 string. |
40 | bool StringIsUtf8(const char* data, size_t length); | ||||
41 | |||||
[email protected] | e59d659 | 2013-09-25 22:16:21 | [diff] [blame] | 42 | bool DoesRectContain(const webrtc::DesktopRect& a, |
43 | const webrtc::DesktopRect& b); | ||||
44 | |||||
[email protected] | c3af26f33 | 2010-10-06 22:46:00 | [diff] [blame] | 45 | } // namespace remoting |
46 | |||||
47 | #endif // REMOTING_BASE_UTIL_H_ |