| Index: webrtc/modules/desktop_capture/desktop_frame.cc
|
| diff --git a/webrtc/modules/desktop_capture/desktop_frame.cc b/webrtc/modules/desktop_capture/desktop_frame.cc
|
| index dfc0928b6631b83522e498dd07224c1c59e2bf8b..a1ee33b2c52c888522c2be804c94e1ee8e9bd111 100644
|
| --- a/webrtc/modules/desktop_capture/desktop_frame.cc
|
| +++ b/webrtc/modules/desktop_capture/desktop_frame.cc
|
| @@ -57,6 +57,44 @@ uint8_t* DesktopFrame::GetFrameDataAtPos(const DesktopVector& pos) const {
|
| return data() + stride() * pos.y() + DesktopFrame::kBytesPerPixel * pos.x();
|
| }
|
|
|
| +bool DesktopFrame::DataEquals(const DesktopFrame& other) const {
|
| + if (!size().equals(other.size())) {
|
| + return false;
|
| + }
|
| + if (stride() == other.stride() &&
|
| + stride() == DesktopFrame::kBytesPerPixel * size().width()) {
|
| + return memcmp(data(), other.data(), stride() * size().height()) == 0;
|
| + }
|
| +
|
| + const uint8_t* my_array = data();
|
| + const uint8_t* other_array = other.data();
|
| + for (int i = 0; i < size().height(); i++) {
|
| + const uint8_t* my_this_line = my_array;
|
| + const uint8_t* other_this_line = other_array;
|
| + for (int j = 0; j < size().width(); j++) {
|
| + if (memcmp(my_this_line, other_this_line, kBytesPerPixel)
|
| + != 0) {
|
| + return false;
|
| + }
|
| + my_this_line += kBytesPerPixel;
|
| + other_this_line += kBytesPerPixel;
|
| + }
|
| + my_array += stride();
|
| + other_array += other.stride();
|
| + }
|
| +
|
| + return true;
|
| +}
|
| +
|
| +void DesktopFrame::Paint(DesktopVector pos, RgbaColor color) {
|
| + RTC_DCHECK(DesktopRect::MakeSize(size()).Contains(pos));
|
| + *reinterpret_cast<uint32_t*>(GetFrameDataAtPos(pos)) = color.ToUInt32();
|
| +}
|
| +
|
| +void DesktopFrame::Clear() {
|
| + memset(data(), 0, stride() * size().height());
|
| +}
|
| +
|
| BasicDesktopFrame::BasicDesktopFrame(DesktopSize size)
|
| : DesktopFrame(size, kBytesPerPixel * size.width(),
|
| new uint8_t[kBytesPerPixel * size.width() * size.height()],
|
|
|