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 "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/win/scoped_gdi_object.h" | 10 #include "base/win/scoped_gdi_object.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 bmih->biSizeImage)) { | 402 bmih->biSizeImage)) { |
403 play_normally = false; | 403 play_normally = false; |
404 bitmap.reset(new SkBitmap()); | 404 bitmap.reset(new SkBitmap()); |
405 gfx::PNGCodec::Decode(bits, bmih->biSizeImage, bitmap.get()); | 405 gfx::PNGCodec::Decode(bits, bmih->biSizeImage, bitmap.get()); |
406 } | 406 } |
407 } | 407 } |
408 if (!play_normally) { | 408 if (!play_normally) { |
409 DCHECK(bitmap.get()); | 409 DCHECK(bitmap.get()); |
410 if (bitmap.get()) { | 410 if (bitmap.get()) { |
411 SkAutoLockPixels lock(*bitmap.get()); | 411 SkAutoLockPixels lock(*bitmap.get()); |
412 DCHECK_EQ(bitmap->config(), SkBitmap::kARGB_8888_Config); | 412 DCHECK_EQ(bitmap->colorType(), kN32_SkColorType); |
413 const uint32_t* pixels = | 413 const uint32_t* pixels = |
414 static_cast<const uint32_t*>(bitmap->getPixels()); | 414 static_cast<const uint32_t*>(bitmap->getPixels()); |
415 if (pixels == NULL) { | 415 if (pixels == NULL) { |
416 NOTREACHED(); | 416 NOTREACHED(); |
417 return false; | 417 return false; |
418 } | 418 } |
419 BITMAPINFOHEADER bmi = {0}; | 419 BITMAPINFOHEADER bmi = {0}; |
420 gfx::CreateBitmapHeader(bitmap->width(), bitmap->height(), &bmi); | 420 gfx::CreateBitmapHeader(bitmap->width(), bitmap->height(), &bmi); |
421 res = (0 != StretchDIBits(hdc, sdib_record->xDest, sdib_record->yDest, | 421 res = (0 != StretchDIBits(hdc, sdib_record->xDest, sdib_record->yDest, |
422 sdib_record->cxDest, | 422 sdib_record->cxDest, |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 RECT rect = page_bounds.ToRECT(); | 669 RECT rect = page_bounds.ToRECT(); |
670 ::EnumEnhMetaFile(hdc, emf(), &RasterizeAlphaBlendProc, &bitmap_dc, &rect); | 670 ::EnumEnhMetaFile(hdc, emf(), &RasterizeAlphaBlendProc, &bitmap_dc, &rect); |
671 | 671 |
672 result->FinishDocument(); | 672 result->FinishDocument(); |
673 | 673 |
674 return result.release(); | 674 return result.release(); |
675 } | 675 } |
676 | 676 |
677 | 677 |
678 } // namespace printing | 678 } // namespace printing |
OLD | NEW |