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 | 7 |
8 #include "base/debug/gdi_debug_util_win.h" | 8 #include "base/debug/gdi_debug_util_win.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "skia/ext/bitmap_platform_device_win.h" | 10 #include "skia/ext/bitmap_platform_device_win.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 return Create(width, height, is_opaque, NULL); | 150 return Create(width, height, is_opaque, NULL); |
151 } | 151 } |
152 | 152 |
153 // static | 153 // static |
154 BitmapPlatformDevice* BitmapPlatformDevice::CreateAndClear(int width, | 154 BitmapPlatformDevice* BitmapPlatformDevice::CreateAndClear(int width, |
155 int height, | 155 int height, |
156 bool is_opaque) { | 156 bool is_opaque) { |
157 BitmapPlatformDevice* device = BitmapPlatformDevice::Create(width, height, | 157 BitmapPlatformDevice* device = BitmapPlatformDevice::Create(width, height, |
158 is_opaque); | 158 is_opaque); |
159 if (device && !is_opaque) | 159 if (device && !is_opaque) |
160 device->accessBitmap(true).eraseARGB(0, 0, 0, 0); | 160 device->clear(0); |
161 return device; | 161 return device; |
162 } | 162 } |
163 | 163 |
164 // The device will own the HBITMAP, which corresponds to also owning the pixel | 164 // The device will own the HBITMAP, which corresponds to also owning the pixel |
165 // data. Therefore, we do not transfer ownership to the SkBitmapDevice's bitmap. | 165 // data. Therefore, we do not transfer ownership to the SkBitmapDevice's bitmap. |
166 BitmapPlatformDevice::BitmapPlatformDevice( | 166 BitmapPlatformDevice::BitmapPlatformDevice( |
167 HBITMAP hbitmap, | 167 HBITMAP hbitmap, |
168 const SkBitmap& bitmap) | 168 const SkBitmap& bitmap) |
169 : SkBitmapDevice(bitmap), | 169 : SkBitmapDevice(bitmap), |
170 hbitmap_(hbitmap), | 170 hbitmap_(hbitmap), |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 platform_extra_ = reinterpret_cast<intptr_t>(stock_bitmap); | 312 platform_extra_ = reinterpret_cast<intptr_t>(stock_bitmap); |
313 | 313 |
314 if (!InstallHBitmapPixels(&bitmap_, width, height, is_opaque, data, hbitmap)) | 314 if (!InstallHBitmapPixels(&bitmap_, width, height, is_opaque, data, hbitmap)) |
315 return false; | 315 return false; |
316 bitmap_.lockPixels(); | 316 bitmap_.lockPixels(); |
317 | 317 |
318 return true; | 318 return true; |
319 } | 319 } |
320 | 320 |
321 } // namespace skia | 321 } // namespace skia |
OLD | NEW |