Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1109)

Side by Side Diff: skia/ext/platform_canvas.h

Issue 10915065: Add PlatformPictureSkia and RecordingPlatformDeviceSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix SkProxyCanvas leak Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "skia/ext/platform_device.h" 10 #include "skia/ext/platform_device.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Use this instead of CreateBitmapCanvas in places that are likely to 113 // Use this instead of CreateBitmapCanvas in places that are likely to
114 // attempt to allocate very large canvases (therefore likely to fail), 114 // attempt to allocate very large canvases (therefore likely to fail),
115 // and where it is possible to recover gracefully from the failed allocation. 115 // and where it is possible to recover gracefully from the failed allocation.
116 SK_API SkCanvas* TryCreateBitmapCanvas(int width, int height, bool is_opaque); 116 SK_API SkCanvas* TryCreateBitmapCanvas(int width, int height, bool is_opaque);
117 117
118 // Returns true if native platform routines can be used to draw on the 118 // Returns true if native platform routines can be used to draw on the
119 // given canvas. If this function returns false, BeginPlatformPaint will 119 // given canvas. If this function returns false, BeginPlatformPaint will
120 // return NULL PlatformSurface. 120 // return NULL PlatformSurface.
121 SK_API bool SupportsPlatformPaint(const SkCanvas* canvas); 121 SK_API bool SupportsPlatformPaint(const SkCanvas* canvas);
122 122
123 // Returns true if native platform routines can be used to draw on the
alokp 2012/09/20 15:47:51 I am still not quite clear on the differences betw
reveman 2012/09/20 17:01:26 In the current implementation this means use of a
124 // given canvas without any indirect rendering taking place. Indirect
125 // rendering can be expensive so it's recommended to avoid using
126 // platform paint if possible when direct platform paint isn't supported.
127 // E.g. if there's a method to perform text rendering without platform
128 // paint then it's likely much more efficient to use that method in the
129 // case when this function returns false.
130 SK_API bool SupportsDirectPlatformPaint(const SkCanvas* canvas);
131
123 // Draws into the a native platform surface, |context|. Forwards to 132 // Draws into the a native platform surface, |context|. Forwards to
124 // DrawToNativeContext on a PlatformDevice instance bound to the top device. 133 // DrawToNativeContext on a PlatformDevice instance bound to the top device.
125 // If no PlatformDevice instance is bound, is a no-operation. 134 // If no PlatformDevice instance is bound, is a no-operation.
126 SK_API void DrawToNativeContext(SkCanvas* canvas, PlatformSurface context, 135 SK_API void DrawToNativeContext(SkCanvas* canvas, PlatformSurface context,
127 int x, int y, const PlatformRect* src_rect); 136 int x, int y, const PlatformRect* src_rect);
128 137
129 // Sets the opacity of each pixel in the specified region to be opaque. 138 // Sets the opacity of each pixel in the specified region to be opaque.
130 SK_API void MakeOpaque(SkCanvas* canvas, int x, int y, int width, int height); 139 SK_API void MakeOpaque(SkCanvas* canvas, int x, int y, int width, int height);
131 140
132 // These calls should surround calls to platform drawing routines, the 141 // These calls should surround calls to platform drawing routines, the
(...skipping 22 matching lines...) Expand all
155 PlatformSurface platform_surface_; 164 PlatformSurface platform_surface_;
156 165
157 // Disallow copy and assign 166 // Disallow copy and assign
158 ScopedPlatformPaint(const ScopedPlatformPaint&); 167 ScopedPlatformPaint(const ScopedPlatformPaint&);
159 ScopedPlatformPaint& operator=(const ScopedPlatformPaint&); 168 ScopedPlatformPaint& operator=(const ScopedPlatformPaint&);
160 }; 169 };
161 170
162 } // namespace skia 171 } // namespace skia
163 172
164 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ 173 #endif // SKIA_EXT_PLATFORM_CANVAS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698