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

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

Issue 935843007: Remove unused parameters to SkDocument::CreatePDF (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove SkPicture::EncodeBitmap 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/SkPDFImage.h ('k') | tools/render_pdfs_main.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"
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 } 451 }
452 452
453 outBitmap.setImmutable(); 453 outBitmap.setImmutable();
454 454
455 return outBitmap; 455 return outBitmap;
456 } 456 }
457 457
458 // static 458 // static
459 SkPDFImage* SkPDFImage::CreateImage(const SkBitmap& bitmap, 459 SkPDFImage* SkPDFImage::CreateImage(const SkBitmap& bitmap,
460 const SkIRect& srcRect, 460 const SkIRect& srcRect,
461 SkPicture::EncodeBitmap encoder) { 461 SkData* (*encoder)(size_t*, const SkBitmap&) ) {
462 if (bitmap.colorType() == kUnknown_SkColorType) { 462 if (bitmap.colorType() == kUnknown_SkColorType) {
463 return NULL; 463 return NULL;
464 } 464 }
465 465
466 bool isTransparent = false; 466 bool isTransparent = false;
467 SkAutoTDelete<SkStream> alphaData; 467 SkAutoTDelete<SkStream> alphaData;
468 if (!bitmap.isOpaque()) { 468 if (!bitmap.isOpaque()) {
469 // Note that isOpaque is not guaranteed to return false for bitmaps 469 // Note that isOpaque is not guaranteed to return false for bitmaps
470 // with alpha support but a completely opaque alpha channel, 470 // with alpha support but a completely opaque alpha channel,
471 // so alphaData may still be NULL if we have a completely opaque 471 // so alphaData may still be NULL if we have a completely opaque
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 } 504 }
505 return image; 505 return image;
506 } 506 }
507 507
508 SkPDFImage::~SkPDFImage() {} 508 SkPDFImage::~SkPDFImage() {}
509 509
510 SkPDFImage::SkPDFImage(SkStream* stream, 510 SkPDFImage::SkPDFImage(SkStream* stream,
511 const SkBitmap& bitmap, 511 const SkBitmap& bitmap,
512 bool isAlpha, 512 bool isAlpha,
513 const SkIRect& srcRect, 513 const SkIRect& srcRect,
514 SkPicture::EncodeBitmap encoder) 514 SkData* (*encoder)(size_t*, const SkBitmap&))
515 : fIsAlpha(isAlpha), 515 : fIsAlpha(isAlpha),
516 fSrcRect(srcRect), 516 fSrcRect(srcRect),
517 fEncoder(encoder) { 517 fEncoder(encoder) {
518 518
519 if (bitmap.isImmutable()) { 519 if (bitmap.isImmutable()) {
520 fBitmap = bitmap; 520 fBitmap = bitmap;
521 } else { 521 } else {
522 bitmap.deepCopyTo(&fBitmap); 522 bitmap.deepCopyTo(&fBitmap);
523 fBitmap.setImmutable(); 523 fBitmap.setImmutable();
524 } 524 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 sizeof(bytesZeroToThree))) 713 sizeof(bytesZeroToThree)))
714 && (0 == memcmp(data->bytes() + 6, bytesSixToTen, 714 && (0 == memcmp(data->bytes() + 6, bytesSixToTen,
715 sizeof(bytesSixToTen)))); 715 sizeof(bytesSixToTen))));
716 } 716 }
717 } // namespace 717 } // namespace
718 #endif 718 #endif
719 719
720 SkPDFObject* SkPDFCreateImageObject( 720 SkPDFObject* SkPDFCreateImageObject(
721 const SkBitmap& bitmap, 721 const SkBitmap& bitmap,
722 const SkIRect& subset, 722 const SkIRect& subset,
723 SkPicture::EncodeBitmap encoder) { 723 SkData* (*encoder)(size_t*, const SkBitmap&)) {
724 if (SkPDFObject* pdfBitmap = SkPDFBitmap::Create(bitmap, subset)) { 724 if (SkPDFObject* pdfBitmap = SkPDFBitmap::Create(bitmap, subset)) {
725 return pdfBitmap; 725 return pdfBitmap;
726 } 726 }
727 #if 0 // reenable when we can figure out the JPEG colorspace 727 #if 0 // reenable when we can figure out the JPEG colorspace
728 if (SkIRect::MakeWH(bitmap.width(), bitmap.height()) == subset) { 728 if (SkIRect::MakeWH(bitmap.width(), bitmap.height()) == subset) {
729 SkAutoTUnref<SkData> encodedData(ref_encoded_data(bitmap)); 729 SkAutoTUnref<SkData> encodedData(ref_encoded_data(bitmap));
730 if (is_jfif_jpeg(encodedData)) { 730 if (is_jfif_jpeg(encodedData)) {
731 return SkNEW_ARGS(PDFJPEGImage, 731 return SkNEW_ARGS(PDFJPEGImage,
732 (encodedData, bitmap.width(), bitmap.height())); 732 (encodedData, bitmap.width(), bitmap.height()));
733 } 733 }
734 } 734 }
735 #endif 735 #endif
736 return SkPDFImage::CreateImage(bitmap, subset, encoder); 736 return SkPDFImage::CreateImage(bitmap, subset, encoder);
737 } 737 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFImage.h ('k') | tools/render_pdfs_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698