Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(721)

Side by Side Diff: src/pdf/SkPDFImage.cpp

Issue 918813002: PDF: Add (low-memory) SkPDFBitmap class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: mutable bitmaps get copied Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pdf/SkPDFCanon.cpp ('k') | tests/DeflateWStream.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 && (0 == memcmp(data->bytes() + 6, bytesSixToTen, 722 && (0 == memcmp(data->bytes() + 6, bytesSixToTen,
722 sizeof(bytesSixToTen)))); 723 sizeof(bytesSixToTen))));
723 } 724 }
724 } // namespace 725 } // namespace
725 #endif 726 #endif
726 727
727 SkPDFObject* SkPDFCreateImageObject( 728 SkPDFObject* SkPDFCreateImageObject(
728 const SkBitmap& bitmap, 729 const SkBitmap& bitmap,
729 const SkIRect& subset, 730 const SkIRect& subset,
730 SkPicture::EncodeBitmap encoder) { 731 SkPicture::EncodeBitmap encoder) {
732 if (SkPDFObject* pdfBitmap = SkPDFBitmap::Create(bitmap, subset)) {
733 return pdfBitmap;
734 }
731 #if 0 // reenable when we can figure out the JPEG colorspace 735 #if 0 // reenable when we can figure out the JPEG colorspace
732 if (SkIRect::MakeWH(bitmap.width(), bitmap.height()) == subset) { 736 if (SkIRect::MakeWH(bitmap.width(), bitmap.height()) == subset) {
733 SkAutoTUnref<SkData> encodedData(ref_encoded_data(bitmap)); 737 SkAutoTUnref<SkData> encodedData(ref_encoded_data(bitmap));
734 if (is_jfif_jpeg(encodedData)) { 738 if (is_jfif_jpeg(encodedData)) {
735 return SkNEW_ARGS(PDFJPEGImage, 739 return SkNEW_ARGS(PDFJPEGImage,
736 (encodedData, bitmap.width(), bitmap.height())); 740 (encodedData, bitmap.width(), bitmap.height()));
737 } 741 }
738 } 742 }
739 #endif 743 #endif
740 return SkPDFImage::CreateImage(bitmap, subset, encoder); 744 return SkPDFImage::CreateImage(bitmap, subset, encoder);
741 } 745 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFCanon.cpp ('k') | tests/DeflateWStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698