| 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 <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 play_normally = false; | 375 play_normally = false; |
| 376 bitmap = base::MakeUnique<SkBitmap>(); | 376 bitmap = base::MakeUnique<SkBitmap>(); |
| 377 gfx::PNGCodec::Decode(bits, bmih->biSizeImage, bitmap.get()); | 377 gfx::PNGCodec::Decode(bits, bmih->biSizeImage, bitmap.get()); |
| 378 } | 378 } |
| 379 } | 379 } |
| 380 if (play_normally) { | 380 if (play_normally) { |
| 381 res = Play(context); | 381 res = Play(context); |
| 382 } else { | 382 } else { |
| 383 DCHECK(bitmap.get()); | 383 DCHECK(bitmap.get()); |
| 384 if (bitmap.get()) { | 384 if (bitmap.get()) { |
| 385 SkAutoLockPixels lock(*bitmap.get()); | |
| 386 DCHECK_EQ(bitmap->colorType(), kN32_SkColorType); | 385 DCHECK_EQ(bitmap->colorType(), kN32_SkColorType); |
| 387 const uint32_t* pixels = | 386 const uint32_t* pixels = |
| 388 static_cast<const uint32_t*>(bitmap->getPixels()); | 387 static_cast<const uint32_t*>(bitmap->getPixels()); |
| 389 if (!pixels) { | 388 if (!pixels) { |
| 390 NOTREACHED(); | 389 NOTREACHED(); |
| 391 return false; | 390 return false; |
| 392 } | 391 } |
| 393 BITMAPINFOHEADER bmi = {0}; | 392 BITMAPINFOHEADER bmi = {0}; |
| 394 skia::CreateBitmapHeader(bitmap->width(), bitmap->height(), &bmi); | 393 skia::CreateBitmapHeader(bitmap->width(), bitmap->height(), &bmi); |
| 395 res = (0 != StretchDIBits(hdc, sdib_record->xDest, sdib_record->yDest, | 394 res = (0 != StretchDIBits(hdc, sdib_record->xDest, sdib_record->yDest, |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 | 594 |
| 596 HDC bitmap_dc = bitmap.context(); | 595 HDC bitmap_dc = bitmap.context(); |
| 597 RECT rect = page_bounds.ToRECT(); | 596 RECT rect = page_bounds.ToRECT(); |
| 598 ::EnumEnhMetaFile(hdc, emf(), &RasterizeAlphaBlendProc, &bitmap_dc, &rect); | 597 ::EnumEnhMetaFile(hdc, emf(), &RasterizeAlphaBlendProc, &bitmap_dc, &rect); |
| 599 | 598 |
| 600 result->FinishDocument(); | 599 result->FinishDocument(); |
| 601 return result; | 600 return result; |
| 602 } | 601 } |
| 603 | 602 |
| 604 } // namespace printing | 603 } // namespace printing |
| OLD | NEW |