| 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 15 matching lines...) Expand all Loading... |
| 26 int result = SelectClipRgn(context, hrgn); | 26 int result = SelectClipRgn(context, hrgn); |
| 27 SkASSERT(result != ERROR); | 27 SkASSERT(result != ERROR); |
| 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, | |
| 37 const RECT* src_rect) { | |
| 38 RECT temp_rect; | |
| 39 if (!src_rect) { | |
| 40 temp_rect.left = 0; | |
| 41 temp_rect.right = canvas->imageInfo().width(); | |
| 42 temp_rect.top = 0; | |
| 43 temp_rect.bottom = canvas->imageInfo().height(); | |
| 44 src_rect = &temp_rect; | |
| 45 } | |
| 46 skia::CopyHDC(skia::GetNativeDrawingContext(canvas), destination_hdc, x, y, | |
| 47 canvas->imageInfo().isOpaque(), *src_rect, | |
| 48 canvas->getTotalMatrix()); | |
| 49 } | |
| 50 | |
| 51 HDC GetNativeDrawingContext(SkCanvas* canvas) { | 36 HDC GetNativeDrawingContext(SkCanvas* canvas) { |
| 52 PlatformDevice* platform_device = GetPlatformDevice(canvas->getTopDevice(true)
); | 37 PlatformDevice* platform_device = GetPlatformDevice(canvas->getTopDevice(true)
); |
| 53 if (!platform_device) | 38 if (!platform_device) |
| 54 return nullptr; | 39 return nullptr; |
| 55 | 40 |
| 56 // Compensate for drawing to a layer rather than the entire canvas | 41 // Compensate for drawing to a layer rather than the entire canvas |
| 57 SkMatrix ctm; | 42 SkMatrix ctm; |
| 58 SkIRect clip_bounds; | 43 SkIRect clip_bounds; |
| 59 canvas->temporary_internal_describeTopLayer(&ctm, &clip_bounds); | 44 canvas->temporary_internal_describeTopLayer(&ctm, &clip_bounds); |
| 60 | 45 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 int height, | 209 int height, |
| 225 bool is_opaque, | 210 bool is_opaque, |
| 226 HANDLE shared_section, | 211 HANDLE shared_section, |
| 227 OnFailureType failureType) { | 212 OnFailureType failureType) { |
| 228 sk_sp<SkBaseDevice> dev( | 213 sk_sp<SkBaseDevice> dev( |
| 229 BitmapPlatformDevice::Create(width, height, is_opaque, shared_section)); | 214 BitmapPlatformDevice::Create(width, height, is_opaque, shared_section)); |
| 230 return CreateCanvas(dev, failureType); | 215 return CreateCanvas(dev, failureType); |
| 231 } | 216 } |
| 232 | 217 |
| 233 } // namespace skia | 218 } // namespace skia |
| OLD | NEW |