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 "SkFlate.h" | 11 #include "SkFlate.h" |
12 #include "SkPDFCatalog.h" | 12 #include "SkPDFCatalog.h" |
13 #include "SkPDFStream.h" | 13 #include "SkPDFStream.h" |
14 #include "SkStream.h" | 14 #include "SkStream.h" |
15 | 15 |
16 static bool skip_compression(SkPDFCatalog* catalog) { | 16 static bool skip_compression(SkPDFCatalog* catalog) { |
17 return SkToBool(catalog->getDocumentFlags() & | 17 return SkToBool(catalog->getDocumentFlags() & |
18 SkPDFDocument::kNoCompression_Flags); | 18 SkPDFDocument::kFavorSpeedOverSize_Flags); |
19 } | 19 } |
20 | 20 |
21 SkPDFStream::SkPDFStream(SkStream* stream) | 21 SkPDFStream::SkPDFStream(SkStream* stream) |
22 : fState(kUnused_State), | 22 : fState(kUnused_State), |
23 fData(stream) { | 23 fData(stream) { |
24 SkSafeRef(stream); | 24 SkSafeRef(stream); |
25 } | 25 } |
26 | 26 |
27 SkPDFStream::SkPDFStream(SkData* data) : fState(kUnused_State) { | 27 SkPDFStream::SkPDFStream(SkData* data) : fState(kUnused_State) { |
28 SkMemoryStream* stream = new SkMemoryStream; | 28 SkMemoryStream* stream = new SkMemoryStream; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } else if (fState == kNoCompression_State && !skip_compression(catalog) && | 109 } else if (fState == kNoCompression_State && !skip_compression(catalog) && |
110 SkFlate::HaveFlate()) { | 110 SkFlate::HaveFlate()) { |
111 if (!fSubstitute.get()) { | 111 if (!fSubstitute.get()) { |
112 fSubstitute.reset(new SkPDFStream(*this)); | 112 fSubstitute.reset(new SkPDFStream(*this)); |
113 catalog->setSubstitute(this, fSubstitute.get()); | 113 catalog->setSubstitute(this, fSubstitute.get()); |
114 } | 114 } |
115 return false; | 115 return false; |
116 } | 116 } |
117 return true; | 117 return true; |
118 } | 118 } |
OLD | NEW |