| 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 memset(frame->data(), 0, frame->stride() * frame->size().height()); |
| 22 } |
| 23 |
| 24 bool DesktopFrameDataEquals(const DesktopFrame& left, |
| 25 const DesktopFrame& right) { |
| 26 if (!left.size().equals(right.size())) { |
| 27 return false; |
| 28 } |
| 29 if (left.stride() == right.stride() && |
| 30 left.stride() == DesktopFrame::kBytesPerPixel * left.size().width()) { |
| 31 return memcmp(left.data(), |
| 32 right.data(), |
| 33 left.stride() * left.size().height()) == 0; |
| 34 } |
| 35 |
| 36 const uint8_t* my_array = left.data(); |
| 37 const uint8_t* right_array = right.data(); |
| 38 for (int i = 0; i < left.size().height(); i++) { |
| 39 if (memcmp(my_array, |
| 40 right_array, |
| 41 DesktopFrame::kBytesPerPixel * left.size().width()) != 0) { |
| 42 return false; |
| 43 } |
| 44 my_array += left.stride(); |
| 45 right_array += right.stride(); |
| 46 } |
| 47 |
| 48 return true; |
| 49 } |
| 50 |
| 51 } // namespace webrtc |
| OLD | NEW |