Bug 1207958 - Fix heuristic for choosing which ICO sub-image to render - r=tn

This commit is contained in:
Edwin Flores 2016-01-20 11:00:12 +00:00
parent eb839af130
commit 34402636fb

View File

@ -235,8 +235,8 @@ nsICODecoder::ReadDirEntry(const char* aData)
// choose the smallest resource that is >= the target size (i.e. we assume
// it's better to downscale a larger icon than to upscale a smaller one).
IntSize desiredSize = mDownscaler->TargetSize();
int32_t delta = entrySize.width - desiredSize.width +
entrySize.height - desiredSize.height;
int32_t delta = std::min(entrySize.width - desiredSize.width,
entrySize.height - desiredSize.height);
if (e.mBitCount >= mBestResourceColorDepth &&
((mBestResourceDelta < 0 && delta >= mBestResourceDelta) ||
(delta >= 0 && delta <= mBestResourceDelta))) {