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/SkPDFBitmap.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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/SkPDFBitmap.h ('k') | src/pdf/SkPDFCanon.h » ('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 2015 Google Inc. 2 * Copyright 2015 Google Inc.
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 "SkColorPriv.h" 8 #include "SkColorPriv.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkDeflate.h" 10 #include "SkDeflate.h"
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 pdf_stream_end(stream); 432 pdf_stream_end(stream);
433 } 433 }
434 } // namespace 434 } // namespace
435 435
436 //////////////////////////////////////////////////////////////////////////////// 436 ////////////////////////////////////////////////////////////////////////////////
437 437
438 SkPDFBitmap* SkPDFBitmap::Create(SkPDFCanon* canon, const SkBitmap& bitmap) { 438 SkPDFBitmap* SkPDFBitmap::Create(SkPDFCanon* canon, const SkBitmap& bitmap) {
439 SkASSERT(canon); 439 SkASSERT(canon);
440 if (!SkColorTypeIsValid(bitmap.colorType()) || 440 if (!SkColorTypeIsValid(bitmap.colorType()) ||
441 kUnknown_SkColorType == bitmap.colorType()) { 441 kUnknown_SkColorType == bitmap.colorType()) {
442 return NULL; 442 return nullptr;
443 } 443 }
444 SkBitmap copy; 444 SkBitmap copy;
445 const SkBitmap& bm = immutable_bitmap(bitmap, &copy); 445 const SkBitmap& bm = immutable_bitmap(bitmap, &copy);
446 if (bm.drawsNothing()) { 446 if (bm.drawsNothing()) {
447 return NULL; 447 return nullptr;
448 } 448 }
449 if (SkPDFBitmap* canonBitmap = canon->findBitmap(bm)) { 449 if (SkPDFBitmap* canonBitmap = canon->findBitmap(bm)) {
450 return SkRef(canonBitmap); 450 return SkRef(canonBitmap);
451 } 451 }
452 452
453 if (bm.pixelRef() && bm.pixelRefOrigin().isZero() && 453 if (bm.pixelRef() && bm.pixelRefOrigin().isZero() &&
454 bm.dimensions() == bm.pixelRef()->info().dimensions()) { 454 bm.dimensions() == bm.pixelRef()->info().dimensions()) {
455 // Requires the bitmap to be backed by lazy pixels. 455 // Requires the bitmap to be backed by lazy pixels.
456 SkAutoTUnref<SkData> data(bm.pixelRef()->refEncodedData()); 456 SkAutoTUnref<SkData> data(bm.pixelRef()->refEncodedData());
457 SkJFIFInfo info; 457 SkJFIFInfo info;
458 if (data && SkIsJFIF(data, &info)) { 458 if (data && SkIsJFIF(data, &info)) {
459 bool yuv = info.fType == SkJFIFInfo::kYCbCr; 459 bool yuv = info.fType == SkJFIFInfo::kYCbCr;
460 SkPDFBitmap* pdfBitmap = new PDFJpegBitmap(bm, data, yuv); 460 SkPDFBitmap* pdfBitmap = new PDFJpegBitmap(bm, data, yuv);
461 canon->addBitmap(pdfBitmap); 461 canon->addBitmap(pdfBitmap);
462 return pdfBitmap; 462 return pdfBitmap;
463 } 463 }
464 } 464 }
465 465
466 SkPDFObject* smask = NULL; 466 SkPDFObject* smask = nullptr;
467 if (!bm.isOpaque() && !SkBitmap::ComputeIsOpaque(bm)) { 467 if (!bm.isOpaque() && !SkBitmap::ComputeIsOpaque(bm)) {
468 smask = new PDFAlphaBitmap(bm); 468 smask = new PDFAlphaBitmap(bm);
469 } 469 }
470 SkPDFBitmap* pdfBitmap = new PDFDefaultBitmap(bm, smask); 470 SkPDFBitmap* pdfBitmap = new PDFDefaultBitmap(bm, smask);
471 canon->addBitmap(pdfBitmap); 471 canon->addBitmap(pdfBitmap);
472 return pdfBitmap; 472 return pdfBitmap;
473 } 473 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFBitmap.h ('k') | src/pdf/SkPDFCanon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698