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 "skia/ext/bitmap_platform_device_win.h" | 8 #include "skia/ext/bitmap_platform_device_win.h" |
9 | 9 |
10 #include "skia/ext/bitmap_platform_device_data.h" | 10 #include "skia/ext/bitmap_platform_device_data.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 bitmap.setIsOpaque(is_opaque); | 129 bitmap.setIsOpaque(is_opaque); |
130 | 130 |
131 // If we were given data, then don't clobber it! | 131 // If we were given data, then don't clobber it! |
132 if (!shared_section) { | 132 if (!shared_section) { |
133 if (is_opaque) { | 133 if (is_opaque) { |
134 #ifndef NDEBUG | 134 #ifndef NDEBUG |
135 // To aid in finding bugs, we set the background color to something | 135 // To aid in finding bugs, we set the background color to something |
136 // obviously wrong so it will be noticable when it is not cleared | 136 // obviously wrong so it will be noticable when it is not cleared |
137 bitmap.eraseARGB(255, 0, 255, 128); // bright bluish green | 137 bitmap.eraseARGB(255, 0, 255, 128); // bright bluish green |
138 #endif | 138 #endif |
139 } else { | |
140 bitmap.eraseARGB(0, 0, 0, 0); | |
141 } | 139 } |
142 } | 140 } |
143 | 141 |
144 // The device object will take ownership of the HBITMAP. The initial refcount | 142 // The device object will take ownership of the HBITMAP. The initial refcount |
145 // of the data object will be 1, which is what the constructor expects. | 143 // of the data object will be 1, which is what the constructor expects. |
146 return new BitmapPlatformDevice(new BitmapPlatformDeviceData(hbitmap), | 144 return new BitmapPlatformDevice(new BitmapPlatformDeviceData(hbitmap), |
147 bitmap); | 145 bitmap); |
148 } | 146 } |
149 | 147 |
150 // static | 148 // static |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // operation has occurred on our DC. | 250 // operation has occurred on our DC. |
253 if (data_->IsBitmapDCCreated()) | 251 if (data_->IsBitmapDCCreated()) |
254 GdiFlush(); | 252 GdiFlush(); |
255 return *bitmap; | 253 return *bitmap; |
256 } | 254 } |
257 | 255 |
258 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice( | 256 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice( |
259 SkBitmap::Config config, int width, int height, bool isOpaque, | 257 SkBitmap::Config config, int width, int height, bool isOpaque, |
260 Usage /*usage*/) { | 258 Usage /*usage*/) { |
261 SkASSERT(config == SkBitmap::kARGB_8888_Config); | 259 SkASSERT(config == SkBitmap::kARGB_8888_Config); |
262 return BitmapPlatformDevice::create(width, height, isOpaque, NULL); | 260 SkDevice* bitmap_device = BitmapPlatformDevice::create(width, height, |
| 261 isOpaque, NULL); |
| 262 bitmap_device->accessBitmap(true).eraseARGB(0, 0, 0, 0); |
| 263 return bitmap_device; |
263 } | 264 } |
264 | 265 |
265 } // namespace skia | 266 } // namespace skia |
OLD | NEW |