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); | |
147 #endif | 134 #endif |
148 | 135 |
149 protected: | 136 protected: |
150 #if defined(OS_WIN) | 137 #if defined(OS_WIN) |
151 // Arrays must be inside structures. | 138 // Arrays must be inside structures. |
152 struct CubicPoints { | 139 struct CubicPoints { |
153 SkPoint p[4]; | 140 SkPoint p[4]; |
154 }; | 141 }; |
155 typedef std::vector<CubicPoints> CubicPath; | 142 typedef std::vector<CubicPoints> CubicPath; |
156 typedef std::vector<CubicPath> CubicPaths; | 143 typedef std::vector<CubicPath> CubicPaths; |
157 | 144 |
158 // Loads the specified Skia transform into the device context, excluding | 145 // Loads the specified Skia transform into the device context, excluding |
159 // perspective (which GDI doesn't support). | 146 // perspective (which GDI doesn't support). |
160 static void LoadTransformToDC(HDC dc, const SkMatrix& matrix); | 147 static void LoadTransformToDC(HDC dc, const SkMatrix& matrix); |
161 | 148 |
162 // Transforms SkPath's paths into a series of cubic path. | 149 // Transforms SkPath's paths into a series of cubic path. |
163 static bool SkPathToCubicPaths(CubicPaths* paths, const SkPath& skpath); | 150 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); | |
168 #endif | 151 #endif |
169 }; | 152 }; |
170 | 153 |
171 } // namespace skia | 154 } // namespace skia |
172 | 155 |
173 #endif // SKIA_EXT_PLATFORM_DEVICE_H_ | 156 #endif // SKIA_EXT_PLATFORM_DEVICE_H_ |
OLD | NEW |