| OLD | NEW |
| 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::drop() { |
| 19 fCompressedData.reset(nullptr); |
| 20 this->SkPDFDict::drop(); |
| 21 } |
| 22 |
| 18 void SkPDFStream::emitObject(SkWStream* stream, | 23 void SkPDFStream::emitObject(SkWStream* stream, |
| 19 const SkPDFObjNumMap& objNumMap, | 24 const SkPDFObjNumMap& objNumMap, |
| 20 const SkPDFSubstituteMap& substitutes) const { | 25 const SkPDFSubstituteMap& substitutes) const { |
| 21 SkASSERT(fCompressedData); | 26 SkASSERT(fCompressedData); |
| 22 this->INHERITED::emitObject(stream, objNumMap, substitutes); | 27 this->INHERITED::emitObject(stream, objNumMap, substitutes); |
| 23 // duplicate (a cheap operation) preserves const on fCompressedData. | 28 // duplicate (a cheap operation) preserves const on fCompressedData. |
| 24 SkAutoTDelete<SkStreamRewindable> dup(fCompressedData->duplicate()); | 29 SkAutoTDelete<SkStreamRewindable> dup(fCompressedData->duplicate()); |
| 25 SkASSERT(dup); | 30 SkASSERT(dup); |
| 26 SkASSERT(dup->hasLength()); | 31 SkASSERT(dup->hasLength()); |
| 27 stream->writeText(" stream\n"); | 32 stream->writeText(" stream\n"); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 46 dup->getLength() <= length + strlen("/Filter_/FlateDecode_")) { | 51 dup->getLength() <= length + strlen("/Filter_/FlateDecode_")) { |
| 47 this->insertInt("Length", dup->getLength()); | 52 this->insertInt("Length", dup->getLength()); |
| 48 fCompressedData.reset(dup.release()); | 53 fCompressedData.reset(dup.release()); |
| 49 return; | 54 return; |
| 50 } | 55 } |
| 51 } | 56 } |
| 52 fCompressedData.reset(compressedData.detachAsStream()); | 57 fCompressedData.reset(compressedData.detachAsStream()); |
| 53 this->insertName("Filter", "FlateDecode"); | 58 this->insertName("Filter", "FlateDecode"); |
| 54 this->insertInt("Length", length); | 59 this->insertInt("Length", length); |
| 55 } | 60 } |
| OLD | NEW |