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

Unified Diff: src/pdf/SkPDFTypes.cpp

Issue 2099463002: SkPDF: alloc less memory for strings (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-06-23 (Thursday) 16:23:34 EDT Created 4 years, 6 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: src/pdf/SkPDFTypes.cpp
diff --git a/src/pdf/SkPDFTypes.cpp b/src/pdf/SkPDFTypes.cpp
index 285da38513127e47ed12bacdf1329b242c03110f..19635ab84e1cde894d3f717041e30fa2dff8fbf3 100644
--- a/src/pdf/SkPDFTypes.cpp
+++ b/src/pdf/SkPDFTypes.cpp
@@ -110,18 +110,6 @@ static void write_name_escaped(SkWStream* o, const char* name) {
}
}
-static void write_string(SkWStream* o, const SkString& s) {
- o->write(s.c_str(), s.size());
-}
-
-static SkString format_string(const SkString& s) {
- return SkPDFUtils::FormatString(s.c_str(), s.size());
-}
-
-static SkString format_string(const char* s) {
- return SkPDFUtils::FormatString(s, strlen(s));
-}
-
void SkPDFUnion::emitObject(SkWStream* stream,
const SkPDFObjNumMap& objNumMap,
const SkPDFSubstituteMap& substitutes) const {
@@ -142,14 +130,16 @@ void SkPDFUnion::emitObject(SkWStream* stream,
return;
case Type::kString:
SkASSERT(fStaticString);
- write_string(stream, format_string(fStaticString));
+ SkPDFUtils::WriteString(stream, fStaticString,
+ strlen(fStaticString));
return;
case Type::kNameSkS:
stream->writeText("/");
write_name_escaped(stream, pun(fSkString)->c_str());
return;
case Type::kStringSkS:
- write_string(stream, format_string(*pun(fSkString)));
+ SkPDFUtils::WriteString(stream, pun(fSkString)->c_str(),
+ pun(fSkString)->size());
return;
case Type::kObjRef:
stream->writeDecAsText(objNumMap.getObjectNumber(
« src/pdf/SkPDFDevice.cpp ('K') | « src/pdf/SkPDFDevice.cpp ('k') | src/pdf/SkPDFUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698