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 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // Draws the top layer of the canvas into the specified HDC. Only works | 55 // Draws the top layer of the canvas into the specified HDC. Only works |
56 // with a SkCanvas with a BitmapPlatformDevice. Will create a temporary | 56 // with a SkCanvas with a BitmapPlatformDevice. Will create a temporary |
57 // HDC to back the canvas if one doesn't already exist, tearing it down | 57 // HDC to back the canvas if one doesn't already exist, tearing it down |
58 // before returning. If |src_rect| is null, copies the entire canvas. | 58 // before returning. If |src_rect| is null, copies the entire canvas. |
59 SK_API void DrawToNativeContext(SkCanvas* canvas, | 59 SK_API void DrawToNativeContext(SkCanvas* canvas, |
60 HDC hdc, | 60 HDC hdc, |
61 int x, | 61 int x, |
62 int y, | 62 int y, |
63 const RECT* src_rect); | 63 const RECT* src_rect); |
| 64 |
| 65 // Returns the NativeDrawingContext to use for native platform drawing calls. |
| 66 SK_API HDC GetNativeDrawingContext(SkCanvas* canvas); |
| 67 |
64 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ | 68 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ |
65 defined(__sun) || defined(ANDROID) || defined(__APPLE__) | 69 defined(__sun) || defined(ANDROID) || defined(__APPLE__) |
66 // Construct a canvas from the given memory region. The memory is not cleared | 70 // Construct a canvas from the given memory region. The memory is not cleared |
67 // first. @data must be, at least, @height * StrideForWidth(@width) bytes. | 71 // first. @data must be, at least, @height * StrideForWidth(@width) bytes. |
68 SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvasWithPixels( | 72 SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvasWithPixels( |
69 int width, | 73 int width, |
70 int height, | 74 int height, |
71 bool is_opaque, | 75 bool is_opaque, |
72 uint8_t* data, | 76 uint8_t* data, |
73 OnFailureType failure_type); | 77 OnFailureType failure_type); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 118 |
115 // Gives the pixmap passed in *writable* access to the pixels backing this | 119 // Gives the pixmap passed in *writable* access to the pixels backing this |
116 // canvas. All writes to the pixmap should be visible if the canvas is | 120 // canvas. All writes to the pixmap should be visible if the canvas is |
117 // raster-backed. | 121 // raster-backed. |
118 // | 122 // |
119 // Returns false on failure: if either argument is nullptr, or if the | 123 // Returns false on failure: if either argument is nullptr, or if the |
120 // pixels can not be retrieved from the canvas. In the latter case resets | 124 // pixels can not be retrieved from the canvas. In the latter case resets |
121 // the pixmap to empty. | 125 // the pixmap to empty. |
122 SK_API bool GetWritablePixels(SkCanvas* canvas, SkPixmap* pixmap); | 126 SK_API bool GetWritablePixels(SkCanvas* canvas, SkPixmap* pixmap); |
123 | 127 |
124 // Returns the NativeDrawingContext to use for native platform drawing calls. | |
125 SK_API NativeDrawingContext GetNativeDrawingContext(SkCanvas* canvas); | |
126 | |
127 // Following routines are used in print preview workflow to mark the | 128 // Following routines are used in print preview workflow to mark the |
128 // preview metafile. | 129 // preview metafile. |
129 SK_API SkMetaData& GetMetaData(const SkCanvas& canvas); | 130 SK_API SkMetaData& GetMetaData(const SkCanvas& canvas); |
130 | 131 |
131 #if defined(OS_MACOSX) | 132 #if defined(OS_MACOSX) |
132 SK_API void SetIsPreviewMetafile(const SkCanvas& canvas, bool is_preview); | 133 SK_API void SetIsPreviewMetafile(const SkCanvas& canvas, bool is_preview); |
133 SK_API bool IsPreviewMetafile(const SkCanvas& canvas); | 134 SK_API bool IsPreviewMetafile(const SkCanvas& canvas); |
134 #endif | 135 #endif |
135 | 136 |
136 } // namespace skia | 137 } // namespace skia |
137 | 138 |
138 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ | 139 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ |
OLD | NEW |