| 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/SkPreConfig.h" | 16 #include "third_party/skia/include/core/SkPreConfig.h" |
| 17 #include "third_party/skia/include/core/SkDevice.h" | 17 #include "third_party/skia/include/core/SkDevice.h" |
| 18 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
| 19 | 19 |
| 20 class SkMatrix; | 20 class SkMatrix; |
| 21 class SkMetaData; | |
| 22 class SkPath; | 21 class SkPath; |
| 23 class SkRegion; | 22 class SkRegion; |
| 24 | 23 |
| 25 struct SkIRect; | 24 struct SkIRect; |
| 26 | 25 |
| 27 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_FREEBSD) \ | 26 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_FREEBSD) \ |
| 28 || defined(OS_SUN) | 27 || defined(OS_SUN) |
| 29 typedef struct _cairo cairo_t; | 28 typedef struct _cairo cairo_t; |
| 30 typedef struct _cairo_rectangle cairo_rectangle_t; | 29 typedef struct _cairo_rectangle cairo_rectangle_t; |
| 31 #elif defined(OS_MACOSX) | 30 #elif defined(OS_MACOSX) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 71 |
| 73 #if defined(OS_WIN) | 72 #if defined(OS_WIN) |
| 74 // Initializes the default settings and colors in a device context. | 73 // Initializes the default settings and colors in a device context. |
| 75 SK_API void InitializeDC(HDC context); | 74 SK_API void InitializeDC(HDC context); |
| 76 #elif defined (OS_MACOSX) | 75 #elif defined (OS_MACOSX) |
| 77 // Returns the CGContext that backing the SkDevice. Forwards to the bound | 76 // Returns the CGContext that backing the SkDevice. Forwards to the bound |
| 78 // PlatformDevice. Returns NULL if no PlatformDevice is bound. | 77 // PlatformDevice. Returns NULL if no PlatformDevice is bound. |
| 79 SK_API CGContextRef GetBitmapContext(SkDevice* device); | 78 SK_API CGContextRef GetBitmapContext(SkDevice* device); |
| 80 #endif | 79 #endif |
| 81 | 80 |
| 82 // Following routines are used in print preview workflow to mark the draft mode | |
| 83 // metafile and preview metafile. | |
| 84 SkMetaData& getMetaData(const SkCanvas& canvas); | |
| 85 void SetIsDraftMode(const SkCanvas& canvas, bool draft_mode); | |
| 86 bool IsDraftMode(const SkCanvas& canvas); | |
| 87 | |
| 88 #if defined(OS_MACOSX) || defined(OS_WIN) | |
| 89 void SetIsPreviewMetafile(const SkCanvas& canvas, bool is_preview); | |
| 90 bool IsPreviewMetafile(const SkCanvas& canvas); | |
| 91 #endif | |
| 92 | |
| 93 // A SkDevice is basically a wrapper around SkBitmap that provides a surface for | 81 // A SkDevice is basically a wrapper around SkBitmap that provides a surface for |
| 94 // SkCanvas to draw into. PlatformDevice provides a surface Windows can also | 82 // SkCanvas to draw into. PlatformDevice provides a surface Windows can also |
| 95 // write to. It also provides functionality to play well with GDI drawing | 83 // write to. It also provides functionality to play well with GDI drawing |
| 96 // functions. This class is abstract and must be subclassed. It provides the | 84 // functions. This class is abstract and must be subclassed. It provides the |
| 97 // basic interface to implement it either with or without a bitmap backend. | 85 // basic interface to implement it either with or without a bitmap backend. |
| 98 // | 86 // |
| 99 // PlatformDevice provides an interface which sub-classes of SkDevice can also | 87 // PlatformDevice provides an interface which sub-classes of SkDevice can also |
| 100 // provide to allow for drawing by the native platform into the device. | 88 // provide to allow for drawing by the native platform into the device. |
| 101 class SK_API PlatformDevice { | 89 class SK_API PlatformDevice { |
| 102 public: | 90 public: |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 #elif defined(OS_MACOSX) | 161 #elif defined(OS_MACOSX) |
| 174 // Loads the specified Skia transform into the device context | 162 // Loads the specified Skia transform into the device context |
| 175 static void LoadTransformToCGContext(CGContextRef context, | 163 static void LoadTransformToCGContext(CGContextRef context, |
| 176 const SkMatrix& matrix); | 164 const SkMatrix& matrix); |
| 177 #endif | 165 #endif |
| 178 }; | 166 }; |
| 179 | 167 |
| 180 } // namespace skia | 168 } // namespace skia |
| 181 | 169 |
| 182 #endif | 170 #endif |
| OLD | NEW |