Index: src/core/SkPictureShader.cpp |
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp |
index 2c835ed93ecbb5122a89e726d5623da43bfa92f6..c1c47550586cb1005290a98a1c0e8f74b4eab7e6 100644 |
--- a/src/core/SkPictureShader.cpp |
+++ b/src/core/SkPictureShader.cpp |
@@ -168,7 +168,7 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatri |
static const SkScalar kMaxTileArea = 2048 * 2048; |
SkScalar tileArea = SkScalarMul(scaledSize.width(), scaledSize.height()); |
if (tileArea > kMaxTileArea) { |
- SkScalar clampScale = SkScalarSqrt(SkScalarDiv(kMaxTileArea, tileArea)); |
+ SkScalar clampScale = SkScalarSqrt(kMaxTileArea / tileArea); |
scaledSize.set(SkScalarMul(scaledSize.width(), clampScale), |
SkScalarMul(scaledSize.height(), clampScale)); |
} |
@@ -176,8 +176,7 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatri |
// 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 = SkScalarDiv(maxTextureSize, |
- SkMax32(scaledSize.width(), scaledSize.height())); |
+ SkScalar downScale = maxTextureSize / SkMax32(scaledSize.width(), scaledSize.height()); |
scaledSize.set(SkScalarFloorToScalar(SkScalarMul(scaledSize.width(), downScale)), |
SkScalarFloorToScalar(SkScalarMul(scaledSize.height(), downScale))); |
} |