| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } // namespace | 111 } // namespace |
| 112 | 112 |
| 113 namespace skia { | 113 namespace skia { |
| 114 | 114 |
| 115 std::unique_ptr<SkCanvas> CreatePlatformCanvasWithSharedSection( | 115 std::unique_ptr<SkCanvas> CreatePlatformCanvasWithSharedSection( |
| 116 int width, | 116 int width, |
| 117 int height, | 117 int height, |
| 118 bool is_opaque, | 118 bool is_opaque, |
| 119 HANDLE shared_section, | 119 HANDLE shared_section, |
| 120 OnFailureType failure_type) { | 120 OnFailureType failure_type) { |
| 121 SkAlphaType alpha = is_opaque ? kPremul_SkAlphaType : kOpaque_SkAlphaType; | 121 SkAlphaType alpha = is_opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; |
| 122 SkImageInfo info = SkImageInfo::MakeN32(width, height, alpha); | 122 SkImageInfo info = SkImageInfo::MakeN32(width, height, alpha); |
| 123 size_t row_bytes = PlatformCanvasStrideForWidth(width); | 123 size_t row_bytes = PlatformCanvasStrideForWidth(width); |
| 124 | 124 |
| 125 // This function contains an implementation of a Skia platform bitmap for | 125 // This function contains an implementation of a Skia platform bitmap for |
| 126 // drawing and compositing graphics. The original implementation uses Windows | 126 // drawing and compositing graphics. The original implementation uses Windows |
| 127 // GDI to create the backing bitmap memory, however it's possible for a | 127 // GDI to create the backing bitmap memory, however it's possible for a |
| 128 // process to not have access to GDI which will cause this code to fail. It's | 128 // process to not have access to GDI which will cause this code to fail. It's |
| 129 // possible to detect when GDI is unavailable and instead directly map the | 129 // possible to detect when GDI is unavailable and instead directly map the |
| 130 // shared memory as the bitmap. | 130 // shared memory as the bitmap. |
| 131 if (base::win::IsUser32AndGdi32Available()) { | 131 if (base::win::IsUser32AndGdi32Available()) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 144 if (failure_type == CRASH_ON_FAILURE) | 144 if (failure_type == CRASH_ON_FAILURE) |
| 145 SK_CRASH(); | 145 SK_CRASH(); |
| 146 return nullptr; | 146 return nullptr; |
| 147 } | 147 } |
| 148 | 148 |
| 149 HDC GetNativeDrawingContext(SkCanvas* canvas) { | 149 HDC GetNativeDrawingContext(SkCanvas* canvas) { |
| 150 return canvas ? static_cast<HDC>(canvas->accessTopRasterHandle()) : nullptr; | 150 return canvas ? static_cast<HDC>(canvas->accessTopRasterHandle()) : nullptr; |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace skia | 153 } // namespace skia |
| OLD | NEW |