blob: d022a16b35ccaeab8251760412a41540fe826473 [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
sergeyu80f771b2015-08-21 23:37:028#include <stdint.h>
[email protected]82156e82011-12-20 07:09:019#include <string>
10
[email protected]e59d6592013-09-25 22:16:2111#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
[email protected]c3af26f332010-10-06 22:46:0012
13namespace remoting {
14
[email protected]a101cf32012-01-14 00:34:2315// Return a string that contains the current date formatted as 'MMDD/HHMMSS:'.
[email protected]82d105e2011-08-04 03:19:3516std::string GetTimestampString();
17
[email protected]47379e92011-07-26 15:33:1518int RoundToTwosMultiple(int x);
19
20// Align the sides of the rectangle to multiples of 2 (expanding outwards).
[email protected]e59d6592013-09-25 22:16:2121webrtc::DesktopRect AlignRect(const webrtc::DesktopRect& rect);
[email protected]47379e92011-07-26 15:33:1522
[email protected]420a5e42012-12-18 21:42:1223// Copy content of a rectangle in a RGB32 image.
sergeyu80f771b2015-08-21 23:37:0224void CopyRGB32Rect(const uint8_t* source_buffer,
[email protected]b3ca1f52012-02-09 19:00:5125 int source_stride,
[email protected]e59d6592013-09-25 22:16:2126 const webrtc::DesktopRect& source_buffer_rect,
sergeyu80f771b2015-08-21 23:37:0227 uint8_t* dest_buffer,
[email protected]b3ca1f52012-02-09 19:00:5128 int dest_stride,
[email protected]e59d6592013-09-25 22:16:2129 const webrtc::DesktopRect& dest_buffer_rect,
30 const webrtc::DesktopRect& dest_rect);
[email protected]b3ca1f52012-02-09 19:00:5131
[email protected]a93c8c842012-06-02 22:17:0332// Replaces every occurrence of "\n" in a string by "\r\n".
33std::string ReplaceLfByCrLf(const std::string& in);
34
35// Replaces every occurrence of "\r\n" in a string by "\n".
36std::string ReplaceCrLfByLf(const std::string& in);
37
[email protected]31014af2012-11-30 04:04:5738// Checks if the given string is a valid UTF-8 string.
39bool StringIsUtf8(const char* data, size_t length);
40
[email protected]e59d6592013-09-25 22:16:2141bool DoesRectContain(const webrtc::DesktopRect& a,
42 const webrtc::DesktopRect& b);
43
[email protected]c3af26f332010-10-06 22:46:0044} // namespace remoting
45
46#endif // REMOTING_BASE_UTIL_H_