| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |