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}
diff --git a/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc b/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc
index fd6fc7d..e0b334d 100644
--- a/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc
+++ b/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc
@@ -69,20 +69,11 @@
   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,