[rust png] Stop using `SkXPS...PngHelpers.h` from PDFium.

This supports changing the Skia API as discussed in
https://review.skia.org/1082338

Bug: 381900683
Change-Id: I00f6c56ac4bad1e1fb6cae978ddd1d37b21d6b22
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/137410
Auto-Submit: Ɓukasz Anforowicz <lukasza@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/skia/BUILD.gn b/skia/BUILD.gn
index b953522..929e776 100644
--- a/skia/BUILD.gn
+++ b/skia/BUILD.gn
@@ -401,13 +401,11 @@
     sources += skia_codec_rust_png_public
     sources += skia_encode_rust_png_public
     sources += skia_encode_rust_png_srcs
-    sources += skia_xps_rust_png_public
     deps += [ ":rust_png_ffi" ]
   } else {
     sources += skia_codec_libpng_srcs
     sources += skia_encode_libpng_srcs
     sources += skia_encode_png_public
-    sources += skia_xps_libpng_public
     deps += [ "../third_party:png" ]
   }
 }
diff --git a/testing/pdfium_test.cc b/testing/pdfium_test.cc
index 070ef80..b12a3db 100644
--- a/testing/pdfium_test.cc
+++ b/testing/pdfium_test.cc
@@ -82,9 +82,9 @@
 #ifdef _WIN32
 #include "third_party/skia/include/docs/SkXPSDocument.h"  // nogncheck
 #ifdef PDF_ENABLE_RUST_PNG
-#include "third_party/skia/include/docs/SkXPSRustPngHelpers.h"  // nogncheck
+#include "third_party/skia/include/encode/SkPngRustEncoder.h"  // nogncheck
 #else
-#include "third_party/skia/include/docs/SkXPSLibpngHelpers.h"  // nogncheck
+#include "third_party/skia/include/encode/SkPngEncoder.h"  // nogncheck
 #endif  // PDF_ENABLE_RUST_PNG
 #endif  // _WIN32
 
@@ -1507,11 +1507,13 @@
       }
 
       SkXPS::Options xps_options;
+      xps_options.pngEncoder = [](SkWStream* dst, const SkPixmap& src) {
 #ifdef PDF_ENABLE_RUST_PNG
-      xps_options.pngEncoder = SkXPS::EncodePngUsingRust;
+        return SkPngRustEncoder::Encode(dst, src, {});
 #else
-      xps_options.pngEncoder = SkXPS::EncodePngUsingLibpng;
+        return SkPngEncoder::Encode(dst, src, {});
 #endif
+      };
       sk_sp<SkDocument> document =
           SkXPS::MakeDocument(stream.get(), xps_factory, xps_options);
       if (!document) {