Fix floating point data loss in SkPictureShader

SkPictureShader had an invalid use of SkMax32 on two SkScalars which
ended up converting the result to an integer which caused us to lose
necessary floating point data.

BUG=473166

Review URL: https://codereview.chromium.org/1401743004
This commit is contained in:
ericrk 2015-10-14 17:33:29 -07:00 committed by Commit bot
parent 67e676087c
commit f469fc0e0f

View File

@ -190,7 +190,7 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& viewMatrix, const SkM
// Scale down the tile size if larger than maxTextureSize for GPU Path or it should fail on create texture
if (maxTextureSize) {
if (scaledSize.width() > maxTextureSize || scaledSize.height() > maxTextureSize) {
SkScalar downScale = maxTextureSize / SkMax32(scaledSize.width(), scaledSize.height());
SkScalar downScale = maxTextureSize / SkMaxScalar(scaledSize.width(), scaledSize.height());
scaledSize.set(SkScalarFloorToScalar(SkScalarMul(scaledSize.width(), downScale)),
SkScalarFloorToScalar(SkScalarMul(scaledSize.height(), downScale)));
}