x_server_pixel_buffer: Use CopyPixelsFrom instead of memcpy

`CopyPixelsFrom` uses libyuv underneath and has handrolled
implementation for copying with AVX.

Bug: chromium:1424776
Change-Id: I4fafeba97fcc1d2200a10070837672175a1dfc50
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/297800
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Auto-Submit: Salman Malik <salmanmalik@chromium.org>
Cr-Commit-Position: refs/heads/main@{#39567}
This commit is contained in:
Salman Malik 2023-03-15 12:58:59 +00:00 committed by WebRTC LUCI CQ
parent de29931625
commit db9be7f194

View File

@ -69,20 +69,11 @@ void FastBlit(XImage* x_image,
RTC_DCHECK_LE(frame->top_left().x(), rect.left());
RTC_DCHECK_LE(frame->top_left().y(), rect.top());
int src_stride = x_image->bytes_per_line;
int dst_x = rect.left() - frame->top_left().x();
int dst_y = rect.top() - frame->top_left().y();
uint8_t* dst_pos = frame->data() + frame->stride() * dst_y;
dst_pos += dst_x * DesktopFrame::kBytesPerPixel;
int height = rect.height();
int row_bytes = rect.width() * DesktopFrame::kBytesPerPixel;
for (int y = 0; y < height; ++y) {
memcpy(dst_pos, src_pos, row_bytes);
src_pos += src_stride;
dst_pos += frame->stride();
}
frame->CopyPixelsFrom(
src_pos, x_image->bytes_per_line,
DesktopRect::MakeXYWH(rect.left() - frame->top_left().x(),
rect.top() - frame->top_left().y(), rect.width(),
rect.height()));
}
void SlowBlit(XImage* x_image,