summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-01 21:23:19 +0000
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-01 21:23:19 +0000
commit573696202934fb9fdb3cdcf13770ea01c3d3f077 (patch)
tree89463ee17e9213ea9aec777eb135e79536568d89
parent75da1aa081a9a6e140716e13a5c5e0f486d6e4cf (diff)
downloadsrc-573696202934fb9fdb3cdcf13770ea01c3d3f077.tar.gz
Fix image decode thrashing when drawing a very large source image to a GPU canvas
R=bsalomon@google.com Author: junov@chromium.org Review URL: https://codereview.chromium.org/265763005 git-svn-id: http://skia.googlecode.com/svn/trunk/src@14522 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gpu/SkGpuDevice.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/gpu/SkGpuDevice.cpp b/gpu/SkGpuDevice.cpp
index 4af16109..60b4e7c4 100644
--- a/gpu/SkGpuDevice.cpp
+++ b/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;