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

Unified Diff: src/core/SkBitmapDevice.cpp

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
Index: src/core/SkBitmapDevice.cpp
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 41416e733b6b92dfdd1b7e938238da2d50f7acd7..75eaa963b59e74910c2704133d0981805078fccf 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -69,7 +69,7 @@ static bool valid_for_bitmap_device(const SkImageInfo& info,
}
SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap)
- : INHERITED(SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType))
+ : INHERITED(bitmap.info(), SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType))
, fBitmap(bitmap)
{
SkASSERT(valid_for_bitmap_device(bitmap.info(), nullptr));
@@ -81,7 +81,7 @@ SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& info) {
}
SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkSurfaceProps& surfaceProps)
- : INHERITED(surfaceProps)
+ : INHERITED(bitmap.info(), surfaceProps)
, fBitmap(bitmap)
{
SkASSERT(valid_for_bitmap_device(bitmap.info(), nullptr));
@@ -120,13 +120,10 @@ SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo,
return new SkBitmapDevice(bitmap, surfaceProps);
}
-SkImageInfo SkBitmapDevice::imageInfo() const {
- return fBitmap.info();
-}
-
void SkBitmapDevice::setNewSize(const SkISize& size) {
SkASSERT(!fBitmap.pixelRef());
fBitmap.setInfo(fBitmap.info().makeWH(size.fWidth, size.fHeight));
+ this->privateResize(fBitmap.info().width(), fBitmap.info().height());
}
void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) {
@@ -134,6 +131,7 @@ void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) {
SkASSERT(bm.height() == fBitmap.height());
fBitmap = bm; // intent is to use bm's pixelRef (and rowbytes/config)
fBitmap.lockPixels();
+ this->privateResize(fBitmap.info().width(), fBitmap.info().height());
}
SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint*) {
« include/core/SkDevice.h ('K') | « include/core/SkDevice.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698