Fix mipScale issue in GrSmallPathRenderer
Bug: skia:11840
Change-Id: Ief89855554e4ed21da20a2fdef4945294cf46498
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/393416
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index 642a9c7..982fe24 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -292,7 +292,9 @@
SkScalar log = SkScalarCeilToScalar(SkScalarLog2(maxScale));
mipScale = SkScalarPow(2, log);
}
- SkASSERT(maxScale <= mipScale);
+ // Log2 isn't very precise at values close to a power of 2,
+ // so add a little tolerance here. A little bit of scaling up is fine.
+ SkASSERT(maxScale <= mipScale + SK_ScalarNearlyZero);
SkScalar mipSize = mipScale*SkScalarAbs(maxDim);
// For sizes less than kIdealMinMIP we want to use as large a distance field as we can