| 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" |
| 11 #include "SkImage_Base.h" | 11 #include "SkImage_Base.h" |
| 12 #include "SkJpegInfo.h" | 12 #include "SkJpegInfo.h" |
| 13 #include "SkPDFBitmap.h" | 13 #include "SkPDFBitmap.h" |
| 14 #include "SkPDFCanon.h" | 14 #include "SkPDFCanon.h" |
| 15 #include "SkPDFTypes.h" |
| 15 #include "SkStream.h" | 16 #include "SkStream.h" |
| 16 #include "SkUnPreMultiply.h" | 17 #include "SkUnPreMultiply.h" |
| 17 | 18 |
| 18 void image_get_ro_pixels(const SkImage* image, SkBitmap* dst) { | 19 void image_get_ro_pixels(const SkImage* image, SkBitmap* dst) { |
| 19 if(as_IB(image)->getROPixels(dst) | 20 if(as_IB(image)->getROPixels(dst) |
| 20 && dst->dimensions() == image->dimensions()) { | 21 && dst->dimensions() == image->dimensions()) { |
| 21 if (dst->colorType() != kIndex_8_SkColorType) { | 22 if (dst->colorType() != kIndex_8_SkColorType) { |
| 22 return; | 23 return; |
| 23 } | 24 } |
| 24 // We must check to see if the bitmap has a color table. | 25 // We must check to see if the bitmap has a color table. |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 528 |
| 528 sk_sp<SkPDFObject> smask; | 529 sk_sp<SkPDFObject> smask; |
| 529 if (!image_compute_is_opaque(image.get())) { | 530 if (!image_compute_is_opaque(image.get())) { |
| 530 smask = sk_make_sp<PDFAlphaBitmap>(image); | 531 smask = sk_make_sp<PDFAlphaBitmap>(image); |
| 531 } | 532 } |
| 532 #ifdef SK_PDF_IMAGE_STATS | 533 #ifdef SK_PDF_IMAGE_STATS |
| 533 gRegularImageObjects.fetch_add(1); | 534 gRegularImageObjects.fetch_add(1); |
| 534 #endif | 535 #endif |
| 535 return sk_make_sp<PDFDefaultBitmap>(std::move(image), std::move(smask)); | 536 return sk_make_sp<PDFDefaultBitmap>(std::move(image), std::move(smask)); |
| 536 } | 537 } |
| OLD | NEW |