| 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 "skia/ext/vector_platform_device_emf_win.h" | 5 #include "skia/ext/vector_platform_device_emf_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 BITMAPV4HEADER bitmap_header = {0}; | 888 BITMAPV4HEADER bitmap_header = {0}; |
| 889 FillBitmapInfoHeader(src_size_x, src_size_y, | 889 FillBitmapInfoHeader(src_size_x, src_size_y, |
| 890 reinterpret_cast<BITMAPINFOHEADER*>(&bitmap_header)); | 890 reinterpret_cast<BITMAPINFOHEADER*>(&bitmap_header)); |
| 891 bitmap_header.bV4Size = sizeof(BITMAPV4HEADER); | 891 bitmap_header.bV4Size = sizeof(BITMAPV4HEADER); |
| 892 bitmap_header.bV4RedMask = 0x00ff0000; | 892 bitmap_header.bV4RedMask = 0x00ff0000; |
| 893 bitmap_header.bV4GreenMask = 0x0000ff00; | 893 bitmap_header.bV4GreenMask = 0x0000ff00; |
| 894 bitmap_header.bV4BlueMask = 0x000000ff; | 894 bitmap_header.bV4BlueMask = 0x000000ff; |
| 895 bitmap_header.bV4AlphaMask = 0xff000000; | 895 bitmap_header.bV4AlphaMask = 0xff000000; |
| 896 | 896 |
| 897 SkAutoLockPixels lock(bitmap); | 897 SkAutoLockPixels lock(bitmap); |
| 898 SkASSERT(bitmap.config() == SkBitmap::kARGB_8888_Config); | 898 SkASSERT(bitmap.colorType() == kN32_SkColorType); |
| 899 const uint32_t* pixels = static_cast<const uint32_t*>(bitmap.getPixels()); | 899 const uint32_t* pixels = static_cast<const uint32_t*>(bitmap.getPixels()); |
| 900 if (pixels == NULL) { | 900 if (pixels == NULL) { |
| 901 SkASSERT(false); | 901 SkASSERT(false); |
| 902 return; | 902 return; |
| 903 } | 903 } |
| 904 | 904 |
| 905 if (!is_translucent) { | 905 if (!is_translucent) { |
| 906 int row_length = bitmap.rowBytesAsPixels(); | 906 int row_length = bitmap.rowBytesAsPixels(); |
| 907 // There is no quick way to determine if an image is opaque. | 907 // There is no quick way to determine if an image is opaque. |
| 908 for (int y2 = 0; y2 < src_size_y; ++y2) { | 908 for (int y2 = 0; y2 < src_size_y; ++y2) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 pixels, | 977 pixels, |
| 978 reinterpret_cast<const BITMAPINFO*>(&hdr), | 978 reinterpret_cast<const BITMAPINFO*>(&hdr), |
| 979 DIB_RGB_COLORS, | 979 DIB_RGB_COLORS, |
| 980 SRCCOPY); | 980 SRCCOPY); |
| 981 } | 981 } |
| 982 EndPlatformPaint(); | 982 EndPlatformPaint(); |
| 983 Cleanup(); | 983 Cleanup(); |
| 984 } | 984 } |
| 985 | 985 |
| 986 } // namespace skia | 986 } // namespace skia |
| OLD | NEW |