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

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

Issue 7193040: Revert 91504 - Stop using deprecated factory API for SkDevice (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 5 months 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_win.h ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
11 #include "third_party/skia/include/core/SkMatrix.h" 11 #include "third_party/skia/include/core/SkMatrix.h"
12 #include "third_party/skia/include/core/SkRefCnt.h" 12 #include "third_party/skia/include/core/SkRefCnt.h"
13 #include "third_party/skia/include/core/SkRegion.h" 13 #include "third_party/skia/include/core/SkRegion.h"
14 #include "third_party/skia/include/core/SkUtils.h" 14 #include "third_party/skia/include/core/SkUtils.h"
15 15
16 namespace skia { 16 namespace skia {
17 17
18 SkDevice* BitmapPlatformDeviceFactory::newDevice(SkCanvas* ignored,
19 SkBitmap::Config config,
20 int width, int height,
21 bool isOpaque,
22 bool isForLayer) {
23 SkASSERT(config == SkBitmap::kARGB_8888_Config);
24 return BitmapPlatformDevice::create(width, height, isOpaque, NULL);
25 }
26
18 BitmapPlatformDevice::BitmapPlatformDeviceData::BitmapPlatformDeviceData( 27 BitmapPlatformDevice::BitmapPlatformDeviceData::BitmapPlatformDeviceData(
19 HBITMAP hbitmap) 28 HBITMAP hbitmap)
20 : bitmap_context_(hbitmap), 29 : bitmap_context_(hbitmap),
21 hdc_(NULL), 30 hdc_(NULL),
22 config_dirty_(true) { // Want to load the config next time. 31 config_dirty_(true) { // Want to load the config next time.
23 // Initialize the clip region to the entire bitmap. 32 // Initialize the clip region to the entire bitmap.
24 BITMAP bitmap_data; 33 BITMAP bitmap_data;
25 if (GetObject(bitmap_context_, sizeof(BITMAP), &bitmap_data)) { 34 if (GetObject(bitmap_context_, sizeof(BITMAP), &bitmap_data)) {
26 SkIRect rect; 35 SkIRect rect;
27 rect.set(0, 0, bitmap_data.bmWidth, bitmap_data.bmHeight); 36 rect.set(0, 0, bitmap_data.bmWidth, bitmap_data.bmHeight);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 data_->ReleaseBitmapDC(); 256 data_->ReleaseBitmapDC();
248 } 257 }
249 258
250 void BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) { 259 void BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) {
251 // FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI 260 // FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI
252 // operation has occurred on our DC. 261 // operation has occurred on our DC.
253 if (data_->IsBitmapDCCreated()) 262 if (data_->IsBitmapDCCreated())
254 GdiFlush(); 263 GdiFlush();
255 } 264 }
256 265
257 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice( 266 SkDeviceFactory* BitmapPlatformDevice::onNewDeviceFactory() {
258 SkBitmap::Config config, int width, int height, bool isOpaque, 267 return SkNEW(BitmapPlatformDeviceFactory);
259 Usage /*usage*/) {
260 SkASSERT(config == SkBitmap::kARGB_8888_Config);
261 return BitmapPlatformDevice::create(width, height, isOpaque, NULL);
262 } 268 }
263 269
264 } // namespace skia 270 } // namespace skia
265 271
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_win.h ('k') | skia/ext/platform_canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698