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

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

Issue 1837553002: SkPDF s/SkAutoTDelete/std::unique_ptr/ (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-03-28 (Monday) 10:22:50 EDT Created 4 years, 8 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/SkDeflate.h ('k') | src/pdf/SkPDFDevice.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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 339
340 // Write to a temporary buffer to get the compressed length. 340 // Write to a temporary buffer to get the compressed length.
341 SkDynamicMemoryWStream buffer; 341 SkDynamicMemoryWStream buffer;
342 SkDeflateWStream deflateWStream(&buffer); 342 SkDeflateWStream deflateWStream(&buffer);
343 if (alpha) { 343 if (alpha) {
344 bitmap_alpha_to_a8(bitmap, &deflateWStream); 344 bitmap_alpha_to_a8(bitmap, &deflateWStream);
345 } else { 345 } else {
346 bitmap_to_pdf_pixels(bitmap, &deflateWStream); 346 bitmap_to_pdf_pixels(bitmap, &deflateWStream);
347 } 347 }
348 deflateWStream.finalize(); // call before detachAsStream(). 348 deflateWStream.finalize(); // call before detachAsStream().
349 SkAutoTDelete<SkStreamAsset> asset(buffer.detachAsStream()); 349 std::unique_ptr<SkStreamAsset> asset(buffer.detachAsStream());
350 350
351 SkPDFDict pdfDict("XObject"); 351 SkPDFDict pdfDict("XObject");
352 pdfDict.insertName("Subtype", "Image"); 352 pdfDict.insertName("Subtype", "Image");
353 pdfDict.insertInt("Width", bitmap.width()); 353 pdfDict.insertInt("Width", bitmap.width());
354 pdfDict.insertInt("Height", bitmap.height()); 354 pdfDict.insertInt("Height", bitmap.height());
355 if (alpha) { 355 if (alpha) {
356 pdfDict.insertName("ColorSpace", "DeviceGray"); 356 pdfDict.insertName("ColorSpace", "DeviceGray");
357 } else if (bitmap.colorType() == kIndex_8_SkColorType) { 357 } else if (bitmap.colorType() == kIndex_8_SkColorType) {
358 SkASSERT(1 == pdf_color_component_count(bitmap.colorType())); 358 SkASSERT(1 == pdf_color_component_count(bitmap.colorType()));
359 pdfDict.insertObject("ColorSpace", 359 pdfDict.insertObject("ColorSpace",
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 511
512 sk_sp<SkPDFObject> smask; 512 sk_sp<SkPDFObject> smask;
513 if (!image_compute_is_opaque(image.get())) { 513 if (!image_compute_is_opaque(image.get())) {
514 smask = sk_make_sp<PDFAlphaBitmap>(image); 514 smask = sk_make_sp<PDFAlphaBitmap>(image);
515 } 515 }
516 #ifdef SK_PDF_IMAGE_STATS 516 #ifdef SK_PDF_IMAGE_STATS
517 gRegularImageObjects.fetch_add(1); 517 gRegularImageObjects.fetch_add(1);
518 #endif 518 #endif
519 return sk_make_sp<PDFDefaultBitmap>(std::move(image), std::move(smask)); 519 return sk_make_sp<PDFDefaultBitmap>(std::move(image), std::move(smask));
520 } 520 }
OLDNEW
« no previous file with comments | « src/pdf/SkDeflate.h ('k') | src/pdf/SkPDFDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698