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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 BitmapPlatformDevice::~BitmapPlatformDevice() { | 190 BitmapPlatformDevice::~BitmapPlatformDevice() { |
191 if (hdc_) | 191 if (hdc_) |
192 ReleaseBitmapDC(); | 192 ReleaseBitmapDC(); |
193 } | 193 } |
194 | 194 |
195 HDC BitmapPlatformDevice::BeginPlatformPaint(const SkMatrix& transform, | 195 HDC BitmapPlatformDevice::BeginPlatformPaint(const SkMatrix& transform, |
196 const SkIRect& clip_bounds) { | 196 const SkIRect& clip_bounds) { |
197 return GetBitmapDC(transform, clip_bounds); | 197 return GetBitmapDC(transform, clip_bounds); |
198 } | 198 } |
199 | 199 |
200 const SkBitmap& BitmapPlatformDevice::onAccessBitmap() { | |
201 // FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI | |
202 // operation has occurred on our DC. | |
203 if (IsBitmapDCCreated()) | |
204 GdiFlush(); | |
205 return SkBitmapDevice::onAccessBitmap(); | |
206 } | |
207 | |
208 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& cinfo, | 200 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& cinfo, |
209 const SkPaint*) { | 201 const SkPaint*) { |
210 const SkImageInfo& info = cinfo.fInfo; | 202 const SkImageInfo& info = cinfo.fInfo; |
211 const bool do_clear = !info.isOpaque(); | 203 const bool do_clear = !info.isOpaque(); |
212 SkASSERT(info.colorType() == kN32_SkColorType); | 204 SkASSERT(info.colorType() == kN32_SkColorType); |
213 return Create(info.width(), info.height(), info.isOpaque(), NULL, do_clear); | 205 return Create(info.width(), info.height(), info.isOpaque(), NULL, do_clear); |
214 } | 206 } |
215 | 207 |
216 // PlatformCanvas impl | 208 // PlatformCanvas impl |
217 | 209 |
218 SkCanvas* CreatePlatformCanvas(int width, | 210 SkCanvas* CreatePlatformCanvas(int width, |
219 int height, | 211 int height, |
220 bool is_opaque, | 212 bool is_opaque, |
221 HANDLE shared_section, | 213 HANDLE shared_section, |
222 OnFailureType failureType) { | 214 OnFailureType failureType) { |
223 sk_sp<SkBaseDevice> dev( | 215 sk_sp<SkBaseDevice> dev( |
224 BitmapPlatformDevice::Create(width, height, is_opaque, shared_section)); | 216 BitmapPlatformDevice::Create(width, height, is_opaque, shared_section)); |
225 return CreateCanvas(dev, failureType); | 217 return CreateCanvas(dev, failureType); |
226 } | 218 } |
227 | 219 |
228 } // namespace skia | 220 } // namespace skia |
OLD | NEW |