Index: skia/ext/platform_device.h |
=================================================================== |
--- skia/ext/platform_device.h (revision 85672) |
+++ skia/ext/platform_device.h (working copy) |
@@ -10,6 +10,74 @@ |
// header file for your platform. |
#if defined(WIN32) |
+#include <windows.h> |
+#endif |
+ |
+#include "third_party/skia/include/core/SkPreConfig.h" |
+#include "third_party/skia/include/core/SkColor.h" |
+ |
+ |
+class SkDevice; |
+ |
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) |
+typedef struct _cairo cairo_t; |
+#elif defined(__APPLE__) |
+typedef struct CGContext* CGContextRef; |
+typedef struct CGRect CGRect; |
+#endif |
+ |
+namespace skia { |
+ |
+class PlatformDevice; |
+ |
+namespace platform_util { |
alokp
2011/05/18 03:25:42
is this namespace required? can we keep things in
Jeff Timanus
2011/05/18 22:10:28
No, it's not required. I added it to further enca
|
+ |
+#if defined(WIN32) |
+typedef HDC PlatformSurface; |
+#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) |
+typedef cairo_t* PlatformSurface; |
+#elif defined(__APPLE__) |
+typedef CGContextRef PlatformSurface; |
+#endif |
+ |
+// The following routines provide accessor points for the functionality |
+// exported by the various PlatformDevice ports. The PlatformDevice, and |
+// BitmapPlatformDevice classes inherit directly from SkDevice, which is no |
+// longer a supported usage-pattern for skia. In preparation of the removal of |
+// these classes, all calls to PlatformDevice::* should be routed through these |
+// helper functions. |
+ |
+// Bind a PlatformDevice instance, |behaviour| to |device|. Subsequent calls |
+// to the functions exported below will forward the request to the corresponding |
+// method on the bound PlatformBehaviour instance. If no PlatformDevice has |
+// been bound to the SkDevice passed, then the routines are NOPS. |
+SK_API void SetPlatformDevice(SkDevice* device, PlatformDevice* behaviour); |
alokp
2011/05/18 03:25:42
this is a little confusing. PlatformBehaviour and
Jeff Timanus
2011/05/18 22:10:28
My mistake. Corrected.
|
+SK_API PlatformDevice* GetPlatformDevice(SkDevice* device); |
+ |
+// Returns if the preferred rendering engine is vectorial or bitmap based. |
+// Forwards to PlatformDevice::IsVectorial, if a PlatformDevice is bound, |
+// otherwise falls-back to the SkDevice::getDeviceCapabilities routine. |
+SK_API bool IsVectorial(SkDevice* device); |
+ |
+// Returns if the native font rendering engine is allowed to render text to |
+// this device. |
+SK_API bool IsNativeFontRenderingAllowed(SkDevice* device); |
+ |
+// Returns the PlatformSurface used for native rendering into the device. |
+SK_API PlatformSurface BeginPlatformPaint(SkDevice* device); |
+ |
+// Finish a previous call to BeginPlatformPaint. |
+SK_API void EndPlatformPaint(SkDevice* device); |
+ |
+// Returns the color value at the specified location. This does not |
+// consider any transforms that may be set on the device. |
+SK_API SkColor GetColorAt(SkDevice* device, int x, int y); |
alokp
2011/05/18 03:25:42
this function does not seem to be doing anything u
Jeff Timanus
2011/05/18 22:10:28
Removed. Turned out that there were only very few
|
+ |
+} // namespace platform_util |
+ |
+} // namespace skia |
+ |
+#if defined(WIN32) |
#include "skia/ext/platform_device_win.h" |
#elif defined(__APPLE__) |
#include "skia/ext/platform_device_mac.h" |