| 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 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 this->mergeFrom(pdfStream); | 35 this->mergeFrom(pdfStream); |
| 36 if (removeLength) { | 36 if (removeLength) { |
| 37 this->remove("Length"); | 37 this->remove("Length"); |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 SkPDFStream::~SkPDFStream() {} | 41 SkPDFStream::~SkPDFStream() {} |
| 42 | 42 |
| 43 void SkPDFStream::emitObject(SkWStream* stream, SkPDFCatalog* catalog) { | 43 void SkPDFStream::emitObject(SkWStream* stream, SkPDFCatalog* catalog) { |
| 44 SkAutoMutexAcquire lock(fMutex); // multiple threads could be calling emit | |
| 45 if (!this->populate(catalog)) { | 44 if (!this->populate(catalog)) { |
| 46 return fSubstitute->emitObject(stream, catalog); | 45 return fSubstitute->emitObject(stream, catalog); |
| 47 } | 46 } |
| 48 | 47 |
| 49 this->INHERITED::emitObject(stream, catalog); | 48 this->INHERITED::emitObject(stream, catalog); |
| 50 stream->writeText(" stream\n"); | 49 stream->writeText(" stream\n"); |
| 51 stream->writeStream(fDataStream.get(), fDataStream->getLength()); | 50 stream->writeStream(fDataStream.get(), fDataStream->getLength()); |
| 52 SkAssertResult(fDataStream->rewind()); | 51 SkAssertResult(fDataStream->rewind()); |
| 53 stream->writeText("\nendstream"); | 52 stream->writeText("\nendstream"); |
| 54 } | 53 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 else if (fState == kNoCompression_State) { | 105 else if (fState == kNoCompression_State) { |
| 107 if (!fSubstitute.get()) { | 106 if (!fSubstitute.get()) { |
| 108 fSubstitute.reset(new SkPDFStream(*this)); | 107 fSubstitute.reset(new SkPDFStream(*this)); |
| 109 catalog->setSubstitute(this, fSubstitute.get()); | 108 catalog->setSubstitute(this, fSubstitute.get()); |
| 110 } | 109 } |
| 111 return false; | 110 return false; |
| 112 } | 111 } |
| 113 return true; | 112 return true; |
| 114 #endif // SK_NO_FLATE | 113 #endif // SK_NO_FLATE |
| 115 } | 114 } |
| OLD | NEW |