| 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" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 SkDeflateWStream deflateWStream(&compressedData); | 38 SkDeflateWStream deflateWStream(&compressedData); |
| 39 SkStreamCopy(&deflateWStream, stream); | 39 SkStreamCopy(&deflateWStream, stream); |
| 40 deflateWStream.finalize(); | 40 deflateWStream.finalize(); |
| 41 size_t length = compressedData.bytesWritten(); | 41 size_t length = compressedData.bytesWritten(); |
| 42 | 42 |
| 43 if (stream->hasLength()) { | 43 if (stream->hasLength()) { |
| 44 SkAutoTDelete<SkStreamRewindable> dup(stream->duplicate()); | 44 SkAutoTDelete<SkStreamRewindable> dup(stream->duplicate()); |
| 45 if (dup && dup->hasLength() && | 45 if (dup && dup->hasLength() && |
| 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.release()); |
| 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 } |
| OLD | NEW |