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" |
11 #include "SkColor.h" | 11 #include "SkColor.h" |
12 #include "SkColorPriv.h" | 12 #include "SkColorPriv.h" |
13 #include "SkData.h" | 13 #include "SkData.h" |
14 #include "SkFlate.h" | 14 #include "SkFlate.h" |
15 #include "SkPDFBitmap.h" | |
15 #include "SkPDFCatalog.h" | 16 #include "SkPDFCatalog.h" |
16 #include "SkPixelRef.h" | 17 #include "SkPixelRef.h" |
17 #include "SkRect.h" | 18 #include "SkRect.h" |
18 #include "SkStream.h" | 19 #include "SkStream.h" |
19 #include "SkString.h" | 20 #include "SkString.h" |
20 #include "SkUnPreMultiply.h" | 21 #include "SkUnPreMultiply.h" |
21 | 22 |
22 static const int kNoColorTransform = 0; | 23 static const int kNoColorTransform = 0; |
23 | 24 |
24 static bool skip_compression(SkPDFCatalog* catalog) { | 25 static bool skip_compression(SkPDFCatalog* catalog) { |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
716 && (0 == memcmp(data->bytes() + 6, bytesSixToTen, | 717 && (0 == memcmp(data->bytes() + 6, bytesSixToTen, |
717 sizeof(bytesSixToTen)))); | 718 sizeof(bytesSixToTen)))); |
718 } | 719 } |
719 } // namespace | 720 } // namespace |
720 #endif | 721 #endif |
721 | 722 |
722 SkPDFObject* SkPDFCreateImageObject( | 723 SkPDFObject* SkPDFCreateImageObject( |
723 const SkBitmap& bitmap, | 724 const SkBitmap& bitmap, |
724 const SkIRect& subset, | 725 const SkIRect& subset, |
725 SkPicture::EncodeBitmap encoder) { | 726 SkPicture::EncodeBitmap encoder) { |
727 SkPDFObject* pdfBitmap = SkPDFBitmap::Create(bitmap, subset); | |
728 if (pdfBitmap) { | |
mtklein
2015/02/12 00:21:46
Even
if (SkPDFObject* pdfBitmap = SkPDFBitmap::Cr
hal.canary
2015/02/12 21:28:03
Done.
| |
729 return pdfBitmap; | |
730 } | |
726 #if 0 // reenable when we can figure out the JPEG colorspace | 731 #if 0 // reenable when we can figure out the JPEG colorspace |
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 |