temporary avoid zero-divide (to avoid assert in fixedpoint build)
authorreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 5 Jun 2012 17:39:22 +0000 (17:39 +0000)
committerreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 5 Jun 2012 17:39:22 +0000 (17:39 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@4166 2bbb7eff-a529-9590-31e7-b0007b416f81

src/effects/SkGradientShader.cpp

index 9945ca1..1ef6446 100644 (file)
@@ -2023,7 +2023,8 @@ private:
     void init() {
         fDiff = fCenter1 - fCenter2;
         fDiffRadius = fRadius2 - fRadius1;
-        SkScalar inv = SkScalarInvert(fDiffRadius);
+        // hack to avoid zero-divide for now
+        SkScalar inv = fDiffRadius ? SkScalarInvert(fDiffRadius) : 0;
         fDiff.fX = SkScalarMul(fDiff.fX, inv);
         fDiff.fY = SkScalarMul(fDiff.fY, inv);
         fStartRadius = SkScalarMul(fRadius1, inv);