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

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

Issue 1039313004: SkPDF: style nit (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | no next file » | 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"
(...skipping 19 matching lines...) Expand all
30 fState = kNoCompression_State; 30 fState = kNoCompression_State;
31 SkDynamicMemoryWStream compressedData; 31 SkDynamicMemoryWStream compressedData;
32 32
33 SkAssertResult( 33 SkAssertResult(
34 SkFlate::Deflate(fDataStream.get(), &compressedData)); 34 SkFlate::Deflate(fDataStream.get(), &compressedData));
35 SkAssertResult(fDataStream->rewind()); 35 SkAssertResult(fDataStream->rewind());
36 if (compressedData.getOffset() < this->dataSize()) { 36 if (compressedData.getOffset() < this->dataSize()) {
37 SkAutoTDelete<SkStream> compressed( 37 SkAutoTDelete<SkStream> compressed(
38 compressedData.detachAsStream()); 38 compressedData.detachAsStream());
39 this->setData(compressed.get()); 39 this->setData(compressed.get());
40 insertName("Filter", "FlateDecode"); 40 this->insertName("Filter", "FlateDecode");
41 } 41 }
42 fState = kCompressed_State; 42 fState = kCompressed_State;
43 insertInt("Length", this->dataSize()); 43 this->insertInt("Length", this->dataSize());
44 } 44 }
45 this->INHERITED::emitObject(stream, objNumMap, substitutes); 45 this->INHERITED::emitObject(stream, objNumMap, substitutes);
46 stream->writeText(" stream\n"); 46 stream->writeText(" stream\n");
47 stream->writeStream(fDataStream.get(), fDataStream->getLength()); 47 stream->writeStream(fDataStream.get(), fDataStream->getLength());
48 SkAssertResult(fDataStream->rewind()); 48 SkAssertResult(fDataStream->rewind());
49 stream->writeText("\nendstream"); 49 stream->writeText("\nendstream");
50 } 50 }
51 51
52 SkPDFStream::SkPDFStream() : fState(kUnused_State) {} 52 SkPDFStream::SkPDFStream() : fState(kUnused_State) {}
53 53
54 void SkPDFStream::setData(SkData* data) { 54 void SkPDFStream::setData(SkData* data) {
55 // FIXME: Don't swap if the data is the same. 55 // FIXME: Don't swap if the data is the same.
56 fDataStream.reset(SkNEW_ARGS(SkMemoryStream, (data))); 56 fDataStream.reset(SkNEW_ARGS(SkMemoryStream, (data)));
57 } 57 }
58 58
59 void SkPDFStream::setData(SkStream* stream) { 59 void SkPDFStream::setData(SkStream* stream) {
60 SkASSERT(stream); 60 SkASSERT(stream);
61 // Code assumes that the stream starts at the beginning and is rewindable. 61 // Code assumes that the stream starts at the beginning and is rewindable.
62 // SkStreamRewindableFromSkStream will try stream->duplicate(). 62 // SkStreamRewindableFromSkStream will try stream->duplicate().
63 fDataStream.reset(SkStreamRewindableFromSkStream(stream)); 63 fDataStream.reset(SkStreamRewindableFromSkStream(stream));
64 SkASSERT(fDataStream.get()); 64 SkASSERT(fDataStream.get());
65 } 65 }
66 66
67 size_t SkPDFStream::dataSize() const { 67 size_t SkPDFStream::dataSize() const {
68 SkASSERT(fDataStream->hasLength()); 68 SkASSERT(fDataStream->hasLength());
69 return fDataStream->getLength(); 69 return fDataStream->getLength();
70 } 70 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698