Index: src/gpu/SkGpuDevice.cpp |
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp |
index 4af16109a4b6df1481c65ce98306277f732ce5ca..60b4e7c40db9254a9d571562db1b03bf32453a88 100644 |
--- a/src/gpu/SkGpuDevice.cpp |
+++ b/src/gpu/SkGpuDevice.cpp |
@@ -1289,6 +1289,11 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap, |
SkCanvas::DrawBitmapRectFlags flags, |
int tileSize, |
bool bicubic) { |
+ // The following pixel lock is technically redundant, but it is desirable |
+ // to lock outside of the tile loop to prevent redecoding the whole image |
+ // at each tile in cases where 'bitmap' holds an SkDiscardablePixelRef that |
+ // is larger than the limit of the discardable memory pool. |
+ SkAutoLockPixels alp(bitmap); |
SkRect clippedSrcRect = SkRect::Make(clippedSrcIRect); |
int nx = bitmap.width() / tileSize; |