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 "SkData.h" | 9 #include "SkData.h" |
10 #include "SkDeflate.h" | 10 #include "SkDeflate.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 SkAutoTUnref<const SkImage> fImage; | 357 SkAutoTUnref<const SkImage> fImage; |
358 }; | 358 }; |
359 | 359 |
360 } // namespace | 360 } // namespace |
361 | 361 |
362 //////////////////////////////////////////////////////////////////////////////// | 362 //////////////////////////////////////////////////////////////////////////////// |
363 | 363 |
364 namespace { | 364 namespace { |
365 class PDFDefaultBitmap : public SkPDFObject { | 365 class PDFDefaultBitmap : public SkPDFObject { |
366 public: | 366 public: |
367 void emitObject(SkWStream* stream, | 367 void emitObject(SkWStream* stream, |
368 const SkPDFObjNumMap& objNumMap, | 368 const SkPDFObjNumMap& objNumMap, |
369 const SkPDFSubstituteMap& subs) const override { | 369 const SkPDFSubstituteMap& substitutes) const override { |
370 emit_image_xobject(stream, fImage, false, fSMask, objNumMap, subs); | 370 emit_image_xobject(stream, fImage, false, fSMask, objNumMap, substitutes
); |
371 } | 371 } |
372 void addResources(SkPDFObjNumMap* catalog, | 372 void addResources(SkPDFObjNumMap* catalog, |
373 const SkPDFSubstituteMap& subs) const override { | 373 const SkPDFSubstituteMap& substitutes) const override { |
374 if (fSMask.get()) { | 374 if (fSMask.get()) { |
375 SkPDFObject* obj = subs.getSubstitute(fSMask.get()); | 375 SkPDFObject* obj = substitutes.getSubstitute(fSMask.get()); |
376 SkASSERT(obj); | 376 SkASSERT(obj); |
377 catalog->addObjectRecursively(obj, subs); | 377 if (catalog->addObject(obj)) { |
| 378 obj->addResources(catalog, substitutes); |
| 379 } |
378 } | 380 } |
379 } | 381 } |
380 PDFDefaultBitmap(const SkImage* image, SkPDFObject* smask) | 382 PDFDefaultBitmap(const SkImage* image, SkPDFObject* smask) |
381 : fImage(SkRef(image)), fSMask(smask) {} | 383 : fImage(SkRef(image)), fSMask(smask) {} |
382 | 384 |
383 private: | 385 private: |
384 SkAutoTUnref<const SkImage> fImage; | 386 SkAutoTUnref<const SkImage> fImage; |
385 const SkAutoTUnref<SkPDFObject> fSMask; | 387 const SkAutoTUnref<SkPDFObject> fSMask; |
386 }; | 388 }; |
387 } // namespace | 389 } // namespace |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 return new PDFJpegBitmap(info.fSize, data, yuv); | 446 return new PDFJpegBitmap(info.fSize, data, yuv); |
445 } | 447 } |
446 } | 448 } |
447 SkPDFObject* smask = | 449 SkPDFObject* smask = |
448 image_compute_is_opaque(image) ? nullptr : new PDFAlphaBitmap(image)
; | 450 image_compute_is_opaque(image) ? nullptr : new PDFAlphaBitmap(image)
; |
449 #ifdef SK_PDF_IMAGE_STATS | 451 #ifdef SK_PDF_IMAGE_STATS |
450 gRegularImageObjects.fetch_add(1); | 452 gRegularImageObjects.fetch_add(1); |
451 #endif | 453 #endif |
452 return new PDFDefaultBitmap(image, smask); | 454 return new PDFDefaultBitmap(image, smask); |
453 } | 455 } |
OLD | NEW |