Change old PRG to be SkLCGRandom; change new one to SkRandom
The goal here is to get people to start using the new random number
generator, while leaving the old one in place so we don't have to
rebaseline GMs.
R=reed@google.com, bsalomon@google.com
Author: jvanverth@google.com
Review URL: https://chromiumcodereview.appspot.com/23576015
git-svn-id: http://skia.googlecode.com/svn/trunk@11169 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkFloat.cpp b/src/core/SkFloat.cpp
index 721d8ec..b5cc4f1 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());
- SkMWCRandom rand;
+ SkRandom rand;
int i;
for (i = 0; i < 1000; i++)
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index 1efd9ef..ac5cee4 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -1359,7 +1359,7 @@
};
GR_DEFINE_EFFECT_TEST(XferEffect);
-GrEffectRef* XferEffect::TestCreate(SkMWCRandom* rand,
+GrEffectRef* XferEffect::TestCreate(SkRandom* rand,
GrContext*,
const GrDrawTargetCaps&,
GrTexture*[]) {
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp
index fd81d82..fd3a683 100644
--- a/src/effects/SkArithmeticMode.cpp
+++ b/src/effects/SkArithmeticMode.cpp
@@ -415,7 +415,7 @@
return bgKey;
}
-GrEffectRef* GrArithmeticEffect::TestCreate(SkMWCRandom* rand,
+GrEffectRef* GrArithmeticEffect::TestCreate(SkRandom* rand,
GrContext*,
const GrDrawTargetCaps&,
GrTexture*[]) {
diff --git a/src/effects/SkBitmapAlphaThresholdShader.cpp b/src/effects/SkBitmapAlphaThresholdShader.cpp
index 0df3aec..84cdbf2 100644
--- a/src/effects/SkBitmapAlphaThresholdShader.cpp
+++ b/src/effects/SkBitmapAlphaThresholdShader.cpp
@@ -235,7 +235,7 @@
GR_DEFINE_EFFECT_TEST(ThresholdEffect);
-GrEffectRef* ThresholdEffect::TestCreate(SkMWCRandom* rand,
+GrEffectRef* ThresholdEffect::TestCreate(SkRandom* rand,
GrContext*,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp
index fa4ad5e..1f841d0 100644
--- a/src/effects/SkColorMatrixFilter.cpp
+++ b/src/effects/SkColorMatrixFilter.cpp
@@ -461,7 +461,7 @@
GR_DEFINE_EFFECT_TEST(ColorMatrixEffect);
-GrEffectRef* ColorMatrixEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* ColorMatrixEffect::TestCreate(SkRandom* random,
GrContext*,
const GrDrawTargetCaps&,
GrTexture* dummyTextures[2]) {
diff --git a/src/effects/SkDiscretePathEffect.cpp b/src/effects/SkDiscretePathEffect.cpp
index 2c95208..eece2ef 100644
--- a/src/effects/SkDiscretePathEffect.cpp
+++ b/src/effects/SkDiscretePathEffect.cpp
@@ -31,7 +31,7 @@
SkPathMeasure meas(src, doFill);
uint32_t seed = SkScalarRound(meas.getLength());
- SkRandom rand(seed ^ ((seed << 16) | (seed >> 16)));
+ SkLCGRandom rand(seed ^ ((seed << 16) | (seed >> 16)));
SkScalar scale = fPerterb;
SkPoint p;
SkVector v;
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index a0764ed..a751365 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -366,7 +366,7 @@
GR_DEFINE_EFFECT_TEST(GrDisplacementMapEffect);
-GrEffectRef* GrDisplacementMapEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrDisplacementMapEffect::TestCreate(SkRandom* random,
GrContext*,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 999b8f8..ecf9913 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -1026,13 +1026,13 @@
#if SK_SUPPORT_GPU
namespace {
-SkPoint3 random_point3(SkMWCRandom* random) {
+SkPoint3 random_point3(SkRandom* random) {
return SkPoint3(SkScalarToFloat(random->nextSScalar1()),
SkScalarToFloat(random->nextSScalar1()),
SkScalarToFloat(random->nextSScalar1()));
}
-SkLight* create_random_light(SkMWCRandom* random) {
+SkLight* create_random_light(SkRandom* random) {
int type = random->nextULessThan(3);
switch (type) {
case 0: {
@@ -1168,7 +1168,7 @@
GR_DEFINE_EFFECT_TEST(GrDiffuseLightingEffect);
-GrEffectRef* GrDiffuseLightingEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrDiffuseLightingEffect::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
@@ -1386,7 +1386,7 @@
GR_DEFINE_EFFECT_TEST(GrSpecularLightingEffect);
-GrEffectRef* GrSpecularLightingEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrSpecularLightingEffect::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index 24aef28..c74b067 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -196,7 +196,7 @@
GR_DEFINE_EFFECT_TEST(GrMagnifierEffect);
-GrEffectRef* GrMagnifierEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrMagnifierEffect::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture** textures) {
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 03b2896..9446b8e 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -530,7 +530,7 @@
// Allows for a 5x5 kernel (or 25x1, for that matter).
#define MAX_KERNEL_SIZE 25
-GrEffectRef* GrMatrixConvolutionEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrMatrixConvolutionEffect::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 331bbd7..83157be 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -427,7 +427,7 @@
GR_DEFINE_EFFECT_TEST(GrMorphologyEffect);
-GrEffectRef* GrMorphologyEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrMorphologyEffect::TestCreate(SkRandom* random,
GrContext*,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index b34afe7..de418c3 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -712,7 +712,7 @@
/////////////////////////////////////////////////////////////////////
GR_DEFINE_EFFECT_TEST(GrPerlinNoiseEffect);
-GrEffectRef* GrPerlinNoiseEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrPerlinNoiseEffect::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture**) {
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index bb72b82..f6088f5 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -375,7 +375,7 @@
GR_DEFINE_EFFECT_TEST(ColorTableEffect);
-GrEffectRef* ColorTableEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* ColorTableEffect::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index f1b5e58..8bbdc21 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -1127,7 +1127,7 @@
}
}
-int GrGradientEffect::RandomGradientParams(SkMWCRandom* random,
+int GrGradientEffect::RandomGradientParams(SkRandom* random,
SkColor colors[],
SkScalar** stops,
SkShader::TileMode* tm) {
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index 451bd2d..f7a4189 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -282,7 +282,7 @@
passed to the gradient factory rather than the array.
*/
static const int kMaxRandomGradientColors = 4;
- static int RandomGradientParams(SkMWCRandom* r,
+ static int RandomGradientParams(SkRandom* r,
SkColor colors[kMaxRandomGradientColors],
SkScalar** stops,
SkShader::TileMode* tm);
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index 0b2854e..aa8486d 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -496,7 +496,7 @@
GR_DEFINE_EFFECT_TEST(GrLinearGradient);
-GrEffectRef* GrLinearGradient::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrLinearGradient::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture**) {
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index 9f32303..923d31f 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -531,7 +531,7 @@
GR_DEFINE_EFFECT_TEST(GrRadialGradient);
-GrEffectRef* GrRadialGradient::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrRadialGradient::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture**) {
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index 350b20a..669acd2 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -447,7 +447,7 @@
GR_DEFINE_EFFECT_TEST(GrSweepGradient);
-GrEffectRef* GrSweepGradient::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrSweepGradient::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture**) {
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp
index 9a23071..6315565 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp
@@ -440,7 +440,7 @@
GR_DEFINE_EFFECT_TEST(GrConical2Gradient);
-GrEffectRef* GrConical2Gradient::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrConical2Gradient::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture**) {
diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp
index b4b8402..e3f5e9f 100644
--- a/src/effects/gradients/SkTwoPointRadialGradient.cpp
+++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp
@@ -483,7 +483,7 @@
GR_DEFINE_EFFECT_TEST(GrRadial2Gradient);
-GrEffectRef* GrRadial2Gradient::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrRadial2Gradient::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture**) {
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 5ecc4e2..8fa9499 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -593,7 +593,7 @@
GR_DEFINE_EFFECT_TEST(QuadEdgeEffect);
-GrEffectRef* QuadEdgeEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* QuadEdgeEffect::TestCreate(SkRandom* random,
GrContext*,
const GrDrawTargetCaps& caps,
GrTexture*[]) {
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index 8d5851f..76a5c8c 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -117,7 +117,7 @@
GR_DEFINE_EFFECT_TEST(GrAlignedRectEffect);
-GrEffectRef* GrAlignedRectEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrAlignedRectEffect::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
@@ -256,7 +256,7 @@
GR_DEFINE_EFFECT_TEST(GrRectEffect);
-GrEffectRef* GrRectEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrRectEffect::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
diff --git a/src/gpu/GrEffect.cpp b/src/gpu/GrEffect.cpp
index f14c171..dc83f7b 100644
--- a/src/gpu/GrEffect.cpp
+++ b/src/gpu/GrEffect.cpp
@@ -21,7 +21,7 @@
#endif
namespace GrEffectUnitTest {
-const SkMatrix& TestMatrix(SkMWCRandom* random) {
+const SkMatrix& TestMatrix(SkRandom* random) {
static SkMatrix gMatrices[5];
static bool gOnce;
if (!gOnce) {
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 4f41ae9..667efc4 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -155,7 +155,7 @@
GR_DEFINE_EFFECT_TEST(CircleEdgeEffect);
-GrEffectRef* CircleEdgeEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* CircleEdgeEffect::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
@@ -293,7 +293,7 @@
GR_DEFINE_EFFECT_TEST(EllipseEdgeEffect);
-GrEffectRef* EllipseEdgeEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* EllipseEdgeEffect::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
@@ -454,7 +454,7 @@
GR_DEFINE_EFFECT_TEST(DIEllipseEdgeEffect);
-GrEffectRef* DIEllipseEdgeEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* DIEllipseEdgeEffect::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
diff --git a/src/gpu/GrRedBlackTree.h b/src/gpu/GrRedBlackTree.h
index 1287d6a..17d2738 100644
--- a/src/gpu/GrRedBlackTree.h
+++ b/src/gpu/GrRedBlackTree.h
@@ -949,7 +949,7 @@
void GrRedBlackTree<T,C>::UnitTest() {
GrRedBlackTree<int> tree;
- SkMWCRandom r;
+ SkRandom r;
int count[100] = {0};
// add 10K ints
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index a55ceab..0131690 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -144,7 +144,7 @@
GR_DEFINE_EFFECT_TEST(GrConicEffect);
-GrEffectRef* GrConicEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrConicEffect::TestCreate(SkRandom* random,
GrContext*,
const GrDrawTargetCaps& caps,
GrTexture*[]) {
@@ -278,7 +278,7 @@
GR_DEFINE_EFFECT_TEST(GrQuadEffect);
-GrEffectRef* GrQuadEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrQuadEffect::TestCreate(SkRandom* random,
GrContext*,
const GrDrawTargetCaps& caps,
GrTexture*[]) {
@@ -423,7 +423,7 @@
GR_DEFINE_EFFECT_TEST(GrCubicEffect);
-GrEffectRef* GrCubicEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrCubicEffect::TestCreate(SkRandom* random,
GrContext*,
const GrDrawTargetCaps& caps,
GrTexture*[]) {
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 1eb1fc2..cf20d15 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -161,7 +161,7 @@
GR_DEFINE_EFFECT_TEST(GrBicubicEffect);
-GrEffectRef* GrBicubicEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrBicubicEffect::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index d504847..935e074 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -134,7 +134,7 @@
GR_DEFINE_EFFECT_TEST(GrConfigConversionEffect);
-GrEffectRef* GrConfigConversionEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrConfigConversionEffect::TestCreate(SkRandom* random,
GrContext*,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index dd25d40..19fed1c 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -219,7 +219,7 @@
GR_DEFINE_EFFECT_TEST(GrConvolutionEffect);
-GrEffectRef* GrConvolutionEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrConvolutionEffect::TestCreate(SkRandom* random,
GrContext*,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index 97e711e..88ba56a 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -103,7 +103,7 @@
GR_DEFINE_EFFECT_TEST(GrSimpleTextureEffect);
-GrEffectRef* GrSimpleTextureEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrSimpleTextureEffect::TestCreate(SkRandom* random,
GrContext*,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
diff --git a/src/gpu/effects/GrTextureDomainEffect.cpp b/src/gpu/effects/GrTextureDomainEffect.cpp
index c7eda88..59bd909 100644
--- a/src/gpu/effects/GrTextureDomainEffect.cpp
+++ b/src/gpu/effects/GrTextureDomainEffect.cpp
@@ -210,7 +210,7 @@
GR_DEFINE_EFFECT_TEST(GrTextureDomainEffect);
-GrEffectRef* GrTextureDomainEffect::TestCreate(SkMWCRandom* random,
+GrEffectRef* GrTextureDomainEffect::TestCreate(SkRandom* random,
GrContext*,
const GrDrawTargetCaps&,
GrTexture* textures[]) {
diff --git a/src/gpu/gl/GrGLProgramDesc.h b/src/gpu/gl/GrGLProgramDesc.h
index 495a225..fb67a97 100644
--- a/src/gpu/gl/GrGLProgramDesc.h
+++ b/src/gpu/gl/GrGLProgramDesc.h
@@ -47,7 +47,7 @@
uint32_t getChecksum() const { return *this->atOffset<uint32_t, kChecksumOffset>(); }
// For unit testing.
- void setRandom(SkMWCRandom*,
+ void setRandom(SkRandom*,
const GrGpuGL* gpu,
const GrRenderTarget* dummyDstRenderTarget,
const GrTexture* dummyDstCopyTexture,
diff --git a/src/utils/SkPathUtils.cpp b/src/utils/SkPathUtils.cpp
index 2e17ccb..86b2f10 100644
--- a/src/utils/SkPathUtils.cpp
+++ b/src/utils/SkPathUtils.cpp
@@ -21,7 +21,7 @@
/*
static void FillRandomBits( int chars, char* bits ){
SkTime time;
- SkMWCRandom rand = SkMWCRandom( time.GetMSecs() );
+ SkRandom rand = SkRandom( time.GetMSecs() );
for (int i = 0; i < chars; ++i){
bits[i] = rand.nextU();