OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef SKIA_EXT_PLATFORM_DEVICE_H_ |
6 #define SKIA_EXT_PLATFORM_DEVICE_H_ | 6 #define SKIA_EXT_PLATFORM_DEVICE_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // Loads a SkRegion into the GDI context. | 124 // Loads a SkRegion into the GDI context. |
125 static void LoadClippingRegionToDC(HDC context, const SkRegion& region, | 125 static void LoadClippingRegionToDC(HDC context, const SkRegion& region, |
126 const SkMatrix& transformation); | 126 const SkMatrix& transformation); |
127 | 127 |
128 // Draws to the given screen DC, if the bitmap DC doesn't exist, this will | 128 // Draws to the given screen DC, if the bitmap DC doesn't exist, this will |
129 // temporarily create it. However, if you have created the bitmap DC, it will | 129 // temporarily create it. However, if you have created the bitmap DC, it will |
130 // be more efficient if you don't free it until after this call so it doesn't | 130 // be more efficient if you don't free it until after this call so it doesn't |
131 // have to be created twice. If src_rect is null, then the entirety of the | 131 // have to be created twice. If src_rect is null, then the entirety of the |
132 // source device will be copied. | 132 // source device will be copied. |
133 virtual void DrawToHDC(HDC, int x, int y, const RECT* src_rect); | 133 virtual void DrawToHDC(HDC, int x, int y, const RECT* src_rect); |
| 134 |
| 135 #elif defined(OS_MACOSX) |
| 136 // Loads a SkPath into the CG context. The path can there after be used for |
| 137 // clipping or as a stroke. |
| 138 static void LoadPathToCGContext(CGContextRef context, const SkPath& path); |
| 139 |
| 140 // Initializes the default settings and colors in a device context. |
| 141 static void InitializeCGContext(CGContextRef context); |
| 142 |
| 143 // Loads a SkRegion into the CG context. |
| 144 static void LoadClippingRegionToCGContext(CGContextRef context, |
| 145 const SkRegion& region, |
| 146 const SkMatrix& transformation); |
134 #endif | 147 #endif |
135 | 148 |
136 protected: | 149 protected: |
137 #if defined(OS_WIN) | 150 #if defined(OS_WIN) |
138 // Arrays must be inside structures. | 151 // Arrays must be inside structures. |
139 struct CubicPoints { | 152 struct CubicPoints { |
140 SkPoint p[4]; | 153 SkPoint p[4]; |
141 }; | 154 }; |
142 typedef std::vector<CubicPoints> CubicPath; | 155 typedef std::vector<CubicPoints> CubicPath; |
143 typedef std::vector<CubicPath> CubicPaths; | 156 typedef std::vector<CubicPath> CubicPaths; |
144 | 157 |
145 // Loads the specified Skia transform into the device context, excluding | 158 // Loads the specified Skia transform into the device context, excluding |
146 // perspective (which GDI doesn't support). | 159 // perspective (which GDI doesn't support). |
147 static void LoadTransformToDC(HDC dc, const SkMatrix& matrix); | 160 static void LoadTransformToDC(HDC dc, const SkMatrix& matrix); |
148 | 161 |
149 // Transforms SkPath's paths into a series of cubic path. | 162 // Transforms SkPath's paths into a series of cubic path. |
150 static bool SkPathToCubicPaths(CubicPaths* paths, const SkPath& skpath); | 163 static bool SkPathToCubicPaths(CubicPaths* paths, const SkPath& skpath); |
| 164 #elif defined(OS_MACOSX) |
| 165 // Loads the specified Skia transform into the device context |
| 166 static void LoadTransformToCGContext(CGContextRef context, |
| 167 const SkMatrix& matrix); |
151 #endif | 168 #endif |
152 }; | 169 }; |
153 | 170 |
154 } // namespace skia | 171 } // namespace skia |
155 | 172 |
156 #endif // SKIA_EXT_PLATFORM_DEVICE_H_ | 173 #endif // SKIA_EXT_PLATFORM_DEVICE_H_ |
OLD | NEW |