| 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 #ifndef SKIA_EXT_PLATFORM_DEVICE_WIN_H_ | 5 #ifndef SKIA_EXT_PLATFORM_DEVICE_WIN_H_ |
| 6 #define SKIA_EXT_PLATFORM_DEVICE_WIN_H_ | 6 #define SKIA_EXT_PLATFORM_DEVICE_WIN_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "SkDevice.h" | 12 #include "SkDevice.h" |
| 13 | 13 |
| 14 class SkMatrix; | 14 class SkMatrix; |
| 15 class SkPath; | 15 class SkPath; |
| 16 class SkRegion; | 16 class SkRegion; |
| 17 | 17 |
| 18 namespace skia { | 18 namespace skia { |
| 19 | 19 |
| 20 // A device is basically a wrapper around SkBitmap that provides a surface for | 20 // A device is basically a wrapper around SkBitmap that provides a surface for |
| 21 // SkCanvas to draw into. Our device provides a surface Windows can also write | 21 // SkCanvas to draw into. Our device provides a surface Windows can also write |
| 22 // to. It also provides functionality to play well with GDI drawing functions. | 22 // to. It also provides functionality to play well with GDI drawing functions. |
| 23 // This class is abstract and must be subclassed. It provides the basic | 23 // This class is abstract and must be subclassed. It provides the basic |
| 24 // interface to implement it either with or without a bitmap backend. | 24 // interface to implement it either with or without a bitmap backend. |
| 25 class PlatformDeviceWin : public SkDevice { | 25 class PlatformDevice : public SkDevice { |
| 26 public: | 26 public: |
| 27 typedef HDC PlatformSurface; |
| 28 |
| 27 // The DC that corresponds to the bitmap, used for GDI operations drawing | 29 // The DC that corresponds to the bitmap, used for GDI operations drawing |
| 28 // into the bitmap. This is possibly heavyweight, so it should be existant | 30 // into the bitmap. This is possibly heavyweight, so it should be existant |
| 29 // only during one pass of rendering. | 31 // only during one pass of rendering. |
| 30 virtual HDC getBitmapDC() = 0; | 32 virtual HDC getBitmapDC() = 0; |
| 31 | 33 |
| 32 // Draws to the given screen DC, if the bitmap DC doesn't exist, this will | 34 // Draws to the given screen DC, if the bitmap DC doesn't exist, this will |
| 33 // temporarily create it. However, if you have created the bitmap DC, it will | 35 // temporarily create it. However, if you have created the bitmap DC, it will |
| 34 // be more efficient if you don't free it until after this call so it doesn't | 36 // be more efficient if you don't free it until after this call so it doesn't |
| 35 // have to be created twice. If src_rect is null, then the entirety of the | 37 // have to be created twice. If src_rect is null, then the entirety of the |
| 36 // source device will be copied. | 38 // source device will be copied. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 55 | 57 |
| 56 protected: | 58 protected: |
| 57 // Arrays must be inside structures. | 59 // Arrays must be inside structures. |
| 58 struct CubicPoints { | 60 struct CubicPoints { |
| 59 SkPoint p[4]; | 61 SkPoint p[4]; |
| 60 }; | 62 }; |
| 61 typedef std::vector<CubicPoints> CubicPath; | 63 typedef std::vector<CubicPoints> CubicPath; |
| 62 typedef std::vector<CubicPath> CubicPaths; | 64 typedef std::vector<CubicPath> CubicPaths; |
| 63 | 65 |
| 64 // Forwards |bitmap| to SkDevice's constructor. | 66 // Forwards |bitmap| to SkDevice's constructor. |
| 65 PlatformDeviceWin(const SkBitmap& bitmap); | 67 PlatformDevice(const SkBitmap& bitmap); |
| 66 | 68 |
| 67 // Loads the specified Skia transform into the device context, excluding | 69 // Loads the specified Skia transform into the device context, excluding |
| 68 // perspective (which GDI doesn't support). | 70 // perspective (which GDI doesn't support). |
| 69 static void LoadTransformToDC(HDC dc, const SkMatrix& matrix); | 71 static void LoadTransformToDC(HDC dc, const SkMatrix& matrix); |
| 70 | 72 |
| 71 // Transforms SkPath's paths into a series of cubic path. | 73 // Transforms SkPath's paths into a series of cubic path. |
| 72 static bool SkPathToCubicPaths(CubicPaths* paths, const SkPath& skpath); | 74 static bool SkPathToCubicPaths(CubicPaths* paths, const SkPath& skpath); |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 } // namespace skia | 77 } // namespace skia |
| 76 | 78 |
| 77 #endif // SKIA_EXT_PLATFORM_DEVICE_WIN_H_ | 79 #endif // SKIA_EXT_PLATFORM_DEVICE_WIN_H_ |
| 78 | 80 |
| OLD | NEW |