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

Unified Diff: skia/ext/platform_canvas.h

Issue 10093006: Fix win32 error checking in platform_canvas_skia.cc by moving code into ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: skia/ext/platform_canvas.h
diff --git a/skia/ext/platform_canvas.h b/skia/ext/platform_canvas.h
index 87e2bd274d9e90d29dcbf861bc58cb991b085774..3ca3d0456586f3fab27d7813c2cf3d543bbe0617 100644
--- a/skia/ext/platform_canvas.h
+++ b/skia/ext/platform_canvas.h
@@ -13,6 +13,12 @@
namespace skia {
+#if defined(WIN32)
+typedef HANDLE PlatformData;
+#else
Alexei Svitkine (slow) 2012/04/16 19:01:44 Shouldn't you have this: #elif defined(__APPLE__)
+typedef uint8_t* PlatformData;
+#endif
+
// This class is a specialization of the regular SkCanvas that is designed to
// work with a PlatformDevice to manage platform-specific drawing. It allows
// using both Skia operations and platform-specific operations.
@@ -24,40 +30,24 @@ class SK_API PlatformCanvas : public SkCanvas {
// transparency: this will enable some optimizations.
PlatformCanvas(int width, int height, bool is_opaque);
-#if defined(WIN32)
- // The shared_section parameter is passed to gfx::PlatformDevice::create.
- // See it for details.
- PlatformCanvas(int width, int height, bool is_opaque, HANDLE shared_section);
-#elif defined(__APPLE__)
- PlatformCanvas(int width, int height, bool is_opaque,
- CGContextRef context);
- PlatformCanvas(int width, int height, bool is_opaque, uint8_t* context);
-#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.
- PlatformCanvas(int width, int height, bool is_opaque, uint8_t* data);
+ // Construct a canvas from the given platform specific data. The data is
+ // not cleared first. @data must be, at least,
+ // @height * StrideForWidth(@width) bytes.
Alexei Svitkine (slow) 2012/04/16 19:01:44 Nit: Use pairs of |'s instead of @'s for param nam
+ PlatformCanvas(int width, int height, bool is_opaque, PlatformData data);
+
+#if defined(__APPLE__)
+ PlatformCanvas(int width, int height, bool is_opaque, CGContextRef context);
#endif
virtual ~PlatformCanvas();
-#if defined(WIN32)
- // For two-part init, call if you use the no-argument constructor above. Note
- // that we want this to optionally match the Linux initialize if you only
- // pass 3 arguments, hence the evil default argument.
- bool initialize(int width, int height, bool is_opaque,
- HANDLE shared_section = NULL);
-#elif defined(__APPLE__)
// For two-part init, call if you use the no-argument constructor above
- bool initialize(CGContextRef context, int width, int height, bool is_opaque);
- bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL);
+ bool initialize(int width, int height, bool is_opaque,
+ PlatformData data = NULL);
-#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
- defined(__sun) || defined(ANDROID)
+#if defined(__APPLE__)
// For two-part init, call if you use the no-argument constructor above
- bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL);
+ bool initialize(CGContextRef context, int width, int height, bool is_opaque);
#endif
// Shared --------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698