| 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 // 0 1 2 3 4 5 6 7 8 9 10 | 680 // 0 1 2 3 4 5 6 7 8 9 10 |
| 681 // FF D8 FF E0 ?? ?? 'J' 'F' 'I' 'F' 00 ... | 681 // FF D8 FF E0 ?? ?? 'J' 'F' 'I' 'F' 00 ... |
| 682 return ((0 == memcmp(data->bytes(), bytesZeroToThree, | 682 return ((0 == memcmp(data->bytes(), bytesZeroToThree, |
| 683 sizeof(bytesZeroToThree))) | 683 sizeof(bytesZeroToThree))) |
| 684 && (0 == memcmp(data->bytes() + 6, bytesSixToTen, | 684 && (0 == memcmp(data->bytes() + 6, bytesSixToTen, |
| 685 sizeof(bytesSixToTen)))); | 685 sizeof(bytesSixToTen)))); |
| 686 } | 686 } |
| 687 } // namespace | 687 } // namespace |
| 688 #endif | 688 #endif |
| 689 | 689 |
| 690 SkPDFObject* SkPDFCreateImageObject( | 690 SkPDFObject* SkPDFCreateImageObject(SkPDFCanon* canon, |
| 691 const SkBitmap& bitmap, | 691 const SkBitmap& bitmap, |
| 692 const SkIRect& subset) { | 692 const SkIRect& subset) { |
| 693 if (SkPDFObject* pdfBitmap = SkPDFBitmap::Create(bitmap, subset)) { | 693 if (SkPDFObject* pdfBitmap = SkPDFBitmap::Create(canon, bitmap, subset)) { |
| 694 return pdfBitmap; | 694 return pdfBitmap; |
| 695 } | 695 } |
| 696 #if 0 // reenable when we can figure out the JPEG colorspace | 696 #if 0 // reenable when we can figure out the JPEG colorspace |
| 697 if (SkIRect::MakeWH(bitmap.width(), bitmap.height()) == subset) { | 697 if (SkIRect::MakeWH(bitmap.width(), bitmap.height()) == subset) { |
| 698 SkAutoTUnref<SkData> encodedData(ref_encoded_data(bitmap)); | 698 SkAutoTUnref<SkData> encodedData(ref_encoded_data(bitmap)); |
| 699 if (is_jfif_jpeg(encodedData)) { | 699 if (is_jfif_jpeg(encodedData)) { |
| 700 return SkNEW_ARGS(PDFJPEGImage, | 700 return SkNEW_ARGS(PDFJPEGImage, |
| 701 (encodedData, bitmap.width(), bitmap.height())); | 701 (encodedData, bitmap.width(), bitmap.height())); |
| 702 } | 702 } |
| 703 } | 703 } |
| 704 #endif | 704 #endif |
| 705 return SkPDFImage::CreateImage(bitmap, subset); | 705 return SkPDFImage::CreateImage(bitmap, subset); |
| 706 } | 706 } |
| OLD | NEW |