Index: src/core/SkBitmapDevice.cpp |
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp |
index dcdc55bbfbe8bda27803d30996243a14bbd44ed4..4b25e21e862b138e237392c91fc1e78809b2e1ba 100644 |
--- a/src/core/SkBitmapDevice.cpp |
+++ b/src/core/SkBitmapDevice.cpp |
@@ -70,8 +70,10 @@ static bool valid_for_bitmap_device(const SkImageInfo& info, |
SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap) |
: INHERITED(SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType)) |
- , fBitmap(bitmap) { |
+ , fBitmap(bitmap) |
+{ |
SkASSERT(valid_for_bitmap_device(bitmap.info(), nullptr)); |
+ fBitmap.lockPixels(); |
} |
SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& info) { |
@@ -80,8 +82,10 @@ SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& info) { |
SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkSurfaceProps& surfaceProps) |
: INHERITED(surfaceProps) |
- , fBitmap(bitmap) { |
+ , fBitmap(bitmap) |
+{ |
SkASSERT(valid_for_bitmap_device(bitmap.info(), nullptr)); |
+ fBitmap.lockPixels(); |
} |
SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo, |
@@ -183,16 +187,6 @@ bool SkBitmapDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, s |
return fBitmap.readPixels(dstInfo, dstPixels, dstRowBytes, x, y); |
} |
-void SkBitmapDevice::onAttachToCanvas(SkCanvas* canvas) { |
- INHERITED::onAttachToCanvas(canvas); |
- fBitmap.lockPixels(); |
-} |
- |
-void SkBitmapDevice::onDetachFromCanvas() { |
- INHERITED::onDetachFromCanvas(); |
- fBitmap.unlockPixels(); |
-} |
- |
/////////////////////////////////////////////////////////////////////////////// |
void SkBitmapDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { |