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

Unified Diff: tests/SerializationTest.cpp

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Restore deleted Android code. Created 4 years, 7 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
« no previous file with comments | « tests/PictureTest.cpp ('k') | tests/TextBlobCacheTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SerializationTest.cpp
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index 4750bbe25d436a13de76f62ede826487c719efb4..9e9b221cd287800c74dd8c19cde24c1273092610 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -322,14 +322,14 @@ static void compare_bitmaps(skiatest::Reporter* reporter,
}
REPORTER_ASSERT(reporter, 0 == pixelErrors);
}
-static void serialize_and_compare_typeface(SkTypeface* typeface, const char* text,
+static void serialize_and_compare_typeface(sk_sp<SkTypeface> typeface, const char* text,
skiatest::Reporter* reporter)
{
// Create a paint with the typeface.
SkPaint paint;
paint.setColor(SK_ColorGRAY);
paint.setTextSize(SkIntToScalar(30));
- paint.setTypeface(typeface);
+ paint.setTypeface(std::move(typeface));
// Paint some text.
SkPictureRecorder recorder;
@@ -357,11 +357,11 @@ static void TestPictureTypefaceSerialization(skiatest::Reporter* reporter) {
{
// Load typeface from file to test CreateFromFile with index.
SkString filename = GetResourcePath("/fonts/test.ttc");
- SkAutoTUnref<SkTypeface> typeface(SkTypeface::CreateFromFile(filename.c_str(), 1));
+ sk_sp<SkTypeface> typeface(SkTypeface::MakeFromFile(filename.c_str(), 1));
if (!typeface) {
INFOF(reporter, "Could not run fontstream test because test.ttc not found.");
} else {
- serialize_and_compare_typeface(typeface, "A!", reporter);
+ serialize_and_compare_typeface(std::move(typeface), "A!", reporter);
}
}
@@ -372,12 +372,12 @@ static void TestPictureTypefaceSerialization(skiatest::Reporter* reporter) {
INFOF(reporter, "Could not run fontstream test because Distortable.ttf not found.");
} else {
SkFixed axis = SK_FixedSqrt2;
- SkAutoTUnref<SkTypeface> typeface(SkTypeface::CreateFromFontData(
+ sk_sp<SkTypeface> typeface(SkTypeface::MakeFromFontData(
new SkFontData(distortable.release(), 0, &axis, 1)));
if (!typeface) {
INFOF(reporter, "Could not run fontstream test because Distortable.ttf not created.");
} else {
- serialize_and_compare_typeface(typeface, "abc", reporter);
+ serialize_and_compare_typeface(std::move(typeface), "abc", reporter);
}
}
}
« no previous file with comments | « tests/PictureTest.cpp ('k') | tests/TextBlobCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698