| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // Align the sides of the rectangle to multiples of 2 (expanding outwards). | 67 // Align the sides of the rectangle to multiples of 2 (expanding outwards). |
| 68 SkIRect AlignRect(const SkIRect& rect); | 68 SkIRect AlignRect(const SkIRect& rect); |
| 69 | 69 |
| 70 // Scales the supplied rectangle from |in_size| coordinates to |out_size|. | 70 // Scales the supplied rectangle from |in_size| coordinates to |out_size|. |
| 71 // If the result has non-integer coordinates then the smallest integer- | 71 // If the result has non-integer coordinates then the smallest integer- |
| 72 // coordinate rectangle that wholly encloses it is returned. | 72 // coordinate rectangle that wholly encloses it is returned. |
| 73 SkIRect ScaleRect(const SkIRect& rect, | 73 SkIRect ScaleRect(const SkIRect& rect, |
| 74 const SkISize& in_size, | 74 const SkISize& in_size, |
| 75 const SkISize& out_size); | 75 const SkISize& out_size); |
| 76 | 76 |
| 77 // Copy pixels in the rectangle from source to destination. | 77 // Copy content of a rectangle in a RGB32 image. |
| 78 void CopyRect(const uint8* src_plane, | |
| 79 int src_plane_stride, | |
| 80 uint8* dest_plane, | |
| 81 int dest_plane_stride, | |
| 82 int bytes_per_pixel, | |
| 83 const SkIRect& rect); | |
| 84 | |
| 85 void CopyRGB32Rect(const uint8* source_buffer, | 78 void CopyRGB32Rect(const uint8* source_buffer, |
| 86 int source_stride, | 79 int source_stride, |
| 87 const SkIRect& source_buffer_rect, | 80 const SkIRect& source_buffer_rect, |
| 88 uint8* dest_buffer, | 81 uint8* dest_buffer, |
| 89 int dest_stride, | 82 int dest_stride, |
| 90 const SkIRect& dest_buffer_rect, | 83 const SkIRect& dest_buffer_rect, |
| 91 const SkIRect& dest_rect); | 84 const SkIRect& dest_rect); |
| 92 | 85 |
| 93 // Replaces every occurrence of "\n" in a string by "\r\n". | 86 // Replaces every occurrence of "\n" in a string by "\r\n". |
| 94 std::string ReplaceLfByCrLf(const std::string& in); | 87 std::string ReplaceLfByCrLf(const std::string& in); |
| 95 | 88 |
| 96 // Replaces every occurrence of "\r\n" in a string by "\n". | 89 // Replaces every occurrence of "\r\n" in a string by "\n". |
| 97 std::string ReplaceCrLfByLf(const std::string& in); | 90 std::string ReplaceCrLfByLf(const std::string& in); |
| 98 | 91 |
| 99 // Checks if the given string is a valid UTF-8 string. | 92 // Checks if the given string is a valid UTF-8 string. |
| 100 bool StringIsUtf8(const char* data, size_t length); | 93 bool StringIsUtf8(const char* data, size_t length); |
| 101 | 94 |
| 102 } // namespace remoting | 95 } // namespace remoting |
| 103 | 96 |
| 104 #endif // REMOTING_BASE_UTIL_H_ | 97 #endif // REMOTING_BASE_UTIL_H_ |
| OLD | NEW |