aboutsummaryrefslogtreecommitdiff
path: root/tests/SerialProcsTest.cpp
diff options
context:
space:
mode:
authorKevin Lubick <kjlubick@google.com>2023-04-11 13:51:02 -0400
committerKevin Lubick <kjlubick@google.com>2023-04-12 11:50:52 +0000
commitbab392fd3d9a48e0b696d1799d5271444c199643 (patch)
tree053c7a164367e60cdf706ed98e1924e2464f96a5 /tests/SerialProcsTest.cpp
parentd4e7e1c701c1757d3f025471eb43876f9013b398 (diff)
downloadskia-bab392fd3d9a48e0b696d1799d5271444c199643.tar.gz
Deprecate SkImage::encodeToData and migrate all internal uses
By removing this method, we will further (completely?) decouple SkImage from our encoders, allowing for them to not contribute to code size when not needed. This adds replacement functions to include/encode/Sk*Encoder.h. This CL must land with the follow-on CL to preserve the ability to use NDK encoders instead of bundling in ones based on libpng et al. Change-Id: Ie20a41cfdf65c975f640fb9368f363a588bd9394 Bug: skia:13983 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/667296 Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'tests/SerialProcsTest.cpp')
-rw-r--r--tests/SerialProcsTest.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/SerialProcsTest.cpp b/tests/SerialProcsTest.cpp
index 68364164e7..bade15dfb3 100644
--- a/tests/SerialProcsTest.cpp
+++ b/tests/SerialProcsTest.cpp
@@ -8,6 +8,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkData.h"
+#include "include/core/SkDataTable.h"
#include "include/core/SkFont.h"
#include "include/core/SkImage.h"
#include "include/core/SkPaint.h"
@@ -21,6 +22,7 @@
#include "include/core/SkTileMode.h"
#include "include/core/SkTypeface.h"
#include "include/core/SkTypes.h"
+#include "include/encode/SkPngEncoder.h"
#include "include/private/base/SkTDArray.h"
#include "tests/Test.h"
#include "tools/Resources.h"
@@ -48,9 +50,9 @@ DEF_TEST(serial_procs_image, reporter) {
const char magic_str[] = "magic signature";
const SkSerialImageProc sprocs[] = {
- [](SkImage* img, void* ctx) -> sk_sp<SkData> { return nullptr; },
- [](SkImage* img, void* ctx) { return img->encodeToData(); },
- [](SkImage* img, void* ctx) { return SkData::MakeWithCString(((State*)ctx)->fStr); },
+ [](SkImage* img, void* ctx) -> sk_sp<SkData> { return nullptr; },
+ [](SkImage* img, void* ctx) { return SkPngEncoder::Encode(nullptr, img, {}); },
+ [](SkImage* img, void* ctx) { return SkData::MakeWithCString(((State*)ctx)->fStr); },
};
const SkDeserialImageProc dprocs[] = {
[](const void* data, size_t length, void*) -> sk_sp<SkImage> { return nullptr; },