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

Unified Diff: skia/ext/platform_device_win.h

Issue 7633040: CL removing inheritance of SkDevice from PlatformDevice. Flavours of PlatformDevice classes now ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add mac changes. Created 9 years, 4 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_device_win.h
===================================================================
--- skia/ext/platform_device_win.h (revision 97282)
+++ skia/ext/platform_device_win.h (working copy)
@@ -21,12 +21,15 @@
// Initializes the default settings and colors in a device context.
SK_API void InitializeDC(HDC context);
-// A device is basically a wrapper around SkBitmap that provides a surface for
-// SkCanvas to draw into. Our device provides a surface Windows can also write
-// to. It also provides functionality to play well with GDI drawing functions.
-// This class is abstract and must be subclassed. It provides the basic
+// A SkDevice is basically a wrapper around SkBitmap that provides a surface for
+// SkCanvas to draw into. PlatformDevice provides a surface Windows can also
+// write to. It also provides functionality to play well with GDI drawing
+// functions. This class is abstract and must be subclassed. It provides the basic
// interface to implement it either with or without a bitmap backend.
-class SK_API PlatformDevice : public SkDevice {
+//
+// PlatformDevice provides an interface which sub-classes of SkDevice can also
+// provide to allow for drawing by the native platform into the device.
+class SK_API PlatformDevice {
public:
typedef HDC PlatformSurface;
@@ -57,6 +60,9 @@
// Used by the printing subclasses. See |VectorPlatformDeviceEmf|.
virtual bool AlphaBlendUsed() const { return false; }
+ // Return the SkDevice instance which is associated with this PlatformDevice.
+ SkDevice* GetOwningDevice() const { return device_; }
+
// Loads a SkPath into the GDI context. The path can there after be used for
// clipping or as a stroke. Returns false if the path failed to be loaded.
static bool LoadPathToDC(HDC context, const SkPath& path);
@@ -73,8 +79,7 @@
typedef std::vector<CubicPoints> CubicPath;
typedef std::vector<CubicPath> CubicPaths;
- // Forwards |bitmap| to SkDevice's constructor.
- PlatformDevice(const SkBitmap& bitmap);
+ explicit PlatformDevice(SkDevice* device);
// Loads the specified Skia transform into the device context, excluding
// perspective (which GDI doesn't support).
@@ -82,9 +87,11 @@
// Transforms SkPath's paths into a series of cubic path.
static bool SkPathToCubicPaths(CubicPaths* paths, const SkPath& skpath);
+
+ // The device to which the PlatformDevice interface is bound.
+ SkDevice* device_;
};
} // namespace skia
#endif // SKIA_EXT_PLATFORM_DEVICE_WIN_H_
-

Powered by Google App Engine
This is Rietveld 408576698