| 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 <windows.h> | 5 #include <windows.h> |
| 6 | 6 |
| 7 #include "skia/ext/vector_platform_device_emf_win.h" | 7 #include "skia/ext/vector_platform_device_emf_win.h" |
| 8 | 8 |
| 9 #include "skia/ext/bitmap_platform_device.h" | 9 #include "skia/ext/bitmap_platform_device.h" |
| 10 #include "skia/ext/skia_utils_win.h" | 10 #include "skia/ext/skia_utils_win.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (!succeeded) | 90 if (!succeeded) |
| 91 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); | 91 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); |
| 92 | 92 |
| 93 return new VectorPlatformDeviceEmf(dc, bitmap); | 93 return new VectorPlatformDeviceEmf(dc, bitmap); |
| 94 } | 94 } |
| 95 | 95 |
| 96 VectorPlatformDeviceEmf::VectorPlatformDeviceEmf(HDC dc, const SkBitmap& bitmap) | 96 VectorPlatformDeviceEmf::VectorPlatformDeviceEmf(HDC dc, const SkBitmap& bitmap) |
| 97 : SkDevice(bitmap), | 97 : SkDevice(bitmap), |
| 98 hdc_(dc), | 98 hdc_(dc), |
| 99 previous_brush_(NULL), | 99 previous_brush_(NULL), |
| 100 previous_pen_(NULL), | 100 previous_pen_(NULL) { |
| 101 alpha_blend_used_(false) { | |
| 102 transform_.reset(); | 101 transform_.reset(); |
| 103 SetPlatformDevice(this, this); | 102 SetPlatformDevice(this, this); |
| 104 } | 103 } |
| 105 | 104 |
| 106 VectorPlatformDeviceEmf::~VectorPlatformDeviceEmf() { | 105 VectorPlatformDeviceEmf::~VectorPlatformDeviceEmf() { |
| 107 SkASSERT(previous_brush_ == NULL); | 106 SkASSERT(previous_brush_ == NULL); |
| 108 SkASSERT(previous_pen_ == NULL); | 107 SkASSERT(previous_pen_ == NULL); |
| 109 } | 108 } |
| 110 | 109 |
| 111 HDC VectorPlatformDeviceEmf::BeginPlatformPaint() { | 110 HDC VectorPlatformDeviceEmf::BeginPlatformPaint() { |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 x, y, // Destination origin. | 841 x, y, // Destination origin. |
| 843 src_size_x, src_size_y, // Destination size. | 842 src_size_x, src_size_y, // Destination size. |
| 844 bitmap_dc, | 843 bitmap_dc, |
| 845 0, 0, // Source origin. | 844 0, 0, // Source origin. |
| 846 src_size_x, src_size_y, // Source size. | 845 src_size_x, src_size_y, // Source size. |
| 847 blend_function); | 846 blend_function); |
| 848 SkASSERT(result); | 847 SkASSERT(result); |
| 849 result = SetStretchBltMode(dc, previous_mode); | 848 result = SetStretchBltMode(dc, previous_mode); |
| 850 SkASSERT(result); | 849 SkASSERT(result); |
| 851 | 850 |
| 852 alpha_blend_used_ = true; | |
| 853 | |
| 854 ::SelectObject(bitmap_dc, static_cast<HBITMAP>(old_bitmap)); | 851 ::SelectObject(bitmap_dc, static_cast<HBITMAP>(old_bitmap)); |
| 855 DeleteObject(hbitmap); | 852 DeleteObject(hbitmap); |
| 856 DeleteDC(bitmap_dc); | 853 DeleteDC(bitmap_dc); |
| 857 } else { | 854 } else { |
| 858 int nCopied = StretchDIBits(dc, | 855 int nCopied = StretchDIBits(dc, |
| 859 x, y, // Destination origin. | 856 x, y, // Destination origin. |
| 860 src_size_x, src_size_y, | 857 src_size_x, src_size_y, |
| 861 0, 0, // Source origin. | 858 0, 0, // Source origin. |
| 862 src_size_x, src_size_y, // Source size. | 859 src_size_x, src_size_y, // Source size. |
| 863 pixels, | 860 pixels, |
| 864 reinterpret_cast<const BITMAPINFO*>(&hdr), | 861 reinterpret_cast<const BITMAPINFO*>(&hdr), |
| 865 DIB_RGB_COLORS, | 862 DIB_RGB_COLORS, |
| 866 SRCCOPY); | 863 SRCCOPY); |
| 867 } | 864 } |
| 868 EndPlatformPaint(); | 865 EndPlatformPaint(); |
| 869 Cleanup(); | 866 Cleanup(); |
| 870 } | 867 } |
| 871 | 868 |
| 872 } // namespace skia | 869 } // namespace skia |
| OLD | NEW |