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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 #endif | 106 #endif |
107 | 107 |
108 // The DC that corresponds to the bitmap, used for GDI operations drawing | 108 // The DC that corresponds to the bitmap, used for GDI operations drawing |
109 // into the bitmap. This is possibly heavyweight, so it should be existant | 109 // into the bitmap. This is possibly heavyweight, so it should be existant |
110 // only during one pass of rendering. | 110 // only during one pass of rendering. |
111 virtual PlatformSurface BeginPlatformPaint(); | 111 virtual PlatformSurface BeginPlatformPaint(); |
112 | 112 |
113 // Finish a previous call to beginPlatformPaint. | 113 // Finish a previous call to beginPlatformPaint. |
114 virtual void EndPlatformPaint(); | 114 virtual void EndPlatformPaint(); |
115 | 115 |
116 // Draws to the given screen DC, if the bitmap DC doesn't exist, this will | |
117 // temporarily create it. However, if you have created the bitmap DC, it will | |
118 // be more efficient if you don't free it until after this call so it doesn't | |
119 // have to be created twice. If src_rect is null, then the entirety of the | |
120 // source device will be copied. | |
121 virtual void DrawToNativeContext(PlatformSurface surface, int x, int y, | |
122 const PlatformRect* src_rect) = 0; | |
123 | |
124 // Returns true if GDI operations can be used for drawing into the bitmap. | 116 // Returns true if GDI operations can be used for drawing into the bitmap. |
125 virtual bool SupportsPlatformPaint(); | 117 virtual bool SupportsPlatformPaint(); |
126 | 118 |
127 #if defined(OS_WIN) | 119 #if defined(OS_WIN) |
128 // Loads a SkPath into the GDI context. The path can there after be used for | 120 // Loads a SkPath into the GDI context. The path can there after be used for |
129 // clipping or as a stroke. Returns false if the path failed to be loaded. | 121 // clipping or as a stroke. Returns false if the path failed to be loaded. |
130 static bool LoadPathToDC(HDC context, const SkPath& path); | 122 static bool LoadPathToDC(HDC context, const SkPath& path); |
131 | 123 |
132 // Loads a SkRegion into the GDI context. | 124 // Loads a SkRegion into the GDI context. |
133 static void LoadClippingRegionToDC(HDC context, const SkRegion& region, | 125 static void LoadClippingRegionToDC(HDC context, const SkRegion& region, |
134 const SkMatrix& transformation); | 126 const SkMatrix& transformation); |
| 127 |
| 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 |
| 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 |
| 132 // source device will be copied. |
| 133 virtual void DrawToHDC(HDC, int x, int y, const RECT* src_rect); |
| 134 |
135 #elif defined(OS_MACOSX) | 135 #elif defined(OS_MACOSX) |
136 // Loads a SkPath into the CG context. The path can there after be used for | 136 // Loads a SkPath into the CG context. The path can there after be used for |
137 // clipping or as a stroke. | 137 // clipping or as a stroke. |
138 static void LoadPathToCGContext(CGContextRef context, const SkPath& path); | 138 static void LoadPathToCGContext(CGContextRef context, const SkPath& path); |
139 | 139 |
140 // Initializes the default settings and colors in a device context. | 140 // Initializes the default settings and colors in a device context. |
141 static void InitializeCGContext(CGContextRef context); | 141 static void InitializeCGContext(CGContextRef context); |
142 | 142 |
143 // Loads a SkRegion into the CG context. | 143 // Loads a SkRegion into the CG context. |
144 static void LoadClippingRegionToCGContext(CGContextRef context, | 144 static void LoadClippingRegionToCGContext(CGContextRef context, |
(...skipping 19 matching lines...) Expand all Loading... |
164 #elif defined(OS_MACOSX) | 164 #elif defined(OS_MACOSX) |
165 // Loads the specified Skia transform into the device context | 165 // Loads the specified Skia transform into the device context |
166 static void LoadTransformToCGContext(CGContextRef context, | 166 static void LoadTransformToCGContext(CGContextRef context, |
167 const SkMatrix& matrix); | 167 const SkMatrix& matrix); |
168 #endif | 168 #endif |
169 }; | 169 }; |
170 | 170 |
171 } // namespace skia | 171 } // namespace skia |
172 | 172 |
173 #endif // SKIA_EXT_PLATFORM_DEVICE_H_ | 173 #endif // SKIA_EXT_PLATFORM_DEVICE_H_ |
OLD | NEW |