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 removeLength = false; | 38 removeLength = false; |
39 } | 39 } |
40 this->mergeFrom(pdfStream); | 40 this->mergeFrom(pdfStream); |
41 if (removeLength) { | 41 if (removeLength) { |
42 this->remove("Length"); | 42 this->remove("Length"); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 SkPDFStream::~SkPDFStream() {} | 46 SkPDFStream::~SkPDFStream() {} |
47 | 47 |
48 void SkPDFStream::emitObject(SkWStream* stream, SkPDFCatalog* catalog, | 48 void SkPDFStream::emitObject(SkWStream* stream, SkPDFCatalog* catalog) { |
49 bool indirect) { | |
50 if (indirect) { | |
51 return emitIndirectObject(stream, catalog); | |
52 } | |
53 SkAutoMutexAcquire lock(fMutex); // multiple threads could be calling emit | 49 SkAutoMutexAcquire lock(fMutex); // multiple threads could be calling emit |
54 if (!this->populate(catalog)) { | 50 if (!this->populate(catalog)) { |
55 return fSubstitute->emitObject(stream, catalog, indirect); | 51 return fSubstitute->emitObject(stream, catalog); |
56 } | 52 } |
57 | 53 |
58 this->INHERITED::emitObject(stream, catalog, false); | 54 this->INHERITED::emitObject(stream, catalog); |
59 stream->writeText(" stream\n"); | 55 stream->writeText(" stream\n"); |
60 stream->writeStream(fDataStream.get(), fDataStream->getLength()); | 56 stream->writeStream(fDataStream.get(), fDataStream->getLength()); |
61 SkAssertResult(fDataStream->rewind()); | 57 SkAssertResult(fDataStream->rewind()); |
62 stream->writeText("\nendstream"); | 58 stream->writeText("\nendstream"); |
63 } | 59 } |
64 | 60 |
65 size_t SkPDFStream::getOutputSize(SkPDFCatalog* catalog, bool indirect) { | 61 size_t SkPDFStream::getOutputSize(SkPDFCatalog* catalog, bool indirect) { |
66 if (indirect) { | 62 if (indirect) { |
67 return getIndirectOutputSize(catalog); | 63 return getIndirectOutputSize(catalog); |
68 } | 64 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } else if (fState == kNoCompression_State && !skip_compression(catalog) && | 123 } else if (fState == kNoCompression_State && !skip_compression(catalog) && |
128 SkFlate::HaveFlate()) { | 124 SkFlate::HaveFlate()) { |
129 if (!fSubstitute.get()) { | 125 if (!fSubstitute.get()) { |
130 fSubstitute.reset(new SkPDFStream(*this)); | 126 fSubstitute.reset(new SkPDFStream(*this)); |
131 catalog->setSubstitute(this, fSubstitute.get()); | 127 catalog->setSubstitute(this, fSubstitute.get()); |
132 } | 128 } |
133 return false; | 129 return false; |
134 } | 130 } |
135 return true; | 131 return true; |
136 } | 132 } |
OLD | NEW |