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 17 matching lines...) Expand all Loading... |
28 result = DeleteObject(hrgn); | 28 result = DeleteObject(hrgn); |
29 SkASSERT(result != 0); | 29 SkASSERT(result != 0); |
30 } | 30 } |
31 | 31 |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 namespace skia { | 34 namespace skia { |
35 | 35 |
36 void DrawToNativeContext(SkCanvas* canvas, HDC destination_hdc, int x, int y, | 36 void DrawToNativeContext(SkCanvas* canvas, HDC destination_hdc, int x, int y, |
37 const RECT* src_rect) { | 37 const RECT* src_rect) { |
38 ScopedPlatformPaint p(canvas); | |
39 RECT temp_rect; | 38 RECT temp_rect; |
40 if (!src_rect) { | 39 if (!src_rect) { |
41 temp_rect.left = 0; | 40 temp_rect.left = 0; |
42 temp_rect.right = canvas->imageInfo().width(); | 41 temp_rect.right = canvas->imageInfo().width(); |
43 temp_rect.top = 0; | 42 temp_rect.top = 0; |
44 temp_rect.bottom = canvas->imageInfo().height(); | 43 temp_rect.bottom = canvas->imageInfo().height(); |
45 src_rect = &temp_rect; | 44 src_rect = &temp_rect; |
46 } | 45 } |
47 skia::CopyHDC(p.GetNativeDrawingContext(), destination_hdc, x, y, | 46 skia::CopyHDC(skia::GetNativeDrawingContext(canvas), destination_hdc, x, y, |
48 canvas->imageInfo().isOpaque(), *src_rect, | 47 canvas->imageInfo().isOpaque(), *src_rect, |
49 canvas->getTotalMatrix()); | 48 canvas->getTotalMatrix()); |
50 } | 49 } |
51 | 50 |
52 HDC BitmapPlatformDevice::GetBitmapDC(const SkMatrix& transform, | 51 HDC BitmapPlatformDevice::GetBitmapDC(const SkMatrix& transform, |
53 const SkIRect& clip_bounds) { | 52 const SkIRect& clip_bounds) { |
54 if (!hdc_) { | 53 if (!hdc_) { |
55 hdc_ = CreateCompatibleDC(NULL); | 54 hdc_ = CreateCompatibleDC(NULL); |
56 InitializeDC(hdc_); | 55 InitializeDC(hdc_); |
57 old_hbitmap_ = static_cast<HBITMAP>(SelectObject(hdc_, hbitmap_)); | 56 old_hbitmap_ = static_cast<HBITMAP>(SelectObject(hdc_, hbitmap_)); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 int height, | 211 int height, |
213 bool is_opaque, | 212 bool is_opaque, |
214 HANDLE shared_section, | 213 HANDLE shared_section, |
215 OnFailureType failureType) { | 214 OnFailureType failureType) { |
216 sk_sp<SkBaseDevice> dev( | 215 sk_sp<SkBaseDevice> dev( |
217 BitmapPlatformDevice::Create(width, height, is_opaque, shared_section)); | 216 BitmapPlatformDevice::Create(width, height, is_opaque, shared_section)); |
218 return CreateCanvas(dev, failureType); | 217 return CreateCanvas(dev, failureType); |
219 } | 218 } |
220 | 219 |
221 } // namespace skia | 220 } // namespace skia |
OLD | NEW |