OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
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 "SkPDFImage.h" | 8 #include "SkPDFImage.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 } | 623 } |
624 } | 624 } |
625 // Fallback method | 625 // Fallback method |
626 if (!fStreamValid) { | 626 if (!fStreamValid) { |
627 SkAutoTDelete<SkStream> stream( | 627 SkAutoTDelete<SkStream> stream( |
628 extract_image_data(fBitmap, fSrcRect, fIsAlpha, NULL)); | 628 extract_image_data(fBitmap, fSrcRect, fIsAlpha, NULL)); |
629 this->setData(stream); | 629 this->setData(stream); |
630 fStreamValid = true; | 630 fStreamValid = true; |
631 } | 631 } |
632 return INHERITED::populate(catalog); | 632 return INHERITED::populate(catalog); |
633 } else if (getState() == kNoCompression_State && | 633 } |
634 !skip_compression(catalog) && | 634 #ifndef SK_NO_FLATE |
635 (SkFlate::HaveFlate() || fEncoder)) { | 635 else if (getState() == kNoCompression_State && !skip_compression(catalog)) { |
| 636 #else // SK_NO_FLATE |
| 637 else if (getState() == kNoCompression_State && |
| 638 !skip_compression(catalog) && |
| 639 fEncoder) { |
| 640 #endif // SK_NO_FLATE |
636 // Compression has not been requested when the stream was first created, | 641 // Compression has not been requested when the stream was first created, |
637 // but the new catalog wants it compressed. | 642 // but the new catalog wants it compressed. |
638 if (!getSubstitute()) { | 643 if (!getSubstitute()) { |
639 SkPDFStream* substitute = SkNEW_ARGS(SkPDFImage, (*this)); | 644 SkPDFStream* substitute = SkNEW_ARGS(SkPDFImage, (*this)); |
640 setSubstitute(substitute); | 645 setSubstitute(substitute); |
641 catalog->setSubstitute(this, substitute); | 646 catalog->setSubstitute(this, substitute); |
642 } | 647 } |
643 return false; | 648 return false; |
644 } | 649 } |
645 return true; | 650 return true; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 if (SkIRect::MakeWH(bitmap.width(), bitmap.height()) == subset) { | 732 if (SkIRect::MakeWH(bitmap.width(), bitmap.height()) == subset) { |
728 SkAutoTUnref<SkData> encodedData(ref_encoded_data(bitmap)); | 733 SkAutoTUnref<SkData> encodedData(ref_encoded_data(bitmap)); |
729 if (is_jfif_jpeg(encodedData)) { | 734 if (is_jfif_jpeg(encodedData)) { |
730 return SkNEW_ARGS(PDFJPEGImage, | 735 return SkNEW_ARGS(PDFJPEGImage, |
731 (encodedData, bitmap.width(), bitmap.height())); | 736 (encodedData, bitmap.width(), bitmap.height())); |
732 } | 737 } |
733 } | 738 } |
734 #endif | 739 #endif |
735 return SkPDFImage::CreateImage(bitmap, subset, encoder); | 740 return SkPDFImage::CreateImage(bitmap, subset, encoder); |
736 } | 741 } |
OLD | NEW |