aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-02-06 13:24:47 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-06 19:03:36 +0000
commitd05cdc310c1ff1183a3c350e02ff603a4e97c02e (patch)
tree1b1799a42825b95090166d089c8a508fa84b4ac4 /src/gpu
parent5e221e7ca26130393a0527bb9b5155d6685b74ba (diff)
Fix two bugs when deciding to tile. Large images were always tiling.
usedTileBytes was actually usedTileTexels, so we underestimated how much of the image we were using by a factor of 4. Then, to determine if we were using more than 50% of the image, we wrote: usedTileBytes < 2 * bmpSize; That meant we were off by another factor of 4. BUG=skia: Change-Id: Iba2acc75c5e7603543f05e4473b73f76a2937d7a Reviewed-on: https://skia-review.googlesource.com/8063 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/SkGpuDevice.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 4068c2b102..6f8bad9d76 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -810,9 +810,10 @@ bool SkGpuDevice::shouldTileImageID(uint32_t imageID, const SkIRect& imageRect,
clippedSubset);
*tileSize = kBmpSmallTileSize; // already know whole bitmap fits in one max sized tile.
size_t usedTileBytes = get_tile_count(*clippedSubset, kBmpSmallTileSize) *
- kBmpSmallTileSize * kBmpSmallTileSize;
+ kBmpSmallTileSize * kBmpSmallTileSize *
+ sizeof(SkPMColor); // assume 32bit pixels;
- return usedTileBytes < 2 * bmpSize;
+ return usedTileBytes * 2 < bmpSize;
}
bool SkGpuDevice::shouldTileImage(const SkImage* image, const SkRect* srcRectPtr,