Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: skia/ext/bitmap_platform_device_win.cc

Issue 11138024: Simplify platform_canvas.h by recognizing that PlatformCanvas does not actually extend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.cc ('k') | skia/ext/platform_canvas.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "skia/ext/bitmap_platform_device_data.h" 9 #include "skia/ext/bitmap_platform_device_data.h"
10 #include "skia/ext/platform_canvas.h" 10 #include "skia/ext/platform_canvas.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 const SkBitmap& BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) { 254 const SkBitmap& BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) {
255 // FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI 255 // FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI
256 // operation has occurred on our DC. 256 // operation has occurred on our DC.
257 if (data_->IsBitmapDCCreated()) 257 if (data_->IsBitmapDCCreated())
258 GdiFlush(); 258 GdiFlush();
259 return *bitmap; 259 return *bitmap;
260 } 260 }
261 261
262 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice( 262 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
263 SkBitmap::Config config, int width, int height, bool isOpaque, 263 SkBitmap::Config config, int width, int height, bool isOpaque, Usage) {
264 Usage /*usage*/) {
265 SkASSERT(config == SkBitmap::kARGB_8888_Config); 264 SkASSERT(config == SkBitmap::kARGB_8888_Config);
266 SkDevice* bitmap_device = BitmapPlatformDevice::CreateAndClear(width, height, 265 return BitmapPlatformDevice::CreateAndClear(width, height, isOpaque);
267 isOpaque); 266 }
268 return bitmap_device; 267
268 // PlatformCanvas impl
269
270 SkCanvas* CreatePlatformCanvas(int width,
271 int height,
272 bool is_opaque,
273 HANDLE shared_section,
274 OnFailureType failureType) {
275 SkDevice* dev = BitmapPlatformDevice::Create(width,
276 height,
277 is_opaque,
278 shared_section);
279 return CreateCanvas(dev, failureType);
269 } 280 }
270 281
271 // Port of PlatformBitmap to win 282 // Port of PlatformBitmap to win
272 283
273 PlatformBitmap::~PlatformBitmap() { 284 PlatformBitmap::~PlatformBitmap() {
274 if (surface_) 285 if (surface_)
275 DeleteDC(surface_); 286 DeleteDC(surface_);
276 287
277 HBITMAP hbitmap = (HBITMAP)platform_extra_; 288 HBITMAP hbitmap = (HBITMAP)platform_extra_;
278 if (hbitmap) 289 if (hbitmap)
(...skipping 11 matching lines...) Expand all
290 // When the memory DC is created, its display surface is exactly one 301 // When the memory DC is created, its display surface is exactly one
291 // monochrome pixel wide and one monochrome pixel high. Since we select our 302 // monochrome pixel wide and one monochrome pixel high. Since we select our
292 // own bitmap, we must delete the previous one. 303 // own bitmap, we must delete the previous one.
293 DeleteObject(old_bitmap); 304 DeleteObject(old_bitmap);
294 // remember the hbitmap, so we can free it in our destructor 305 // remember the hbitmap, so we can free it in our destructor
295 platform_extra_ = (intptr_t)hbitmap; 306 platform_extra_ = (intptr_t)hbitmap;
296 return true; 307 return true;
297 } 308 }
298 309
299 } // namespace skia 310 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.cc ('k') | skia/ext/platform_canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698