diff options
author | 2013-03-04 13:56:38 +0000 | |
---|---|---|
committer | 2013-03-04 13:56:38 +0000 | |
commit | c490f801b063a0837501feab3d12b73d71f46312 (patch) | |
tree | ffd4472adf43e7f9536018fdb03f253325baf858 /src | |
parent | bb963e2585efb9690906b5963fcf516ddfb1d432 (diff) |
Change random number generator for 'tests' to SkMWCRandom. Also removes some
unused headers and fixes a couple of bugs exposed by changing the random
number generator:
First, the function SkMatrix::getMaxStretch() had an error where it was testing
the square of a number against near-zero. This led to it occasionally taking a
cheaper but imprecise path for computing the eigenvalues of the matrix. It's
been replaced with a check against the square of SK_ScalarNearlyZero.
The second case was a failure in ClipStackTest, where it hit the rare case of
a practically empty clip stack (it has a single Union) and we set a tight
bounds. The bounds rect doesn't get set by GrReducedClip::ReduceClipStack() in
this case, so when it clips the reduced stack it's clipping against garbage,
and the resulting regions don't match. The solution is to initialize the
tightBounds rect.
git-svn-id: http://skia.googlecode.com/svn/trunk@7952 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkFloat.cpp | 2 | ||||
-rw-r--r-- | src/core/SkGraphics.cpp | 1 | ||||
-rw-r--r-- | src/core/SkMatrix.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrRedBlackTree.h | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLEffectMatrix.h | 1 |
5 files changed, 3 insertions, 5 deletions
diff --git a/src/core/SkFloat.cpp b/src/core/SkFloat.cpp index b5cc4f18e7..721d8ec53e 100644 --- a/src/core/SkFloat.cpp +++ b/src/core/SkFloat.cpp @@ -291,7 +291,7 @@ void SkFloat::UnitTest() d.setAdd(c, b); SkDebugf("SkFloat: %d + %d = %d\n", c.getInt(), b.getInt(), d.getInt()); - SkRandom rand; + SkMWCRandom rand; int i; for (i = 0; i < 1000; i++) diff --git a/src/core/SkGraphics.cpp b/src/core/SkGraphics.cpp index 873d5466da..8e7c7cd31d 100644 --- a/src/core/SkGraphics.cpp +++ b/src/core/SkGraphics.cpp @@ -19,7 +19,6 @@ #include "SkPath.h" #include "SkPathEffect.h" #include "SkPixelRef.h" -#include "SkRandom.h" #include "SkRefCnt.h" #include "SkRTConf.h" #include "SkScalerContext.h" diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp index d420dd3b92..d9675f3979 100644 --- a/src/core/SkMatrix.cpp +++ b/src/core/SkMatrix.cpp @@ -1808,7 +1808,7 @@ SkScalar SkMatrix::getMaxStretch() const { SkScalar largerRoot; SkScalar bSqd = SkScalarMul(b,b); // if upper left 2x2 is orthogonal save some math - if (bSqd <= SK_ScalarNearlyZero) { + if (bSqd <= SK_ScalarNearlyZero*SK_ScalarNearlyZero) { largerRoot = SkMaxScalar(a, c); } else { SkScalar aminusc = a - c; diff --git a/src/gpu/GrRedBlackTree.h b/src/gpu/GrRedBlackTree.h index 2ccf77fb50..ba03be2950 100644 --- a/src/gpu/GrRedBlackTree.h +++ b/src/gpu/GrRedBlackTree.h @@ -950,7 +950,7 @@ void GrRedBlackTree<T,C>::UnitTest() { GrRedBlackTree<int> tree; typedef GrRedBlackTree<int>::Iter iter; - SkRandom r; + SkMWCRandom r; int count[100] = {0}; // add 10K ints diff --git a/src/gpu/gl/GrGLEffectMatrix.h b/src/gpu/gl/GrGLEffectMatrix.h index 49ddceb129..1a11656534 100644 --- a/src/gpu/gl/GrGLEffectMatrix.h +++ b/src/gpu/gl/GrGLEffectMatrix.h @@ -12,7 +12,6 @@ #include "SkMatrix.h" class GrTexture; -class SkRandom; /** * This is a helper to implement a texture matrix in a GrGLEffect. |