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

Unified Diff: tests/TypefaceTest.cpp

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice Created 4 years, 3 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/StreamTest.cpp ('k') | tools/debugger/SkDrawCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/TypefaceTest.cpp
diff --git a/tests/TypefaceTest.cpp b/tests/TypefaceTest.cpp
index 6f803ce11f2cb5e4321d3450146ef7d8fe30c816..436f129a63904ecf2dd379b7204715eefdbb65ea 100644
--- a/tests/TypefaceTest.cpp
+++ b/tests/TypefaceTest.cpp
@@ -21,12 +21,11 @@ static void TypefaceStyle_test(skiatest::Reporter* reporter,
uint16_t weight, uint16_t width, SkData* data)
{
sk_sp<SkData> dataCopy;
- SkData* dataToUse = data;
- if (!dataToUse->unique()) {
+ if (!data->unique()) {
dataCopy = SkData::MakeWithCopy(data->data(), data->size());
- dataToUse = dataCopy.get();
+ data = dataCopy.get();
}
- SkSFNTHeader* sfntHeader = static_cast<SkSFNTHeader*>(dataToUse->writable_data());
+ SkSFNTHeader* sfntHeader = static_cast<SkSFNTHeader*>(data->writable_data());
SkSFNTHeader::TableDirectoryEntry* tableEntry =
SkTAfter<SkSFNTHeader::TableDirectoryEntry>(sfntHeader);
@@ -46,7 +45,7 @@ static void TypefaceStyle_test(skiatest::Reporter* reporter,
using WidthType = SkOTTableOS2_V0::WidthClass::Value;
os2Table->usWidthClass.value = static_cast<WidthType>(SkEndian_SwapBE16(width));
- sk_sp<SkTypeface> newTypeface(SkTypeface::MakeFromStream(new SkMemoryStream(dataToUse)));
+ sk_sp<SkTypeface> newTypeface(SkTypeface::MakeFromStream(new SkMemoryStream(sk_ref_sp(data))));
SkASSERT_RELEASE(newTypeface);
SkFontStyle newStyle = newTypeface->fontStyle();
« no previous file with comments | « tests/StreamTest.cpp ('k') | tools/debugger/SkDrawCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698