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

Unified Diff: include/core/SkDevice.h

Issue 2261003003: store info in basedevice, change getter to non-virtual const& (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
« no previous file with comments | « include/core/SkBitmapDevice.h ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkDevice.h
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 76549ca5d0e1c1b6ca3d750e84fd0fd4a273e437..44b8791386ff8fde00cfe26cf0bd440bf9bd18ee 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -30,7 +30,7 @@ public:
/**
* Construct a new device.
*/
- explicit SkBaseDevice(const SkSurfaceProps&);
+ explicit SkBaseDevice(const SkImageInfo&, const SkSurfaceProps&);
virtual ~SkBaseDevice();
SkMetaData& getMetaData();
@@ -39,7 +39,7 @@ public:
* Return ImageInfo for this device. If the canvas is not backed by pixels
* (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType.
*/
- virtual SkImageInfo imageInfo() const;
+ const SkImageInfo& imageInfo() const { return fInfo; }
/**
* Return SurfaceProps for this device.
@@ -371,9 +371,15 @@ private:
virtual SkImageFilterCache* getImageFilterCache() { return NULL; }
+ friend class SkBitmapDevice;
+ void privateResize(int w, int h) {
+ *const_cast<SkImageInfo*>(&fInfo) = fInfo.makeWH(w, h);
bsalomon 2016/08/20 14:57:29 why not just make it non-const? Also, there's a wh
+ }
+
SkIPoint fOrigin;
SkMetaData* fMetaData;
- SkSurfaceProps fSurfaceProps;
+ const SkImageInfo fInfo;
+ const SkSurfaceProps fSurfaceProps;
#ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP
SkBitmap fLegacyBitmap;
« no previous file with comments | « include/core/SkBitmapDevice.h ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698