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

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

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Addressing comments. Created 9 years, 7 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "skia/ext/platform_device_win.h" 5 #include "skia/ext/platform_device.h"
6 6
7 #include "skia/ext/skia_utils_win.h" 7 #include "skia/ext/skia_utils_win.h"
8 #include "third_party/skia/include/core/SkMatrix.h" 8 #include "third_party/skia/include/core/SkMatrix.h"
9 #include "third_party/skia/include/core/SkPath.h" 9 #include "third_party/skia/include/core/SkPath.h"
10 #include "third_party/skia/include/core/SkRegion.h" 10 #include "third_party/skia/include/core/SkRegion.h"
11 #include "third_party/skia/include/core/SkUtils.h" 11 #include "third_party/skia/include/core/SkUtils.h"
12 12
13 namespace skia { 13 namespace skia {
14 14
15 PlatformDevice::PlatformDevice(const SkBitmap& bitmap) 15 void MakeOpaque(SkDevice* device, int x, int y, int width, int height) {
16 : SkDevice(NULL, bitmap, /*isForLayer=*/false) { 16 PlatformDevice* platform_device = GetPlatformDevice(device);
17 if (platform_device)
18 platform_device->MakeOpaque(x, y, width, height);
17 } 19 }
18 20
19 void PlatformDevice::EndPlatformPaint() { 21 void InitializeDC(HDC context) {
20 // We don't clear the DC here since it will be likely to be used again.
21 // Flushing will be done in onAccessBitmap.
22 }
23
24 // static
25 void PlatformDevice::InitializeDC(HDC context) {
26 // Enables world transformation. 22 // Enables world transformation.
27 // If the GM_ADVANCED graphics mode is set, GDI always draws arcs in the 23 // If the GM_ADVANCED graphics mode is set, GDI always draws arcs in the
28 // counterclockwise direction in logical space. This is equivalent to the 24 // counterclockwise direction in logical space. This is equivalent to the
29 // statement that, in the GM_ADVANCED graphics mode, both arc control points 25 // statement that, in the GM_ADVANCED graphics mode, both arc control points
30 // and arcs themselves fully respect the device context's world-to-device 26 // and arcs themselves fully respect the device context's world-to-device
31 // transformation. 27 // transformation.
32 BOOL res = SetGraphicsMode(context, GM_ADVANCED); 28 BOOL res = SetGraphicsMode(context, GM_ADVANCED);
33 SkASSERT(res != 0); 29 SkASSERT(res != 0);
34 30
35 // Enables dithering. 31 // Enables dithering.
(...skipping 18 matching lines...) Expand all
54 res = SetDCPenColor(context, RGB(0, 0, 0)); 50 res = SetDCPenColor(context, RGB(0, 0, 0));
55 SkASSERT(res != CLR_INVALID); 51 SkASSERT(res != CLR_INVALID);
56 52
57 // Sets up default transparency. 53 // Sets up default transparency.
58 res = SetBkMode(context, OPAQUE); 54 res = SetBkMode(context, OPAQUE);
59 SkASSERT(res != 0); 55 SkASSERT(res != 0);
60 res = SetROP2(context, R2_COPYPEN); 56 res = SetROP2(context, R2_COPYPEN);
61 SkASSERT(res != 0); 57 SkASSERT(res != 0);
62 } 58 }
63 59
60 PlatformDevice::PlatformDevice(const SkBitmap& bitmap)
61 : SkDevice(NULL, bitmap, /*isForLayer=*/false) {
62 SetPlatformDevice(this, this);
63 }
64
65 void PlatformDevice::EndPlatformPaint() {
66 // We don't clear the DC here since it will be likely to be used again.
67 // Flushing will be done in onAccessBitmap.
68 }
69
64 // static 70 // static
65 void PlatformDevice::LoadPathToDC(HDC context, const SkPath& path) { 71 void PlatformDevice::LoadPathToDC(HDC context, const SkPath& path) {
66 switch (path.getFillType()) { 72 switch (path.getFillType()) {
67 case SkPath::kWinding_FillType: { 73 case SkPath::kWinding_FillType: {
68 int res = SetPolyFillMode(context, WINDING); 74 int res = SetPolyFillMode(context, WINDING);
69 SkASSERT(res != 0); 75 SkASSERT(res != 0);
70 break; 76 break;
71 } 77 }
72 case SkPath::kEvenOdd_FillType: { 78 case SkPath::kEvenOdd_FillType: {
73 int res = SetPolyFillMode(context, ALTERNATE); 79 int res = SetPolyFillMode(context, ALTERNATE);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 hrgn = PathToRegion(context); 230 hrgn = PathToRegion(context);
225 } 231 }
226 int result = SelectClipRgn(context, hrgn); 232 int result = SelectClipRgn(context, hrgn);
227 SkASSERT(result != ERROR); 233 SkASSERT(result != ERROR);
228 result = DeleteObject(hrgn); 234 result = DeleteObject(hrgn);
229 SkASSERT(result != 0); 235 SkASSERT(result != 0);
230 } 236 }
231 237
232 } // namespace skia 238 } // namespace skia
233 239
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698