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
diff --git a/src/core/SkFloat.cpp b/src/core/SkFloat.cpp
index b5cc4f1..721d8ec 100644
--- a/src/core/SkFloat.cpp
+++ b/src/core/SkFloat.cpp
@@ -291,7 +291,7 @@
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 873d546..8e7c7cd 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 d420dd3..d9675f3 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -1808,7 +1808,7 @@
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 2ccf77f..ba03be2 100644
--- a/src/gpu/GrRedBlackTree.h
+++ b/src/gpu/GrRedBlackTree.h
@@ -950,7 +950,7 @@
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 49ddceb..1a11656 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.