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