Chromium Code Reviews| 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_win.h" | 5 #include "skia/ext/platform_device_win.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 PlatformDevice::PlatformDevice(const SkBitmap& bitmap) |
| 16 : SkDevice(NULL, bitmap, /*isForLayer=*/false) { | 16 : SkDevice(NULL, bitmap, /*isForLayer=*/false) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 HDC PlatformDevice::beginPlatformPaint() { | |
| 20 return getBitmapDC(); | |
| 21 } | |
| 22 | |
| 23 void PlatformDevice::endPlatformPaint() { | |
| 24 // we don't clear the DC here since it will be likely to be used again | |
|
vangelis
2011/04/05 06:23:10
This reads a little strange. If they are supposed
alokp
2011/04/05 15:37:56
Done.
| |
| 25 // flushing will be done in onAccessBitmap | |
| 26 } | |
| 27 | |
| 19 // static | 28 // static |
| 20 void PlatformDevice::InitializeDC(HDC context) { | 29 void PlatformDevice::InitializeDC(HDC context) { |
| 21 // Enables world transformation. | 30 // Enables world transformation. |
| 22 // If the GM_ADVANCED graphics mode is set, GDI always draws arcs in the | 31 // If the GM_ADVANCED graphics mode is set, GDI always draws arcs in the |
| 23 // counterclockwise direction in logical space. This is equivalent to the | 32 // counterclockwise direction in logical space. This is equivalent to the |
| 24 // statement that, in the GM_ADVANCED graphics mode, both arc control points | 33 // statement that, in the GM_ADVANCED graphics mode, both arc control points |
| 25 // and arcs themselves fully respect the device context's world-to-device | 34 // and arcs themselves fully respect the device context's world-to-device |
| 26 // transformation. | 35 // transformation. |
| 27 BOOL res = SetGraphicsMode(context, GM_ADVANCED); | 36 BOOL res = SetGraphicsMode(context, GM_ADVANCED); |
| 28 SkASSERT(res != 0); | 37 SkASSERT(res != 0); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 hrgn = PathToRegion(context); | 228 hrgn = PathToRegion(context); |
| 220 } | 229 } |
| 221 int result = SelectClipRgn(context, hrgn); | 230 int result = SelectClipRgn(context, hrgn); |
| 222 SkASSERT(result != ERROR); | 231 SkASSERT(result != ERROR); |
| 223 result = DeleteObject(hrgn); | 232 result = DeleteObject(hrgn); |
| 224 SkASSERT(result != 0); | 233 SkASSERT(result != 0); |
| 225 } | 234 } |
| 226 | 235 |
| 227 } // namespace skia | 236 } // namespace skia |
| 228 | 237 |
| OLD | NEW |