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