OLD | NEW |
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.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" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 res = SetDCPenColor(context, RGB(0, 0, 0)); | 44 res = SetDCPenColor(context, RGB(0, 0, 0)); |
45 SkASSERT(res != CLR_INVALID); | 45 SkASSERT(res != CLR_INVALID); |
46 | 46 |
47 // Sets up default transparency. | 47 // Sets up default transparency. |
48 res = SetBkMode(context, OPAQUE); | 48 res = SetBkMode(context, OPAQUE); |
49 SkASSERT(res != 0); | 49 SkASSERT(res != 0); |
50 res = SetROP2(context, R2_COPYPEN); | 50 res = SetROP2(context, R2_COPYPEN); |
51 SkASSERT(res != 0); | 51 SkASSERT(res != 0); |
52 } | 52 } |
53 | 53 |
| 54 PlatformDevice::PlatformDevice(SkDevice* device) : device_(device) { |
| 55 SetPlatformDevice(device_, this, true); |
| 56 } |
| 57 |
| 58 #if 0 |
54 PlatformDevice::PlatformDevice(const SkBitmap& bitmap) | 59 PlatformDevice::PlatformDevice(const SkBitmap& bitmap) |
55 : SkDevice(bitmap) { | 60 : SkDevice(bitmap) { |
56 SetPlatformDevice(this, this); | 61 SetPlatformDevice(this, this); |
57 } | 62 } |
| 63 #endif |
58 | 64 |
59 void PlatformDevice::EndPlatformPaint() { | 65 void PlatformDevice::EndPlatformPaint() { |
60 // We don't clear the DC here since it will be likely to be used again. | 66 // We don't clear the DC here since it will be likely to be used again. |
61 // Flushing will be done in onAccessBitmap. | 67 // Flushing will be done in onAccessBitmap. |
62 } | 68 } |
63 | 69 |
64 // static | 70 // static |
65 bool PlatformDevice::LoadPathToDC(HDC context, const SkPath& path) { | 71 bool 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: { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 hrgn = PathToRegion(context); | 233 hrgn = PathToRegion(context); |
228 } | 234 } |
229 int result = SelectClipRgn(context, hrgn); | 235 int result = SelectClipRgn(context, hrgn); |
230 SkASSERT(result != ERROR); | 236 SkASSERT(result != ERROR); |
231 result = DeleteObject(hrgn); | 237 result = DeleteObject(hrgn); |
232 SkASSERT(result != 0); | 238 SkASSERT(result != 0); |
233 } | 239 } |
234 | 240 |
235 } // namespace skia | 241 } // namespace skia |
236 | 242 |
OLD | NEW |