Simplify image_diff_png::DecodePNG(). Pass in the std::vector as 1 parameter instead of 2. Change-Id: Idd70dbf0ce50c69f64b2329f6f5c32dcec7a4359 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/62590 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/testing/image_diff/image_diff.cpp b/testing/image_diff/image_diff.cpp index 3da138b..f988e71 100644 --- a/testing/image_diff/image_diff.cpp +++ b/testing/image_diff/image_diff.cpp
@@ -63,8 +63,7 @@ fclose(f); - data_ = image_diff_png::DecodePNG(compressed.data(), compressed.size(), &w_, - &h_); + data_ = image_diff_png::DecodePNG(compressed, &w_, &h_); if (data_.empty()) { Clear(); return false;
diff --git a/testing/image_diff/image_diff_png.cpp b/testing/image_diff/image_diff_png.cpp index ef9d4aa..eec8a04 100644 --- a/testing/image_diff/image_diff_png.cpp +++ b/testing/image_diff/image_diff_png.cpp
@@ -659,11 +659,10 @@ } // namespace -std::vector<unsigned char> DecodePNG(const unsigned char* input, - size_t input_size, +std::vector<unsigned char> DecodePNG(pdfium::span<const unsigned char> input, int* width, int* height) { - return Decode(input, input_size, FORMAT_RGBA, width, height); + return Decode(input.data(), input.size(), FORMAT_RGBA, width, height); } std::vector<unsigned char> EncodeBGRPNG(const unsigned char* input,
diff --git a/testing/image_diff/image_diff_png.h b/testing/image_diff/image_diff_png.h index 380e6dc..3afbd6a 100644 --- a/testing/image_diff/image_diff_png.h +++ b/testing/image_diff/image_diff_png.h
@@ -9,11 +9,12 @@ #include <vector> +#include "third_party/base/span.h" + namespace image_diff_png { // Decode a PNG into an RGBA pixel array. -std::vector<unsigned char> DecodePNG(const unsigned char* input, - size_t input_size, +std::vector<unsigned char> DecodePNG(pdfium::span<const unsigned char> input, int* width, int* height);