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_H_ | 5 #ifndef SKIA_EXT_PLATFORM_DEVICE_H_ |
6 #define SKIA_EXT_PLATFORM_DEVICE_H_ | 6 #define SKIA_EXT_PLATFORM_DEVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // This file provides an easy way to include the appropriate PlatformDevice | 9 // This file provides an easy way to include the appropriate PlatformDevice |
10 // header file for your platform. | 10 // header file for your platform. |
11 | 11 |
12 #if defined(WIN32) | 12 #if defined(WIN32) |
13 #include <windows.h> | |
14 #endif | |
15 | |
16 #include "third_party/skia/include/core/SkPreConfig.h" | |
17 #include "third_party/skia/include/core/SkColor.h" | |
18 | |
19 | |
20 class SkDevice; | |
21 | |
22 #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) | |
23 typedef struct _cairo cairo_t; | |
24 #elif defined(__APPLE__) | |
25 typedef struct CGContext* CGContextRef; | |
26 typedef struct CGRect CGRect; | |
27 #endif | |
28 | |
29 namespace skia { | |
30 | |
31 class PlatformDevice; | |
32 | |
33 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
| |
34 | |
35 #if defined(WIN32) | |
36 typedef HDC PlatformSurface; | |
37 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) | |
38 typedef cairo_t* PlatformSurface; | |
39 #elif defined(__APPLE__) | |
40 typedef CGContextRef PlatformSurface; | |
41 #endif | |
42 | |
43 // The following routines provide accessor points for the functionality | |
44 // exported by the various PlatformDevice ports. The PlatformDevice, and | |
45 // BitmapPlatformDevice classes inherit directly from SkDevice, which is no | |
46 // longer a supported usage-pattern for skia. In preparation of the removal of | |
47 // these classes, all calls to PlatformDevice::* should be routed through these | |
48 // helper functions. | |
49 | |
50 // Bind a PlatformDevice instance, |behaviour| to |device|. Subsequent calls | |
51 // to the functions exported below will forward the request to the corresponding | |
52 // method on the bound PlatformBehaviour instance. If no PlatformDevice has | |
53 // been bound to the SkDevice passed, then the routines are NOPS. | |
54 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.
| |
55 SK_API PlatformDevice* GetPlatformDevice(SkDevice* device); | |
56 | |
57 // Returns if the preferred rendering engine is vectorial or bitmap based. | |
58 // Forwards to PlatformDevice::IsVectorial, if a PlatformDevice is bound, | |
59 // otherwise falls-back to the SkDevice::getDeviceCapabilities routine. | |
60 SK_API bool IsVectorial(SkDevice* device); | |
61 | |
62 // Returns if the native font rendering engine is allowed to render text to | |
63 // this device. | |
64 SK_API bool IsNativeFontRenderingAllowed(SkDevice* device); | |
65 | |
66 // Returns the PlatformSurface used for native rendering into the device. | |
67 SK_API PlatformSurface BeginPlatformPaint(SkDevice* device); | |
68 | |
69 // Finish a previous call to BeginPlatformPaint. | |
70 SK_API void EndPlatformPaint(SkDevice* device); | |
71 | |
72 // Returns the color value at the specified location. This does not | |
73 // consider any transforms that may be set on the device. | |
74 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
| |
75 | |
76 } // namespace platform_util | |
77 | |
78 } // namespace skia | |
79 | |
80 #if defined(WIN32) | |
13 #include "skia/ext/platform_device_win.h" | 81 #include "skia/ext/platform_device_win.h" |
14 #elif defined(__APPLE__) | 82 #elif defined(__APPLE__) |
15 #include "skia/ext/platform_device_mac.h" | 83 #include "skia/ext/platform_device_mac.h" |
16 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ | 84 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ |
17 defined(__Solaris__) | 85 defined(__Solaris__) |
18 #include "skia/ext/platform_device_linux.h" | 86 #include "skia/ext/platform_device_linux.h" |
19 #endif | 87 #endif |
20 | 88 |
21 #endif | 89 #endif |
OLD | NEW |