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 #include <psapi.h> | 6 #include <psapi.h> |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/debug/gdi_debug_util_win.h" | 9 #include "base/debug/gdi_debug_util_win.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 temp_rect.right = canvas->imageInfo().width(); | 41 temp_rect.right = canvas->imageInfo().width(); |
42 temp_rect.top = 0; | 42 temp_rect.top = 0; |
43 temp_rect.bottom = canvas->imageInfo().height(); | 43 temp_rect.bottom = canvas->imageInfo().height(); |
44 src_rect = &temp_rect; | 44 src_rect = &temp_rect; |
45 } | 45 } |
46 skia::CopyHDC(skia::GetNativeDrawingContext(canvas), destination_hdc, x, y, | 46 skia::CopyHDC(skia::GetNativeDrawingContext(canvas), destination_hdc, x, y, |
47 canvas->imageInfo().isOpaque(), *src_rect, | 47 canvas->imageInfo().isOpaque(), *src_rect, |
48 canvas->getTotalMatrix()); | 48 canvas->getTotalMatrix()); |
49 } | 49 } |
50 | 50 |
| 51 HDC GetNativeDrawingContext(SkCanvas* canvas) { |
| 52 PlatformDevice* platform_device = GetPlatformDevice(canvas->getTopDevice(true)
); |
| 53 if (!platform_device) |
| 54 return nullptr; |
| 55 |
| 56 // Compensate for drawing to a layer rather than the entire canvas |
| 57 SkMatrix ctm; |
| 58 SkIRect clip_bounds; |
| 59 canvas->temporary_internal_describeTopLayer(&ctm, &clip_bounds); |
| 60 |
| 61 return platform_device->BeginPlatformPaint(ctm, clip_bounds); |
| 62 } |
| 63 |
51 HDC BitmapPlatformDevice::GetBitmapDC(const SkMatrix& transform, | 64 HDC BitmapPlatformDevice::GetBitmapDC(const SkMatrix& transform, |
52 const SkIRect& clip_bounds) { | 65 const SkIRect& clip_bounds) { |
53 if (!hdc_) { | 66 if (!hdc_) { |
54 hdc_ = CreateCompatibleDC(NULL); | 67 hdc_ = CreateCompatibleDC(NULL); |
55 InitializeDC(hdc_); | 68 InitializeDC(hdc_); |
56 old_hbitmap_ = static_cast<HBITMAP>(SelectObject(hdc_, hbitmap_)); | 69 old_hbitmap_ = static_cast<HBITMAP>(SelectObject(hdc_, hbitmap_)); |
57 } | 70 } |
58 | 71 |
59 LoadConfig(transform, clip_bounds); | 72 LoadConfig(transform, clip_bounds); |
60 return hdc_; | 73 return hdc_; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 int height, | 224 int height, |
212 bool is_opaque, | 225 bool is_opaque, |
213 HANDLE shared_section, | 226 HANDLE shared_section, |
214 OnFailureType failureType) { | 227 OnFailureType failureType) { |
215 sk_sp<SkBaseDevice> dev( | 228 sk_sp<SkBaseDevice> dev( |
216 BitmapPlatformDevice::Create(width, height, is_opaque, shared_section)); | 229 BitmapPlatformDevice::Create(width, height, is_opaque, shared_section)); |
217 return CreateCanvas(dev, failureType); | 230 return CreateCanvas(dev, failureType); |
218 } | 231 } |
219 | 232 |
220 } // namespace skia | 233 } // namespace skia |
OLD | NEW |