Move off SK_SUPPORT_LEGACY_DATA_FACTORIES.
This moves Skia code off of SK_SUPPORT_LEGACY_DATA_FACTORIES.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2206633004
Review-Url: https://codereview.chromium.org/2206633004
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index a6be188..0e53ac6 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -634,7 +634,7 @@
struct AnnotationRec {
const SkRect fRect;
const char* fKey;
- SkData* fValue;
+ sk_sp<SkData> fValue;
};
class TestAnnotationCanvas : public SkCanvas {
@@ -661,7 +661,7 @@
REPORTER_ASSERT(fReporter, fCurrIndex < fCount);
REPORTER_ASSERT(fReporter, rect == fRec[fCurrIndex].fRect);
REPORTER_ASSERT(fReporter, !strcmp(key, fRec[fCurrIndex].fKey));
- REPORTER_ASSERT(fReporter, value->equals(fRec[fCurrIndex].fValue));
+ REPORTER_ASSERT(fReporter, value->equals(fRec[fCurrIndex].fValue.get()));
fCurrIndex += 1;
}
};
@@ -676,23 +676,23 @@
const char* str0 = "rect-with-url";
const SkRect r0 = SkRect::MakeWH(10, 10);
- SkAutoTUnref<SkData> d0(SkData::NewWithCString(str0));
- SkAnnotateRectWithURL(recordingCanvas, r0, d0);
+ sk_sp<SkData> d0(SkData::MakeWithCString(str0));
+ SkAnnotateRectWithURL(recordingCanvas, r0, d0.get());
const char* str1 = "named-destination";
const SkRect r1 = SkRect::MakeXYWH(5, 5, 0, 0); // collapsed to a point
- SkAutoTUnref<SkData> d1(SkData::NewWithCString(str1));
- SkAnnotateNamedDestination(recordingCanvas, {r1.x(), r1.y()}, d1);
+ sk_sp<SkData> d1(SkData::MakeWithCString(str1));
+ SkAnnotateNamedDestination(recordingCanvas, {r1.x(), r1.y()}, d1.get());
const char* str2 = "link-to-destination";
const SkRect r2 = SkRect::MakeXYWH(20, 20, 5, 6);
- SkAutoTUnref<SkData> d2(SkData::NewWithCString(str2));
- SkAnnotateLinkToDestination(recordingCanvas, r2, d2);
+ sk_sp<SkData> d2(SkData::MakeWithCString(str2));
+ SkAnnotateLinkToDestination(recordingCanvas, r2, d2.get());
const AnnotationRec recs[] = {
- { r0, SkAnnotationKeys::URL_Key(), d0 },
- { r1, SkAnnotationKeys::Define_Named_Dest_Key(), d1 },
- { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 },
+ { r0, SkAnnotationKeys::URL_Key(), std::move(d0) },
+ { r1, SkAnnotationKeys::Define_Named_Dest_Key(), std::move(d1) },
+ { r2, SkAnnotationKeys::Link_Named_Dest_Key(), std::move(d2) },
};
sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture());