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

Unified Diff: src/pdf/SkPDFFont.cpp

Issue 2190883003: SkPDF: PDFStream has-a not is-a PDFDict (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-07-29 (Friday) 12:30:20 EDT Created 4 years, 5 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 | « src/pdf/SkPDFDocument.cpp ('k') | src/pdf/SkPDFFormXObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFFont.cpp
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 6e04c23e25790e673e050ffedfec554b2365c177..2fc408efc7fa735cf73d7b7df9caf40a81341cd9 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -14,7 +14,6 @@
#include "SkPDFDevice.h"
#include "SkPDFFont.h"
#include "SkPDFFontImpl.h"
-#include "SkPDFStream.h"
#include "SkPDFUtils.h"
#include "SkRefCnt.h"
#include "SkScalar.h"
@@ -1006,7 +1005,7 @@ static sk_sp<SkPDFObject> get_subset_font_stream(
subsetFont, subsetFontSize,
[](const void* p, void*) { delete[] (unsigned char*)p; },
nullptr));
- subsetStream->insertInt("Length1", subsetFontSize);
+ subsetStream->dict()->insertInt("Length1", subsetFontSize);
return subsetStream;
}
#endif // SK_SFNTLY_SUBSETTER
@@ -1048,7 +1047,7 @@ bool SkPDFCIDFont::addFontDescriptor(int16_t defaultWidth,
fontAsset.reset(this->typeface()->openStream(&ttcIndex));
}
#endif // SK_SFNTLY_SUBSETTER
- auto fontStream = sk_make_sp<SkPDFSharedStream>(fontAsset.release());
+ auto fontStream = sk_make_sp<SkPDFSharedStream>(std::move(fontAsset));
fontStream->dict()->insertInt("Length1", fontSize);
descriptor->insertObjRef("FontFile2", std::move(fontStream));
break;
@@ -1062,8 +1061,7 @@ bool SkPDFCIDFont::addFontDescriptor(int16_t defaultWidth,
if (!fontData || 0 == fontData->getLength()) {
return false;
}
- sk_sp<SkPDFSharedStream> fontStream(
- new SkPDFSharedStream(fontData.release()));
+ auto fontStream = sk_make_sp<SkPDFSharedStream>(std::move(fontData));
if (getType() == SkAdvancedTypefaceMetrics::kCFF_Font) {
fontStream->dict()->insertName("Subtype", "Type1C");
} else {
@@ -1200,9 +1198,9 @@ bool SkPDFType1Font::addFontDescriptor(int16_t defaultWidth) {
}
SkASSERT(this->canEmbed());
auto fontStream = sk_make_sp<SkPDFStream>(std::move(fontData));
- fontStream->insertInt("Length1", header);
- fontStream->insertInt("Length2", data);
- fontStream->insertInt("Length3", trailer);
+ fontStream->dict()->insertInt("Length1", header);
+ fontStream->dict()->insertInt("Length2", data);
+ fontStream->dict()->insertInt("Length3", trailer);
descriptor->insertObjRef("FontFile", std::move(fontStream));
this->insertObjRef("FontDescriptor", std::move(descriptor));
« no previous file with comments | « src/pdf/SkPDFDocument.cpp ('k') | src/pdf/SkPDFFormXObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698