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

Side by Side Diff: src/pdf/SkPDFStream.cpp

Issue 1227913008: SkPDF: Memory improvements for PDF Streams (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-19 (Wednesday) 17:47:45 EDT Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | src/pdf/SkPDFTypes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkData.h" 10 #include "SkData.h"
11 #include "SkDeflate.h" 11 #include "SkDeflate.h"
12 #include "SkPDFStream.h" 12 #include "SkPDFStream.h"
13 #include "SkStream.h" 13 #include "SkStream.h"
14 #include "SkStreamPriv.h" 14 #include "SkStreamPriv.h"
15 15
16 SkPDFStream::~SkPDFStream() {} 16 SkPDFStream::~SkPDFStream() {}
17 17
18 void SkPDFStream::emitObject(SkWStream* stream, 18 void SkPDFStream::emitObject(SkWStream* stream,
19 const SkPDFObjNumMap& objNumMap, 19 const SkPDFObjNumMap& objNumMap,
20 const SkPDFSubstituteMap& substitutes) const { 20 const SkPDFSubstituteMap& substitutes) const {
21 SkASSERT(fCompressedData); 21 SkASSERT(fCompressedData);
22 this->INHERITED::emitObject(stream, objNumMap, substitutes); 22 this->INHERITED::emitObject(stream, objNumMap, substitutes);
23 // Note: emitObject isn't marked const, but could be in the future 23 // duplicate (a cheap operation) preserves const on fCompressedData.
24 SkAutoTDelete<SkStreamRewindable> dup(fCompressedData->duplicate()); 24 SkAutoTDelete<SkStreamRewindable> dup(fCompressedData->duplicate());
25 SkASSERT(dup); 25 SkASSERT(dup);
26 SkASSERT(dup->hasLength()); 26 SkASSERT(dup->hasLength());
27 stream->writeText(" stream\n"); 27 stream->writeText(" stream\n");
28 stream->writeStream(dup.get(), dup->getLength()); 28 stream->writeStream(dup.get(), dup->getLength());
29 stream->writeText("\nendstream"); 29 stream->writeText("\nendstream");
30 } 30 }
31 31
32 void SkPDFStream::setData(SkStream* stream) { 32 void SkPDFStream::setData(SkStream* stream) {
33 SkASSERT(!fCompressedData); // Only call this function once. 33 SkASSERT(!fCompressedData); // Only call this function once.
(...skipping 12 matching lines...) Expand all
46 dup->getLength() <= length + strlen("/Filter_/FlateDecode_")) { 46 dup->getLength() <= length + strlen("/Filter_/FlateDecode_")) {
47 this->insertInt("Length", dup->getLength()); 47 this->insertInt("Length", dup->getLength());
48 fCompressedData.reset(dup.detach()); 48 fCompressedData.reset(dup.detach());
49 return; 49 return;
50 } 50 }
51 } 51 }
52 fCompressedData.reset(compressedData.detachAsStream()); 52 fCompressedData.reset(compressedData.detachAsStream());
53 this->insertName("Filter", "FlateDecode"); 53 this->insertName("Filter", "FlateDecode");
54 this->insertInt("Length", length); 54 this->insertInt("Length", length);
55 } 55 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | src/pdf/SkPDFTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698