SkPictureShader: floor scaledSize not to exceed maxTextureSize

scaledSize becomes larger than maxTextureSize by zoom level
because it is rounded.

BUG=chromium:485916

Review URL: https://codereview.chromium.org/1129413002
This commit is contained in:
gen.kim 2015-05-10 18:33:29 -07:00 committed by Commit bot
parent c19cdc254c
commit 88f12dbe92

View File

@ -178,8 +178,8 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatri
if (scaledSize.width() > maxTextureSize || scaledSize.height() > maxTextureSize) {
SkScalar downScale = SkScalarDiv(maxTextureSize,
SkMax32(scaledSize.width(), scaledSize.height()));
scaledSize.set(SkScalarMul(scaledSize.width(), downScale),
SkScalarMul(scaledSize.height(), downScale));
scaledSize.set(SkScalarFloorToScalar(SkScalarMul(scaledSize.width(), downScale)),
SkScalarFloorToScalar(SkScalarMul(scaledSize.height(), downScale)));
}
}
#endif