blob: 3294ceebb03df9c3b66521106c14e0568a6a98f3 [file] [log] [blame]
[email protected]a101cf32012-01-14 00:34:231// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]c3af26f332010-10-06 22:46:002// 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
avi5a080f012015-12-22 23:15:438#include <stddef.h>
sergeyu80f771b2015-08-21 23:37:029#include <stdint.h>
[email protected]82156e82011-12-20 07:09:0110#include <string>
11
[email protected]e59d6592013-09-25 22:16:2112#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
[email protected]c3af26f332010-10-06 22:46:0013
14namespace remoting {
15
[email protected]a101cf32012-01-14 00:34:2316// Return a string that contains the current date formatted as 'MMDD/HHMMSS:'.
[email protected]82d105e2011-08-04 03:19:3517std::string GetTimestampString();
18
[email protected]47379e92011-07-26 15:33:1519int RoundToTwosMultiple(int x);
20
21// Align the sides of the rectangle to multiples of 2 (expanding outwards).
[email protected]e59d6592013-09-25 22:16:2122webrtc::DesktopRect AlignRect(const webrtc::DesktopRect& rect);
[email protected]47379e92011-07-26 15:33:1523
[email protected]420a5e42012-12-18 21:42:1224// Copy content of a rectangle in a RGB32 image.
sergeyu80f771b2015-08-21 23:37:0225void CopyRGB32Rect(const uint8_t* source_buffer,
[email protected]b3ca1f52012-02-09 19:00:5126 int source_stride,
[email protected]e59d6592013-09-25 22:16:2127 const webrtc::DesktopRect& source_buffer_rect,
sergeyu80f771b2015-08-21 23:37:0228 uint8_t* dest_buffer,
[email protected]b3ca1f52012-02-09 19:00:5129 int dest_stride,
[email protected]e59d6592013-09-25 22:16:2130 const webrtc::DesktopRect& dest_buffer_rect,
31 const webrtc::DesktopRect& dest_rect);
[email protected]b3ca1f52012-02-09 19:00:5132
[email protected]a93c8c842012-06-02 22:17:0333// Replaces every occurrence of "\n" in a string by "\r\n".
34std::string ReplaceLfByCrLf(const std::string& in);
35
36// Replaces every occurrence of "\r\n" in a string by "\n".
37std::string ReplaceCrLfByLf(const std::string& in);
38
[email protected]31014af2012-11-30 04:04:5739// Checks if the given string is a valid UTF-8 string.
40bool StringIsUtf8(const char* data, size_t length);
41
[email protected]e59d6592013-09-25 22:16:2142bool DoesRectContain(const webrtc::DesktopRect& a,
43 const webrtc::DesktopRect& b);
44
[email protected]c3af26f332010-10-06 22:46:0045} // namespace remoting
46
47#endif // REMOTING_BASE_UTIL_H_