Index: src/core/SkBitmapDevice.cpp |
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp |
index 3e586e66305abb2541733cd71b36390413be2b0f..2a805cbf02bd1e77b081fd14d2e0a5f0f324924f 100644 |
--- a/src/core/SkBitmapDevice.cpp |
+++ b/src/core/SkBitmapDevice.cpp |
@@ -126,6 +126,10 @@ const SkBitmap& SkBitmapDevice::onAccessBitmap() { |
} |
bool SkBitmapDevice::onAccessPixels(SkPixmap* pmap) { |
+ return fBitmap.lockPixelsAreWritable() && this->onPeekPixels(pmap); |
+} |
+ |
+bool SkBitmapDevice::onPeekPixels(SkPixmap* pmap) { |
const SkImageInfo info = fBitmap.info(); |
if (fBitmap.getPixels() && (kUnknown_SkColorType != info.colorType())) { |
SkColorTable* ctable = NULL; |
@@ -135,11 +139,6 @@ bool SkBitmapDevice::onAccessPixels(SkPixmap* pmap) { |
return false; |
} |
-bool SkBitmapDevice::onPeekPixels(SkPixmap* pmap) { |
- // peek and access are the exact same logic for us |
- return this->onAccessPixels(pmap); |
-} |
- |
bool SkBitmapDevice::onWritePixels(const SkImageInfo& srcInfo, const void* srcPixels, |
size_t srcRowBytes, int x, int y) { |
// since we don't stop creating un-pixeled devices yet, check for no pixels here |
@@ -352,8 +351,7 @@ void SkBitmapDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode |
void SkBitmapDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device, |
int x, int y, const SkPaint& paint) { |
- const SkBitmap& src = device->accessBitmap(false); |
- draw.drawSprite(src, x, y, paint); |
+ draw.drawSprite(static_cast<SkBitmapDevice*>(device)->fBitmap, x, y, paint); |
} |
SkSurface* SkBitmapDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps& props) { |