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

Side by Side Diff: printing/emf_win.cc

Issue 1879443002: JPEG decoding: replace ownership comments with std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fixes 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 | « components/suggestions/image_encoder_ios.mm ('k') | ui/gfx/codec/jpeg_codec.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "printing/emf_win.h" 5 #include "printing/emf_win.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 sdib_record->offBmiSrc); 359 sdib_record->offBmiSrc);
360 const BYTE* bits = record_start + sdib_record->offBitsSrc; 360 const BYTE* bits = record_start + sdib_record->offBitsSrc;
361 bool play_normally = true; 361 bool play_normally = true;
362 res = false; 362 res = false;
363 HDC hdc = context->hdc; 363 HDC hdc = context->hdc;
364 std::unique_ptr<SkBitmap> bitmap; 364 std::unique_ptr<SkBitmap> bitmap;
365 if (bmih->biCompression == BI_JPEG) { 365 if (bmih->biCompression == BI_JPEG) {
366 if (!DIBFormatNativelySupported(hdc, CHECKJPEGFORMAT, bits, 366 if (!DIBFormatNativelySupported(hdc, CHECKJPEGFORMAT, bits,
367 bmih->biSizeImage)) { 367 bmih->biSizeImage)) {
368 play_normally = false; 368 play_normally = false;
369 bitmap.reset(gfx::JPEGCodec::Decode(bits, bmih->biSizeImage)); 369 bitmap = gfx::JPEGCodec::Decode(bits, bmih->biSizeImage);
370 } 370 }
371 } else if (bmih->biCompression == BI_PNG) { 371 } else if (bmih->biCompression == BI_PNG) {
372 if (!DIBFormatNativelySupported(hdc, CHECKPNGFORMAT, bits, 372 if (!DIBFormatNativelySupported(hdc, CHECKPNGFORMAT, bits,
373 bmih->biSizeImage)) { 373 bmih->biSizeImage)) {
374 play_normally = false; 374 play_normally = false;
375 bitmap.reset(new SkBitmap()); 375 bitmap.reset(new SkBitmap());
376 gfx::PNGCodec::Decode(bits, bmih->biSizeImage, bitmap.get()); 376 gfx::PNGCodec::Decode(bits, bmih->biSizeImage, bitmap.get());
377 } 377 }
378 } 378 }
379 if (!play_normally) { 379 if (!play_normally) {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 RECT rect = page_bounds.ToRECT(); 601 RECT rect = page_bounds.ToRECT();
602 ::EnumEnhMetaFile(hdc, emf(), &RasterizeAlphaBlendProc, &bitmap_dc, &rect); 602 ::EnumEnhMetaFile(hdc, emf(), &RasterizeAlphaBlendProc, &bitmap_dc, &rect);
603 603
604 result->FinishDocument(); 604 result->FinishDocument();
605 605
606 return result; 606 return result;
607 } 607 }
608 608
609 609
610 } // namespace printing 610 } // namespace printing
OLDNEW
« no previous file with comments | « components/suggestions/image_encoder_ios.mm ('k') | ui/gfx/codec/jpeg_codec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698