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

Unified Diff: skia/ext/platform_canvas.h

Issue 2509983004: Revert "Change call-sites now that SkCanvas is not ref-counted" (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/ext/bitmap_platform_device_win.cc ('k') | skia/ext/platform_canvas.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/platform_canvas.h
diff --git a/skia/ext/platform_canvas.h b/skia/ext/platform_canvas.h
index 04a4d177ab968a479066f3ee9ccea13576cd952a..c71c0dc702a023258cbb22bd6b23dfb18fddd628 100644
--- a/skia/ext/platform_canvas.h
+++ b/skia/ext/platform_canvas.h
@@ -45,68 +45,64 @@ enum OnFailureType {
#if defined(WIN32)
// The shared_section parameter is passed to gfx::PlatformDevice::create.
// See it for details.
-SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvas(
- int width,
- int height,
- bool is_opaque,
- HANDLE shared_section,
- OnFailureType failure_type);
-
-// Draws the top layer of the canvas into the specified HDC. Only works
-// with a SkCanvas with a BitmapPlatformDevice. Will create a temporary
-// HDC to back the canvas if one doesn't already exist, tearing it down
-// before returning. If |src_rect| is null, copies the entire canvas.
-SK_API void DrawToNativeContext(SkCanvas* canvas,
- HDC hdc,
- int x,
- int y,
- const RECT* src_rect);
+ SK_API SkCanvas* CreatePlatformCanvas(int width,
+ int height,
+ bool is_opaque,
+ HANDLE shared_section,
+ OnFailureType failure_type);
+
+ // Draws the top layer of the canvas into the specified HDC. Only works
+ // with a SkCanvas with a BitmapPlatformDevice. Will create a temporary
+ // HDC to back the canvas if one doesn't already exist, tearing it down
+ // before returning. If |src_rect| is null, copies the entire canvas.
+ SK_API void DrawToNativeContext(SkCanvas* canvas,
+ HDC hdc,
+ int x,
+ int y,
+ const RECT* src_rect);
#elif defined(__APPLE__)
-SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvas(
- CGContextRef context,
- int width,
- int height,
- bool is_opaque,
- OnFailureType failure_type);
-
-SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvas(
- int width,
- int height,
- bool is_opaque,
- uint8_t* context,
- OnFailureType failure_type);
+ SK_API SkCanvas* CreatePlatformCanvas(CGContextRef context,
+ int width,
+ int height,
+ bool is_opaque,
+ OnFailureType failure_type);
+
+ SK_API SkCanvas* CreatePlatformCanvas(int width,
+ int height,
+ bool is_opaque,
+ uint8_t* context,
+ OnFailureType failure_type);
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
defined(__sun) || defined(ANDROID)
// Linux ---------------------------------------------------------------------
// Construct a canvas from the given memory region. The memory is not cleared
// first. @data must be, at least, @height * StrideForWidth(@width) bytes.
-SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvas(
- int width,
- int height,
- bool is_opaque,
- uint8_t* data,
- OnFailureType failure_type);
+ SK_API SkCanvas* CreatePlatformCanvas(int width,
+ int height,
+ bool is_opaque,
+ uint8_t* data,
+ OnFailureType failure_type);
#endif
-static inline std::unique_ptr<SkCanvas> CreatePlatformCanvas(int width,
- int height,
- bool is_opaque) {
+static inline SkCanvas* CreatePlatformCanvas(int width,
+ int height,
+ bool is_opaque) {
return CreatePlatformCanvas(width, height, is_opaque, 0, CRASH_ON_FAILURE);
}
-SK_API std::unique_ptr<SkCanvas> CreateCanvas(const sk_sp<SkBaseDevice>& device,
- OnFailureType failure_type);
+SK_API SkCanvas* CreateCanvas(const sk_sp<SkBaseDevice>& device,
+ OnFailureType failure_type);
-static inline std::unique_ptr<SkCanvas> CreateBitmapCanvas(int width,
- int height,
- bool is_opaque) {
+static inline SkCanvas* CreateBitmapCanvas(int width,
+ int height,
+ bool is_opaque) {
return CreatePlatformCanvas(width, height, is_opaque, 0, CRASH_ON_FAILURE);
}
-static inline std::unique_ptr<SkCanvas> TryCreateBitmapCanvas(int width,
- int height,
- bool is_opaque) {
+static inline SkCanvas* TryCreateBitmapCanvas(int width,
+ int height,
+ bool is_opaque) {
return CreatePlatformCanvas(width, height, is_opaque, 0,
RETURN_NULL_ON_FAILURE);
}
« no previous file with comments | « skia/ext/bitmap_platform_device_win.cc ('k') | skia/ext/platform_canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698