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>
This commit is contained in:
Brian Osman 2017-02-06 13:24:47 -05:00 committed by Skia Commit-Bot
parent 5e221e7ca2
commit d05cdc310c

View File

@ -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,