aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-08-20 07:59:19 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-20 07:59:19 -0700
commit589a39eb81d25fa7af95e7366db17ac7a70a7d03 (patch)
treef1f485df0476ca0af26475c924d35101b9160b6b /include/core
parente2348ccb477b97847cd147161a57fbbbfc8bba10 (diff)
store info in basedevice, change getter to non-virtual const&
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkBitmapDevice.h2
-rw-r--r--include/core/SkDevice.h12
2 files changed, 9 insertions, 5 deletions
diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h
index bb6d6ec1e8..31c0aa3a35 100644
--- a/include/core/SkBitmapDevice.h
+++ b/include/core/SkBitmapDevice.h
@@ -58,8 +58,6 @@ public:
static SkBitmapDevice* Create(const SkImageInfo&, const SkSurfaceProps&);
- SkImageInfo imageInfo() const override;
-
protected:
bool onShouldDisableLCD(const SkPaint&) const override;
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 76549ca5d0..44b8791386 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);
+ }
+
SkIPoint fOrigin;
SkMetaData* fMetaData;
- SkSurfaceProps fSurfaceProps;
+ const SkImageInfo fInfo;
+ const SkSurfaceProps fSurfaceProps;
#ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP
SkBitmap fLegacyBitmap;