Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(770)

Unified Diff: tests/SerializationTest.cpp

Issue 2206633004: Move off SK_SUPPORT_LEGACY_DATA_FACTORIES. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Gotta catch 'em all. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/SerializationTest.cpp
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index a6be1889a560bbbb58725e567b8823ee0c375196..0e53ac6009aec6e92c67b09a5f28f9e356aca334 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -634,7 +634,7 @@ static sk_sp<SkPicture> copy_picture_via_serialization(SkPicture* src) {
struct AnnotationRec {
const SkRect fRect;
const char* fKey;
- SkData* fValue;
+ sk_sp<SkData> fValue;
};
class TestAnnotationCanvas : public SkCanvas {
@@ -661,7 +661,7 @@ protected:
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 @@ DEF_TEST(Annotations, reporter) {
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());
« include/core/SkData.h ('K') | « tests/ResourceCacheTest.cpp ('k') | tests/StreamTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698