| OLD | NEW |
| (Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #include "webrtc/modules/desktop_capture/test_utils.h" |
| 12 |
| 13 #include <string.h> |
| 14 |
| 15 #include "webrtc/base/checks.h" |
| 16 |
| 17 namespace webrtc { |
| 18 |
| 19 void ClearDesktopFrame(DesktopFrame* frame) { |
| 20 RTC_DCHECK(frame); |
| 21 uint8_t* data = frame->data(); |
| 22 for (int i = 0; i < frame->size().height(); i++) { |
| 23 memset(data, 0, frame->size().width() * DesktopFrame::kBytesPerPixel); |
| 24 data += frame->stride(); |
| 25 } |
| 26 } |
| 27 |
| 28 bool DesktopFrameDataEquals(const DesktopFrame& left, |
| 29 const DesktopFrame& right) { |
| 30 if (!left.size().equals(right.size())) { |
| 31 return false; |
| 32 } |
| 33 |
| 34 const uint8_t* left_array = left.data(); |
| 35 const uint8_t* right_array = right.data(); |
| 36 for (int i = 0; i < left.size().height(); i++) { |
| 37 if (memcmp(left_array, |
| 38 right_array, |
| 39 DesktopFrame::kBytesPerPixel * left.size().width()) != 0) { |
| 40 return false; |
| 41 } |
| 42 left_array += left.stride(); |
| 43 right_array += right.stride(); |
| 44 } |
| 45 |
| 46 return true; |
| 47 } |
| 48 |
| 49 } // namespace webrtc |
| OLD | NEW |