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 #ifndef REMOTING_BASE_UTIL_H_ | 5 #ifndef REMOTING_BASE_UTIL_H_ |
6 #define REMOTING_BASE_UTIL_H_ | 6 #define REMOTING_BASE_UTIL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <string> | 10 #include <string> |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // Copy content of a rectangle in a RGB32 image. | 24 // Copy content of a rectangle in a RGB32 image. |
25 void CopyRGB32Rect(const uint8_t* source_buffer, | 25 void CopyRGB32Rect(const uint8_t* source_buffer, |
26 int source_stride, | 26 int source_stride, |
27 const webrtc::DesktopRect& source_buffer_rect, | 27 const webrtc::DesktopRect& source_buffer_rect, |
28 uint8_t* dest_buffer, | 28 uint8_t* dest_buffer, |
29 int dest_stride, | 29 int dest_stride, |
30 const webrtc::DesktopRect& dest_buffer_rect, | 30 const webrtc::DesktopRect& dest_buffer_rect, |
31 const webrtc::DesktopRect& dest_rect); | 31 const webrtc::DesktopRect& dest_rect); |
32 | 32 |
| 33 // Copy consecutive block of RGBA32 or BGRA32 image and meanwhile swaps the R |
| 34 // and B channel. |length| should be multiple of 4. |
| 35 void CopyAndSwapRB(const uint8_t* source, uint8_t* dest, int length); |
| 36 |
33 // Replaces every occurrence of "\n" in a string by "\r\n". | 37 // Replaces every occurrence of "\n" in a string by "\r\n". |
34 std::string ReplaceLfByCrLf(const std::string& in); | 38 std::string ReplaceLfByCrLf(const std::string& in); |
35 | 39 |
36 // Replaces every occurrence of "\r\n" in a string by "\n". | 40 // Replaces every occurrence of "\r\n" in a string by "\n". |
37 std::string ReplaceCrLfByLf(const std::string& in); | 41 std::string ReplaceCrLfByLf(const std::string& in); |
38 | 42 |
39 // Checks if the given string is a valid UTF-8 string. | 43 // Checks if the given string is a valid UTF-8 string. |
40 bool StringIsUtf8(const char* data, size_t length); | 44 bool StringIsUtf8(const char* data, size_t length); |
41 | 45 |
42 bool DoesRectContain(const webrtc::DesktopRect& a, | 46 bool DoesRectContain(const webrtc::DesktopRect& a, |
43 const webrtc::DesktopRect& b); | 47 const webrtc::DesktopRect& b); |
44 | 48 |
45 } // namespace remoting | 49 } // namespace remoting |
46 | 50 |
47 #endif // REMOTING_BASE_UTIL_H_ | 51 #endif // REMOTING_BASE_UTIL_H_ |
OLD | NEW |