OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
9 #include "SkFlate.h" | 9 #include "SkFlate.h" |
10 #include "SkPDFBitmap.h" | 10 #include "SkPDFBitmap.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 pdfDict.insertName("ColorSpace", "DeviceGray"); | 279 pdfDict.insertName("ColorSpace", "DeviceGray"); |
280 pdfDict.insertInt("BitsPerComponent", 8); | 280 pdfDict.insertInt("BitsPerComponent", 8); |
281 pdfDict.insertName("Filter", "FlateDecode"); | 281 pdfDict.insertName("Filter", "FlateDecode"); |
282 pdfDict.insertInt("Length", length); | 282 pdfDict.insertInt("Length", length); |
283 pdfDict.emitObject(stream, catalog); | 283 pdfDict.emitObject(stream, catalog); |
284 } | 284 } |
285 } // namespace | 285 } // namespace |
286 | 286 |
287 //////////////////////////////////////////////////////////////////////////////// | 287 //////////////////////////////////////////////////////////////////////////////// |
288 | 288 |
289 void SkPDFBitmap::addResources(SkTSet<SkPDFObject*>* resourceSet, | 289 void SkPDFBitmap::addResources(SkPDFCatalog* catalog) const { |
290 SkPDFCatalog* catalog) const { | |
291 if (fSMask.get()) { | 290 if (fSMask.get()) { |
292 if (resourceSet->add(fSMask.get())) { | 291 if (catalog->addObject(fSMask.get())) { |
293 fSMask->addResources(resourceSet, catalog); | 292 fSMask->addResources(catalog); |
294 } | 293 } |
295 } | 294 } |
296 } | 295 } |
297 | 296 |
298 void SkPDFBitmap::emitObject(SkWStream* stream, SkPDFCatalog* catalog) { | 297 void SkPDFBitmap::emitObject(SkWStream* stream, SkPDFCatalog* catalog) { |
299 SkAutoLockPixels autoLockPixels(fBitmap); | 298 SkAutoLockPixels autoLockPixels(fBitmap); |
300 SkASSERT(fBitmap.colorType() != kIndex_8_SkColorType || | 299 SkASSERT(fBitmap.colorType() != kIndex_8_SkColorType || |
301 fBitmap.getColorTable()); | 300 fBitmap.getColorTable()); |
302 | 301 |
303 // Write to a temporary buffer to get the compressed length. | 302 // Write to a temporary buffer to get the compressed length. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 return SkRef(canonBitmap); | 399 return SkRef(canonBitmap); |
401 } | 400 } |
402 SkPDFObject* smask = NULL; | 401 SkPDFObject* smask = NULL; |
403 if (!bm.isOpaque() && !SkBitmap::ComputeIsOpaque(bm)) { | 402 if (!bm.isOpaque() && !SkBitmap::ComputeIsOpaque(bm)) { |
404 smask = SkNEW_ARGS(PDFAlphaBitmap, (bm)); | 403 smask = SkNEW_ARGS(PDFAlphaBitmap, (bm)); |
405 } | 404 } |
406 SkPDFBitmap* pdfBitmap = SkNEW_ARGS(SkPDFBitmap, (bm, smask)); | 405 SkPDFBitmap* pdfBitmap = SkNEW_ARGS(SkPDFBitmap, (bm, smask)); |
407 canon->addBitmap(pdfBitmap); | 406 canon->addBitmap(pdfBitmap); |
408 return pdfBitmap; | 407 return pdfBitmap; |
409 } | 408 } |
OLD | NEW |