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

Unified Diff: src/pdf/SkPDFStream.cpp

Issue 1049753002: SkPDF: Factor SkPDFCatalog into SkPDFObjNumMap and SkPDFSubstituteMap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: full Created 5 years, 9 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/SkPDFStream.h ('k') | src/pdf/SkPDFTypes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFStream.cpp
diff --git a/src/pdf/SkPDFStream.cpp b/src/pdf/SkPDFStream.cpp
index 939cdd8b3dbb97e457936c43703dc31b34d7fb61..5665c599cd91fdc3d46b3ecb93b5555ece508a82 100644
--- a/src/pdf/SkPDFStream.cpp
+++ b/src/pdf/SkPDFStream.cpp
@@ -9,7 +9,6 @@
#include "SkData.h"
#include "SkFlate.h"
-#include "SkPDFCatalog.h"
#include "SkPDFStream.h"
#include "SkStream.h"
#include "SkStreamPriv.h"
@@ -24,9 +23,26 @@ SkPDFStream::SkPDFStream(SkData* data) : fState(kUnused_State) {
SkPDFStream::~SkPDFStream() {}
-void SkPDFStream::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
- SkAssertResult(this->populate(catalog));
- this->INHERITED::emitObject(stream, catalog);
+void SkPDFStream::emitObject(SkWStream* stream,
+ const SkPDFObjNumMap& objNumMap,
+ const SkPDFSubstituteMap& substitutes) {
+ if (fState == kUnused_State) {
+ fState = kNoCompression_State;
+ SkDynamicMemoryWStream compressedData;
+
+ SkAssertResult(
+ SkFlate::Deflate(fDataStream.get(), &compressedData));
+ SkAssertResult(fDataStream->rewind());
+ if (compressedData.getOffset() < this->dataSize()) {
+ SkAutoTDelete<SkStream> compressed(
+ compressedData.detachAsStream());
+ this->setData(compressed.get());
+ insertName("Filter", "FlateDecode");
mtklein 2015/03/31 19:29:21 It'd be nice to tack on this-> to these insertFoo
hal.canary 2015/03/31 19:32:48 will do.
+ }
+ fState = kCompressed_State;
+ insertInt("Length", this->dataSize());
+ }
+ this->INHERITED::emitObject(stream, objNumMap, substitutes);
stream->writeText(" stream\n");
stream->writeStream(fDataStream.get(), fDataStream->getLength());
SkAssertResult(fDataStream->rewind());
@@ -52,23 +68,3 @@ size_t SkPDFStream::dataSize() const {
SkASSERT(fDataStream->hasLength());
return fDataStream->getLength();
}
-
-bool SkPDFStream::populate(SkPDFCatalog* catalog) {
- if (fState == kUnused_State) {
- fState = kNoCompression_State;
- SkDynamicMemoryWStream compressedData;
-
- SkAssertResult(
- SkFlate::Deflate(fDataStream.get(), &compressedData));
- SkAssertResult(fDataStream->rewind());
- if (compressedData.getOffset() < this->dataSize()) {
- SkAutoTDelete<SkStream> compressed(
- compressedData.detachAsStream());
- this->setData(compressed.get());
- insertName("Filter", "FlateDecode");
- }
- fState = kCompressed_State;
- insertInt("Length", this->dataSize());
- }
- return true;
-}
« no previous file with comments | « src/pdf/SkPDFStream.h ('k') | src/pdf/SkPDFTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698