| 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 if (SkPDFObject* pdfBitmap = SkPDFBitmap::Create(bitmap, subset)) { |
| 728 return pdfBitmap; |
| 729 } |
| 726 #if 0 // reenable when we can figure out the JPEG colorspace | 730 #if 0 // reenable when we can figure out the JPEG colorspace |
| 727 if (SkIRect::MakeWH(bitmap.width(), bitmap.height()) == subset) { | 731 if (SkIRect::MakeWH(bitmap.width(), bitmap.height()) == subset) { |
| 728 SkAutoTUnref<SkData> encodedData(ref_encoded_data(bitmap)); | 732 SkAutoTUnref<SkData> encodedData(ref_encoded_data(bitmap)); |
| 729 if (is_jfif_jpeg(encodedData)) { | 733 if (is_jfif_jpeg(encodedData)) { |
| 730 return SkNEW_ARGS(PDFJPEGImage, | 734 return SkNEW_ARGS(PDFJPEGImage, |
| 731 (encodedData, bitmap.width(), bitmap.height())); | 735 (encodedData, bitmap.width(), bitmap.height())); |
| 732 } | 736 } |
| 733 } | 737 } |
| 734 #endif | 738 #endif |
| 735 return SkPDFImage::CreateImage(bitmap, subset, encoder); | 739 return SkPDFImage::CreateImage(bitmap, subset, encoder); |
| 736 } | 740 } |
| OLD | NEW |