OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
12 #include <windows.h> | 12 #include <windows.h> |
13 #include <vector> | 13 #include <vector> |
14 #endif | 14 #endif |
15 | 15 |
| 16 #include "third_party/skia/include/core/SkColor.h" |
| 17 #include "third_party/skia/include/core/SkDevice.h" |
16 #include "third_party/skia/include/core/SkPreConfig.h" | 18 #include "third_party/skia/include/core/SkPreConfig.h" |
17 #include "third_party/skia/include/core/SkDevice.h" | |
18 #include "third_party/skia/include/core/SkColor.h" | |
19 | 19 |
20 class SkMatrix; | 20 class SkMatrix; |
21 class SkMetaData; | 21 class SkMetaData; |
22 class SkPath; | 22 class SkPath; |
23 class SkRegion; | 23 class SkRegion; |
24 | 24 |
25 struct SkIRect; | |
26 | |
27 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_FREEBSD) \ | 25 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_FREEBSD) \ |
28 || defined(OS_SUN) | 26 || defined(OS_SUN) |
29 typedef struct _cairo cairo_t; | 27 typedef struct _cairo cairo_t; |
30 typedef struct _cairo_rectangle cairo_rectangle_t; | 28 typedef struct _cairo_rectangle cairo_rectangle_t; |
31 #elif defined(OS_MACOSX) | 29 #elif defined(OS_MACOSX) |
32 typedef struct CGContext* CGContextRef; | 30 typedef struct CGContext* CGContextRef; |
33 typedef struct CGRect CGRect; | 31 typedef struct CGRect CGRect; |
34 #endif | 32 #endif |
35 | 33 |
36 namespace skia { | 34 namespace skia { |
(...skipping 29 matching lines...) Expand all Loading... |
66 // PlatformDevice has been bound to the SkDevice passed, then the routines are | 64 // PlatformDevice has been bound to the SkDevice passed, then the routines are |
67 // NOPS. | 65 // NOPS. |
68 SK_API void SetPlatformDevice(SkDevice* device, | 66 SK_API void SetPlatformDevice(SkDevice* device, |
69 PlatformDevice* platform_device); | 67 PlatformDevice* platform_device); |
70 SK_API PlatformDevice* GetPlatformDevice(SkDevice* device); | 68 SK_API PlatformDevice* GetPlatformDevice(SkDevice* device); |
71 | 69 |
72 | 70 |
73 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
74 // Initializes the default settings and colors in a device context. | 72 // Initializes the default settings and colors in a device context. |
75 SK_API void InitializeDC(HDC context); | 73 SK_API void InitializeDC(HDC context); |
76 #elif defined (OS_MACOSX) | 74 #elif defined(OS_MACOSX) |
77 // Returns the CGContext that backing the SkDevice. Forwards to the bound | 75 // Returns the CGContext that backing the SkDevice. Forwards to the bound |
78 // PlatformDevice. Returns NULL if no PlatformDevice is bound. | 76 // PlatformDevice. Returns NULL if no PlatformDevice is bound. |
79 SK_API CGContextRef GetBitmapContext(SkDevice* device); | 77 SK_API CGContextRef GetBitmapContext(SkDevice* device); |
80 #endif | 78 #endif |
81 | 79 |
82 // Following routines are used in print preview workflow to mark the draft mode | 80 // Following routines are used in print preview workflow to mark the draft mode |
83 // metafile and preview metafile. | 81 // metafile and preview metafile. |
84 SK_API SkMetaData& getMetaData(const SkCanvas& canvas); | 82 SK_API SkMetaData& getMetaData(const SkCanvas& canvas); |
85 SK_API void SetIsDraftMode(const SkCanvas& canvas, bool draft_mode); | 83 SK_API void SetIsDraftMode(const SkCanvas& canvas, bool draft_mode); |
86 SK_API bool IsDraftMode(const SkCanvas& canvas); | 84 SK_API bool IsDraftMode(const SkCanvas& canvas); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 static bool SkPathToCubicPaths(CubicPaths* paths, const SkPath& skpath); | 170 static bool SkPathToCubicPaths(CubicPaths* paths, const SkPath& skpath); |
173 #elif defined(OS_MACOSX) | 171 #elif defined(OS_MACOSX) |
174 // Loads the specified Skia transform into the device context | 172 // Loads the specified Skia transform into the device context |
175 static void LoadTransformToCGContext(CGContextRef context, | 173 static void LoadTransformToCGContext(CGContextRef context, |
176 const SkMatrix& matrix); | 174 const SkMatrix& matrix); |
177 #endif | 175 #endif |
178 }; | 176 }; |
179 | 177 |
180 } // namespace skia | 178 } // namespace skia |
181 | 179 |
182 #endif | 180 #endif // SKIA_EXT_PLATFORM_DEVICE_H_ |
OLD | NEW |