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_CANVAS_H_ | 5 #ifndef SKIA_EXT_PLATFORM_CANVAS_H_ |
6 #define SKIA_EXT_PLATFORM_CANVAS_H_ | 6 #define SKIA_EXT_PLATFORM_CANVAS_H_ |
7 | 7 |
8 // The platform-specific device will include the necessary platform headers | 8 // The platform-specific device will include the necessary platform headers |
9 // to get the surface type. | 9 // to get the surface type. |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "skia/ext/platform_device.h" | 11 #include "skia/ext/platform_surface.h" |
12 #include "skia/ext/refptr.h" | 12 #include "skia/ext/refptr.h" |
13 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
14 #include "third_party/skia/include/core/SkCanvas.h" | 14 #include "third_party/skia/include/core/SkCanvas.h" |
15 #include "third_party/skia/include/core/SkPixelRef.h" | 15 #include "third_party/skia/include/core/SkPixelRef.h" |
16 #include "third_party/skia/include/core/SkPixmap.h" | 16 #include "third_party/skia/include/core/SkPixmap.h" |
17 | 17 |
| 18 class SkBaseDevice; |
| 19 |
18 namespace skia { | 20 namespace skia { |
19 | 21 |
20 typedef SkCanvas PlatformCanvas; | 22 typedef SkCanvas PlatformCanvas; |
21 | 23 |
22 // | 24 // |
23 // Note about error handling. | 25 // Note about error handling. |
24 // | 26 // |
25 // Creating a canvas can fail at times, most often because we fail to allocate | 27 // Creating a canvas can fail at times, most often because we fail to allocate |
26 // the backing-store (pixels). This can be from out-of-memory, or something | 28 // the backing-store (pixels). This can be from out-of-memory, or something |
27 // more opaque, like GDI or cairo reported a failure. | 29 // more opaque, like GDI or cairo reported a failure. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 PlatformSurface GetPlatformSurface() { return platform_surface_; } | 166 PlatformSurface GetPlatformSurface() { return platform_surface_; } |
165 private: | 167 private: |
166 SkCanvas* canvas_; | 168 SkCanvas* canvas_; |
167 PlatformSurface platform_surface_; | 169 PlatformSurface platform_surface_; |
168 | 170 |
169 // Disallow copy and assign | 171 // Disallow copy and assign |
170 ScopedPlatformPaint(const ScopedPlatformPaint&); | 172 ScopedPlatformPaint(const ScopedPlatformPaint&); |
171 ScopedPlatformPaint& operator=(const ScopedPlatformPaint&); | 173 ScopedPlatformPaint& operator=(const ScopedPlatformPaint&); |
172 }; | 174 }; |
173 | 175 |
| 176 // Following routines are used in print preview workflow to mark the |
| 177 // preview metafile. |
| 178 SK_API SkMetaData& GetMetaData(const SkCanvas& canvas); |
| 179 |
| 180 #if defined(OS_MACOSX) |
| 181 SK_API void SetIsPreviewMetafile(const SkCanvas& canvas, bool is_preview); |
| 182 SK_API bool IsPreviewMetafile(const SkCanvas& canvas); |
| 183 |
| 184 // Returns the CGContext that backing the SkCanvas. |
| 185 // Returns NULL if none is bound. |
| 186 SK_API CGContextRef GetBitmapContext(const SkCanvas& canvas); |
| 187 #endif |
| 188 |
174 } // namespace skia | 189 } // namespace skia |
175 | 190 |
176 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ | 191 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ |
OLD | NEW |