diff options
129 files changed, 259 insertions, 259 deletions
diff --git a/bench/AAClipBench.cpp b/bench/AAClipBench.cpp index ef5ba1588e..276a8ff3e7 100644 --- a/bench/AAClipBench.cpp +++ b/bench/AAClipBench.cpp @@ -94,7 +94,7 @@ class NestedAAClipBench : public SkBenchmark { SkString fName; bool fDoAA; SkRect fDrawRect; - SkMWCRandom fRandom; + SkRandom fRandom; static const int kNumDraws = SkBENCHLOOP(2); static const int kNestingDepth = 3; diff --git a/bench/BicubicBench.cpp b/bench/BicubicBench.cpp index 1aa2dbd283..a3a23180f9 100644 --- a/bench/BicubicBench.cpp +++ b/bench/BicubicBench.cpp @@ -37,7 +37,7 @@ protected: paint.setAntiAlias(true); - SkMWCRandom rand; + SkRandom rand; SkRect r = SkRect::MakeWH(40, 40); SkAutoTUnref<SkImageFilter> bicubic(SkBicubicImageFilter::CreateMitchell(fScale)); paint.setImageFilter(bicubic); diff --git a/bench/BitmapBench.cpp b/bench/BitmapBench.cpp index 9291342565..a472d2489f 100644 --- a/bench/BitmapBench.cpp +++ b/bench/BitmapBench.cpp @@ -137,7 +137,7 @@ protected: virtual void onDraw(SkCanvas* canvas) { SkIPoint dim = this->getSize(); - SkMWCRandom rand; + SkRandom rand; SkPaint paint(fPaint); this->setupPaint(&paint); diff --git a/bench/BitmapRectBench.cpp b/bench/BitmapRectBench.cpp index aee0eec79d..c147da2349 100644 --- a/bench/BitmapRectBench.cpp +++ b/bench/BitmapRectBench.cpp @@ -86,7 +86,7 @@ protected: virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { - SkMWCRandom rand; + SkRandom rand; SkPaint paint; this->setupPaint(&paint); diff --git a/bench/BlurBench.cpp b/bench/BlurBench.cpp index 54e7dfdb02..b373df8fa9 100644 --- a/bench/BlurBench.cpp +++ b/bench/BlurBench.cpp @@ -59,7 +59,7 @@ protected: paint.setAntiAlias(true); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < SkBENCHLOOP(10); i++) { SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400, rand.nextUScalar1() * 400); diff --git a/bench/ChartBench.cpp b/bench/ChartBench.cpp index 0a692cfc80..1ecf30ab84 100644 --- a/bench/ChartBench.cpp +++ b/bench/ChartBench.cpp @@ -21,7 +21,7 @@ namespace { // Generates y values for the chart plots. void gen_data(SkScalar yAvg, SkScalar ySpread, int count, SkTDArray<SkScalar>* dataPts) { dataPts->setCount(count); - static SkMWCRandom gRandom; + static SkRandom gRandom; for (int i = 0; i < count; ++i) { (*dataPts)[i] = gRandom.nextRangeScalar(yAvg - SkScalarHalf(ySpread), yAvg + SkScalarHalf(ySpread)); @@ -131,7 +131,7 @@ protected: canvas->clear(0xFFE0F0E0); - static SkMWCRandom colorRand; + static SkRandom colorRand; static SkColor gColors[kNumGraphs] = { 0x0 }; if (0 == gColors[0]) { for (int i = 0; i < kNumGraphs; ++i) { diff --git a/bench/ChecksumBench.cpp b/bench/ChecksumBench.cpp index bc13ec5a55..315402eeee 100644 --- a/bench/ChecksumBench.cpp +++ b/bench/ChecksumBench.cpp @@ -30,7 +30,7 @@ class ComputeChecksumBench : public SkBenchmark { public: ComputeChecksumBench(void* param, ChecksumType type) : INHERITED(param), fType(type) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < U32COUNT; ++i) { fData[i] = rand.nextU(); } diff --git a/bench/FSRectBench.cpp b/bench/FSRectBench.cpp index 64c1c3d35f..5ae4c2f1db 100644 --- a/bench/FSRectBench.cpp +++ b/bench/FSRectBench.cpp @@ -27,7 +27,7 @@ protected: virtual void onPreDraw() SK_OVERRIDE { if (!fInit) { - SkMWCRandom rand; + SkRandom rand; static const SkScalar kMinOffset = 0; static const SkScalar kMaxOffset = 100 * SK_Scalar1; static const SkScalar kOffsetRange = kMaxOffset - kMinOffset; diff --git a/bench/GameBench.cpp b/bench/GameBench.cpp index 70514947df..44f92cb8e6 100644 --- a/bench/GameBench.cpp +++ b/bench/GameBench.cpp @@ -88,9 +88,9 @@ protected: } virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { - SkMWCRandom scaleRand; - SkMWCRandom transRand; - SkMWCRandom rotRand; + SkRandom scaleRand; + SkRandom transRand; + SkRandom rotRand; int width, height; if (fUseAtlas) { @@ -280,7 +280,7 @@ private: // Note: the resulting atlas has transparency void makeAtlas() { - SkMWCRandom rand; + SkRandom rand; SkColor colors[kNumAtlasedX][kNumAtlasedY]; diff --git a/bench/GrMemoryPoolBench.cpp b/bench/GrMemoryPoolBench.cpp index 78a283b0c5..dccf8278f5 100644 --- a/bench/GrMemoryPoolBench.cpp +++ b/bench/GrMemoryPoolBench.cpp @@ -47,7 +47,7 @@ protected: } virtual void onDraw(SkCanvas*) { - SkMWCRandom r; + SkRandom r; enum { kMaxObjects = 4 * (1 << 10), }; @@ -103,7 +103,7 @@ protected: } virtual void onDraw(SkCanvas*) { - SkMWCRandom r; + SkRandom r; enum { kMaxObjects = 4 * (1 << 10), }; @@ -141,7 +141,7 @@ protected: } virtual void onDraw(SkCanvas*) { - SkMWCRandom r; + SkRandom r; A* objects[M]; for (int i = 0; i < N; i++) { uint32_t count = r.nextRangeU(0, M-1); diff --git a/bench/HairlinePathBench.cpp b/bench/HairlinePathBench.cpp index ca3797b7b2..f5b30a38ad 100644 --- a/bench/HairlinePathBench.cpp +++ b/bench/HairlinePathBench.cpp @@ -85,7 +85,7 @@ public: name->append("line"); } virtual void makePath(SkPath* path) SK_OVERRIDE { - SkMWCRandom rand; + SkRandom rand; int size = SK_ARRAY_COUNT(points); int hSize = size / 2; for (int i = 0; i < kMaxPathSize; ++i) { @@ -117,7 +117,7 @@ public: name->append("quad"); } virtual void makePath(SkPath* path) SK_OVERRIDE { - SkMWCRandom rand; + SkRandom rand; int size = SK_ARRAY_COUNT(points); int hSize = size / 2; for (int i = 0; i < kMaxPathSize; ++i) { @@ -149,8 +149,8 @@ public: name->append("conic"); } virtual void makePath(SkPath* path) SK_OVERRIDE { - SkMWCRandom rand; - SkMWCRandom randWeight; + SkRandom rand; + SkRandom randWeight; int size = SK_ARRAY_COUNT(points); int hSize = size / 2; for (int i = 0; i < kMaxPathSize; ++i) { @@ -184,7 +184,7 @@ public: name->append("cubic"); } virtual void makePath(SkPath* path) SK_OVERRIDE { - SkMWCRandom rand; + SkRandom rand; int size = SK_ARRAY_COUNT(points); int hSize = size / 2; for (int i = 0; i < kMaxPathSize; ++i) { diff --git a/bench/LineBench.cpp b/bench/LineBench.cpp index 69074359ae..feaae2b267 100644 --- a/bench/LineBench.cpp +++ b/bench/LineBench.cpp @@ -32,7 +32,7 @@ public: fDoAA = doAA; fName.printf("lines_%g_%s", width, doAA ? "AA" : "BW"); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < PTS; ++i) { fPts[i].set(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480); } diff --git a/bench/MathBench.cpp b/bench/MathBench.cpp index 5470924836..32a89d64ef 100644 --- a/bench/MathBench.cpp +++ b/bench/MathBench.cpp @@ -26,7 +26,7 @@ public: MathBench(void* param, const char name[]) : INHERITED(param) { fName.printf("math_%s", name); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < kBuffer; ++i) { fSrc[i] = rand.nextSScalar1(); } @@ -254,7 +254,7 @@ class IsFiniteBench : public SkBenchmark { public: IsFiniteBench(void* param, int index) : INHERITED(param) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < N; ++i) { fData[i] = rand.nextSScalar1(); @@ -322,7 +322,7 @@ class FloorBench : public SkBenchmark { public: FloorBench(void* param, bool fast) : INHERITED(param), fFast(fast) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < ARRAY; ++i) { fData[i] = rand.nextSScalar1(); @@ -340,7 +340,7 @@ public: protected: virtual void onDraw(SkCanvas*) { - SkMWCRandom rand; + SkRandom rand; float accum = 0; const float* data = fData; @@ -384,7 +384,7 @@ public: : INHERITED(param) , fUsePortable(usePortable) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < ARRAY; ++i) { fData[i] = rand.nextU(); } @@ -444,7 +444,7 @@ public: NormalizeBench(void* param) : INHERITED(param) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < ARRAY; ++i) { fVec[i].set(rand.nextSScalar1(), rand.nextSScalar1()); } @@ -490,7 +490,7 @@ class FixedMathBench : public SkBenchmark { public: FixedMathBench(void* param) : INHERITED(param) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < N; ++i) { fData[i] = rand.nextSScalar1(); } diff --git a/bench/MatrixBench.cpp b/bench/MatrixBench.cpp index e7054d43b8..8a5c5c69b4 100644 --- a/bench/MatrixBench.cpp +++ b/bench/MatrixBench.cpp @@ -95,7 +95,7 @@ private: // handling NaN values is a lot slower. Anyway, this guy is just meant to put // reasonable values in our arrays. template <typename T> void init9(T array[9]) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 9; i++) { array[i] = rand.nextSScalar1(); } @@ -261,7 +261,7 @@ protected: private: SkMatrix fMatrix; float fArray[9]; - SkMWCRandom fRnd; + SkRandom fRnd; typedef MatrixBench INHERITED; }; @@ -302,7 +302,7 @@ class ScaleTransMixedMatrixBench : public MatrixBench { SkMatrix fMatrix; SkPoint fSrc [16]; SkPoint fDst [16]; - SkMWCRandom fRandom; + SkRandom fRandom; typedef MatrixBench INHERITED; }; @@ -342,7 +342,7 @@ class ScaleTransDoubleMatrixBench : public MatrixBench { double fMatrix [9]; SkPoint fSrc [16]; SkPoint fDst [16]; - SkMWCRandom fRandom; + SkRandom fRandom; typedef MatrixBench INHERITED; }; @@ -370,7 +370,7 @@ protected: } private: SkMatrix fMatrix[10]; - SkMWCRandom fRandom; + SkRandom fRandom; typedef MatrixBench INHERITED; }; diff --git a/bench/MatrixConvolutionBench.cpp b/bench/MatrixConvolutionBench.cpp index 82ac78cb0e..161fc23296 100644 --- a/bench/MatrixConvolutionBench.cpp +++ b/bench/MatrixConvolutionBench.cpp @@ -39,7 +39,7 @@ protected: SkPaint paint; this->setupPaint(&paint); paint.setAntiAlias(true); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < SkBENCHLOOP(3); i++) { SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400, rand.nextUScalar1() * 400); diff --git a/bench/MorphologyBench.cpp b/bench/MorphologyBench.cpp index 961721d77e..f9657bafd2 100644 --- a/bench/MorphologyBench.cpp +++ b/bench/MorphologyBench.cpp @@ -59,7 +59,7 @@ protected: paint.setAntiAlias(true); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < SkBENCHLOOP(3); i++) { SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400, rand.nextUScalar1() * 400); diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp index 967f501acf..057a2b028c 100644 --- a/bench/PathBench.cpp +++ b/bench/PathBench.cpp @@ -183,7 +183,7 @@ public: name->append("long_curved"); } virtual void makePath(SkPath* path) SK_OVERRIDE { - SkMWCRandom rand (12); + SkRandom rand (12); int i; for (i = 0; i < 100; i++) { path->quadTo(SkScalarMul(rand.nextUScalar1(), SkIntToScalar(640)), @@ -208,7 +208,7 @@ public: name->append("long_line"); } virtual void makePath(SkPath* path) SK_OVERRIDE { - SkMWCRandom rand; + SkRandom rand; path->moveTo(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480); for (size_t i = 1; i < 100; i++) { path->lineTo(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480); @@ -316,7 +316,7 @@ private: int fCurrPath; int fCurrVerb; int fCurrPoint; - SkMWCRandom fRandom; + SkRandom fRandom; typedef SkBenchmark INHERITED; }; @@ -653,7 +653,7 @@ protected: paint.setStyle(SkPaint::kStroke_Style); } - SkMWCRandom rand; + SkRandom rand; SkRect r; @@ -754,7 +754,7 @@ protected: } virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { - SkMWCRandom rand; + SkRandom rand; SkRect r; for (int i = 0; i < 5000; ++i) { @@ -834,7 +834,7 @@ private: virtual void onPreDraw() SK_OVERRIDE { fQueryRects.setCount(kQueryRectCnt); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < kQueryRectCnt; ++i) { SkSize size; SkPoint xy; @@ -931,7 +931,7 @@ private: /////////////////////////////////////////////////////////////////////////////// -static void rand_conic(SkConic* conic, SkMWCRandom& rand) { +static void rand_conic(SkConic* conic, SkRandom& rand) { for (int i = 0; i < 3; ++i) { conic->fPts[i].set(rand.nextUScalar1() * 100, rand.nextUScalar1() * 100); } @@ -945,7 +945,7 @@ static void rand_conic(SkConic* conic, SkMWCRandom& rand) { class ConicBench : public SkBenchmark { public: ConicBench(void* param) : INHERITED(param) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < CONICS; ++i) { rand_conic(&fConics[i], rand); } diff --git a/bench/PathIterBench.cpp b/bench/PathIterBench.cpp index e560ff76ef..987a752ad9 100644 --- a/bench/PathIterBench.cpp +++ b/bench/PathIterBench.cpp @@ -14,7 +14,7 @@ #include "SkShader.h" #include "SkString.h" -static int rand_pts(SkMWCRandom& rand, SkPoint pts[4]) { +static int rand_pts(SkRandom& rand, SkPoint pts[4]) { int n = rand.nextU() & 3; n += 1; @@ -37,7 +37,7 @@ public: fName.printf("pathiter_%s", raw ? "raw" : "consume"); fRaw = raw; - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 1000; ++i) { SkPoint pts[4]; int n = rand_pts(rand, pts); diff --git a/bench/PathUtilsBench.cpp b/bench/PathUtilsBench.cpp index a021f22f68..613d49aa41 100644 --- a/bench/PathUtilsBench.cpp +++ b/bench/PathUtilsBench.cpp @@ -18,7 +18,7 @@ //this function is redefined for sample, test, and bench. is there anywhere // I can put it to avoid code duplcation? static void fillRandomBits( int chars, char* bits ){ - SkMWCRandom rand(SkTime::GetMSecs()); + SkRandom rand(SkTime::GetMSecs()); for (int i = 0; i < chars; ++i){ bits[i] = rand.nextU(); diff --git a/bench/PictureRecordBench.cpp b/bench/PictureRecordBench.cpp index 1ba3cb3166..f23f0cb961 100644 --- a/bench/PictureRecordBench.cpp +++ b/bench/PictureRecordBench.cpp @@ -143,7 +143,7 @@ public: protected: virtual float innerLoopScale() const SK_OVERRIDE { return 0.1f; } virtual void recordCanvas(SkCanvas* canvas) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < M; i++) { SkPaint paint; paint.setColor(rand.nextU()); @@ -167,7 +167,7 @@ class RecurringPaintDictionaryRecordBench : public PictureRecordBench { public: RecurringPaintDictionaryRecordBench(void* param) : INHERITED(param, "recurring_paint_dictionary") { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < ObjCount; i++) { fPaint[i].setColor(rand.nextU()); } diff --git a/bench/RTreeBench.cpp b/bench/RTreeBench.cpp index 606a84d156..7dc54ca329 100644 --- a/bench/RTreeBench.cpp +++ b/bench/RTreeBench.cpp @@ -19,7 +19,7 @@ static const int NUM_QUERY_RECTS = 5000; static const int NUM_QUERIES = 1000; static const int GRID_WIDTH = 100; -typedef SkIRect (*MakeRectProc)(SkMWCRandom&, int, int); +typedef SkIRect (*MakeRectProc)(SkRandom&, int, int); // Time how long it takes to build an R-Tree either bulk-loaded or not class BBoxBuildBench : public SkBenchmark { @@ -46,7 +46,7 @@ protected: return fName.c_str(); } virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < SkBENCHLOOP(100); ++i) { for (int j = 0; j < NUM_BUILD_RECTS; ++j) { fTree->insert(reinterpret_cast<void*>(j), fProc(rand, j, NUM_BUILD_RECTS), @@ -97,7 +97,7 @@ protected: return fName.c_str(); } virtual void onPreDraw() SK_OVERRIDE { - SkMWCRandom rand; + SkRandom rand; for (int j = 0; j < SkBENCHLOOP(NUM_QUERY_RECTS); ++j) { fTree->insert(reinterpret_cast<void*>(j), fProc(rand, j, SkBENCHLOOP(NUM_QUERY_RECTS)), fBulkLoad); @@ -106,7 +106,7 @@ protected: } virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < SkBENCHLOOP(NUM_QUERIES); ++i) { SkTDArray<void*> hits; SkIRect query; @@ -149,22 +149,22 @@ private: typedef SkBenchmark INHERITED; }; -static inline SkIRect make_simple_rect(SkMWCRandom&, int index, int numRects) { +static inline SkIRect make_simple_rect(SkRandom&, int index, int numRects) { SkIRect out = {0, 0, GENERATE_EXTENTS, GENERATE_EXTENTS}; return out; } -static inline SkIRect make_concentric_rects_increasing(SkMWCRandom&, int index, int numRects) { +static inline SkIRect make_concentric_rects_increasing(SkRandom&, int index, int numRects) { SkIRect out = {0, 0, index + 1, index + 1}; return out; } -static inline SkIRect make_concentric_rects_decreasing(SkMWCRandom&, int index, int numRects) { +static inline SkIRect make_concentric_rects_decreasing(SkRandom&, int index, int numRects) { SkIRect out = {0, 0, numRects - index, numRects - index}; return out; } -static inline SkIRect make_XYordered_rects(SkMWCRandom& rand, int index, int numRects) { +static inline SkIRect make_XYordered_rects(SkRandom& rand, int index, int numRects) { SkIRect out; out.fLeft = index % GRID_WIDTH; out.fTop = index / GRID_WIDTH; @@ -172,7 +172,7 @@ static inline SkIRect make_XYordered_rects(SkMWCRandom& rand, int index, int num out.fBottom = out.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 3); return out; } -static inline SkIRect make_YXordered_rects(SkMWCRandom& rand, int index, int numRects) { +static inline SkIRect make_YXordered_rects(SkRandom& rand, int index, int numRects) { SkIRect out; out.fLeft = index / GRID_WIDTH; out.fTop = index % GRID_WIDTH; @@ -181,7 +181,7 @@ static inline SkIRect make_YXordered_rects(SkMWCRandom& rand, int index, int num return out; } -static inline SkIRect make_point_rects(SkMWCRandom& rand, int index, int numRects) { +static inline SkIRect make_point_rects(SkRandom& rand, int index, int numRects) { SkIRect out; out.fLeft = rand.nextU() % GENERATE_EXTENTS; out.fTop = rand.nextU() % GENERATE_EXTENTS; @@ -190,7 +190,7 @@ static inline SkIRect make_point_rects(SkMWCRandom& rand, int index, int numRect return out; } -static inline SkIRect make_random_rects(SkMWCRandom& rand, int index, int numRects) { +static inline SkIRect make_random_rects(SkRandom& rand, int index, int numRects) { SkIRect out; out.fLeft = rand.nextS() % GENERATE_EXTENTS; out.fTop = rand.nextS() % GENERATE_EXTENTS; @@ -199,7 +199,7 @@ static inline SkIRect make_random_rects(SkMWCRandom& rand, int index, int numRec return out; } -static inline SkIRect make_large_rects(SkMWCRandom& rand, int index, int numRects) { +static inline SkIRect make_large_rects(SkRandom& rand, int index, int numRects) { SkIRect out; out.fLeft = rand.nextU() % GENERATE_EXTENTS; out.fTop = rand.nextU() % GENERATE_EXTENTS; diff --git a/bench/RectBench.cpp b/bench/RectBench.cpp index e3d0e24265..99ff0a94f1 100644 --- a/bench/RectBench.cpp +++ b/bench/RectBench.cpp @@ -27,7 +27,7 @@ public: : INHERITED(param) , fShift(shift) , fStroke(stroke) { - SkMWCRandom rand; + SkRandom rand; const SkScalar offset = SK_Scalar1/3; for (int i = 0; i < N; i++) { int x = rand.nextU() % W; @@ -246,7 +246,7 @@ protected: gSizes[0] = this->getStrokeWidth(); sizes = 1; } - SkMWCRandom rand; + SkRandom rand; SkColor color = 0xFF000000; U8CPU alpha = 0xFF; SkPaint paint; diff --git a/bench/RectoriBench.cpp b/bench/RectoriBench.cpp index 1aa9814207..bb887971c1 100644 --- a/bench/RectoriBench.cpp +++ b/bench/RectoriBench.cpp @@ -25,7 +25,7 @@ protected: } virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { - SkMWCRandom Random; + SkRandom Random; for (int i = 0; i < N; i++) { SkScalar blurSigma = Random.nextRangeScalar(1.5f, 25.0f); diff --git a/bench/RegionBench.cpp b/bench/RegionBench.cpp index 4c2ea6e124..7a306e97c3 100644 --- a/bench/RegionBench.cpp +++ b/bench/RegionBench.cpp @@ -82,7 +82,7 @@ public: N = SkBENCHLOOP(2000) }; - SkIRect randrect(SkMWCRandom& rand) { + SkIRect randrect(SkRandom& rand) { int x = rand.nextU() % W; int y = rand.nextU() % H; int w = rand.nextU() % W; @@ -95,7 +95,7 @@ public: fName.printf("region_%s_%d", name, count); fLoopMul = mul; - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < count; i++) { fA.op(randrect(rand), SkRegion::kXOR_Op); fB.op(randrect(rand), SkRegion::kXOR_Op); diff --git a/bench/RegionContainBench.cpp b/bench/RegionContainBench.cpp index 40375da847..8668513979 100644 --- a/bench/RegionContainBench.cpp +++ b/bench/RegionContainBench.cpp @@ -29,7 +29,7 @@ public: N = SkBENCHLOOP(20000) }; - SkIRect randrect(SkMWCRandom& rand, int i) { + SkIRect randrect(SkRandom& rand, int i) { int w = rand.nextU() % W; return SkIRect::MakeXYWH(0, i*H/COUNT, w, H/COUNT); } @@ -38,7 +38,7 @@ public: fProc = proc; fName.printf("region_contains_%s", name); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < COUNT; i++) { fA.op(randrect(rand, i), SkRegion::kXOR_Op); } diff --git a/bench/ScalarBench.cpp b/bench/ScalarBench.cpp index 405d51e953..333dd229e1 100644 --- a/bench/ScalarBench.cpp +++ b/bench/ScalarBench.cpp @@ -56,7 +56,7 @@ int gScalarBench_NonStaticGlobal; // handling NaN values is a lot slower. Anyway, this guy is just meant to put // reasonable values in our arrays. template <typename T> void init9(T array[9]) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 9; i++) { array[i] = rand.nextSScalar1(); } @@ -102,7 +102,7 @@ private: class IsFiniteScalarBench : public ScalarBench { public: IsFiniteScalarBench(void* param) : INHERITED(param, "isfinite") { - SkMWCRandom rand; + SkRandom rand; for (size_t i = 0; i < ARRAY_N; ++i) { fArray[i] = rand.nextSScalar1(); } @@ -141,7 +141,7 @@ class RectBoundsBench : public SkBenchmark { public: RectBoundsBench(void* param) : INHERITED(param) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < PTS; ++i) { fPts[i].fX = rand.nextSScalar1(); fPts[i].fY = rand.nextSScalar1(); diff --git a/bench/ShaderMaskBench.cpp b/bench/ShaderMaskBench.cpp index d2f4e26c02..0e8e4bbee9 100644 --- a/bench/ShaderMaskBench.cpp +++ b/bench/ShaderMaskBench.cpp @@ -59,7 +59,7 @@ protected: virtual void onDraw(SkCanvas* canvas) { const SkIPoint dim = this->getSize(); - SkMWCRandom rand; + SkRandom rand; SkPaint paint(fPaint); this->setupPaint(&paint); diff --git a/bench/SortBench.cpp b/bench/SortBench.cpp index 3e4637780d..c19ebae0c8 100644 --- a/bench/SortBench.cpp +++ b/bench/SortBench.cpp @@ -13,14 +13,14 @@ static const int N = 1000; static void rand_proc(int array[], int count) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < count; ++i) { array[i] = rand.nextS(); } } static void randN_proc(int array[], int count) { - SkMWCRandom rand; + SkRandom rand; int mod = N / 10; for (int i = 0; i < count; ++i) { array[i] = rand.nextU() % mod; diff --git a/bench/TextBench.cpp b/bench/TextBench.cpp index 4f78e18a3d..9334c33476 100644 --- a/bench/TextBench.cpp +++ b/bench/TextBench.cpp @@ -94,7 +94,7 @@ protected: virtual void onDraw(SkCanvas* canvas) { const SkIPoint dim = this->getSize(); - SkMWCRandom rand; + SkRandom rand; SkPaint paint(fPaint); this->setupPaint(&paint); diff --git a/bench/VertBench.cpp b/bench/VertBench.cpp index 564a3064c7..5456e28825 100644 --- a/bench/VertBench.cpp +++ b/bench/VertBench.cpp @@ -68,7 +68,7 @@ public: SkASSERT(PTS == pts - fPts); SkASSERT(IDX == idx - fIdx); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < PTS; ++i) { fColors[i] = rand.nextU() | (0xFF << 24); } diff --git a/bench/XfermodeBench.cpp b/bench/XfermodeBench.cpp index 71cf0e69b5..0f70a4c053 100644 --- a/bench/XfermodeBench.cpp +++ b/bench/XfermodeBench.cpp @@ -35,7 +35,7 @@ protected: virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { SkISize size = canvas->getDeviceSize(); - SkMWCRandom random; + SkRandom random; for (int i = 0; i < kNumRects; ++i) { SkPaint paint; paint.setXfermode(fXfermode.get()); diff --git a/gm/arcofzorro.cpp b/gm/arcofzorro.cpp index f1f1195bad..f5a6c21c98 100644 --- a/gm/arcofzorro.cpp +++ b/gm/arcofzorro.cpp @@ -29,7 +29,7 @@ protected: } virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { - SkMWCRandom rand; + SkRandom rand; SkRect rect = SkRect::MakeXYWH(10, 10, 200, 200); diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp index 2a63d73816..c33674caad 100644 --- a/gm/beziereffects.cpp +++ b/gm/beziereffects.cpp @@ -74,7 +74,7 @@ protected: }; static const int kNumCubics = 15; - SkMWCRandom rand; + SkRandom rand; // Mult by 3 for each edge effect type int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumCubics*3))); @@ -226,7 +226,7 @@ protected: }; static const int kNumConics = 10; - SkMWCRandom rand; + SkRandom rand; // Mult by 3 for each edge effect type int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumConics*3))); @@ -411,7 +411,7 @@ protected: }; static const int kNumQuads = 5; - SkMWCRandom rand; + SkRandom rand; int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumQuads*3))); int numRows = SkScalarCeilToInt(SkIntToScalar(kNumQuads*3) / numCols); diff --git a/gm/circles.cpp b/gm/circles.cpp index f57463954c..3cd07f29a1 100644 --- a/gm/circles.cpp +++ b/gm/circles.cpp @@ -152,9 +152,8 @@ protected: } virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { - SkRandom rand; + SkLCGRandom rand; canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); - int i; for (i = 0; i < fPaints.count(); ++i) { canvas->save(); @@ -206,3 +205,4 @@ static GM* MyFactory(void*) { return new CircleGM; } static GMRegistry reg(MyFactory); } + diff --git a/gm/complexclip2.cpp b/gm/complexclip2.cpp index ce1f0e0746..f936ab1c0a 100644 --- a/gm/complexclip2.cpp +++ b/gm/complexclip2.cpp @@ -70,7 +70,7 @@ public: SkRegion::kReplace_Op, }; - SkRandom r; + SkLCGRandom r; for (int i = 0; i < kRows; ++i) { for (int j = 0; j < kCols; ++j) { for (int k = 0; k < 5; ++k) { diff --git a/gm/convexpaths.cpp b/gm/convexpaths.cpp index 668e01c0a7..b1b2696bf8 100644 --- a/gm/convexpaths.cpp +++ b/gm/convexpaths.cpp @@ -261,7 +261,7 @@ protected: SkPaint paint; paint.setAntiAlias(true); - SkRandom rand; + SkLCGRandom rand; canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); // As we've added more paths this has gotten pretty big. Scale the whole thing down. diff --git a/gm/cubicpaths.cpp b/gm/cubicpaths.cpp index 15f611a9ee..f95f700660 100644 --- a/gm/cubicpaths.cpp +++ b/gm/cubicpaths.cpp @@ -131,7 +131,7 @@ protected: 20 * SK_Scalar1, titlePaint); - SkRandom rand; + SkLCGRandom rand; SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); canvas->save(); canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); @@ -275,7 +275,7 @@ protected: 20 * SK_Scalar1, titlePaint); - SkRandom rand; + SkLCGRandom rand; SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); canvas->save(); canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); diff --git a/gm/degeneratesegments.cpp b/gm/degeneratesegments.cpp index 2e19d05f7d..3f99c6852d 100644 --- a/gm/degeneratesegments.cpp +++ b/gm/degeneratesegments.cpp @@ -297,7 +297,7 @@ protected: 20 * SK_Scalar1, titlePaint); - SkRandom rand; + SkLCGRandom rand; SkRect rect = SkRect::MakeWH(220*SK_Scalar1, 50*SK_Scalar1); canvas->save(); canvas->translate(2*SK_Scalar1, 30 * SK_Scalar1); // The title diff --git a/gm/emptypath.cpp b/gm/emptypath.cpp index df314a356d..7b3a7e606a 100644 --- a/gm/emptypath.cpp +++ b/gm/emptypath.cpp @@ -72,7 +72,7 @@ protected: 20 * SK_Scalar1, titlePaint); - SkRandom rand; + SkLCGRandom rand; SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); int i = 0; canvas->save(); diff --git a/gm/getpostextpath.cpp b/gm/getpostextpath.cpp index 39a3fc160f..0f2eb7983e 100644 --- a/gm/getpostextpath.cpp +++ b/gm/getpostextpath.cpp @@ -51,7 +51,7 @@ protected: SkAutoTArray<SkScalar> widths(len); paint.getTextWidths(text, len, &widths[0]); - SkRandom rand; + SkLCGRandom rand; SkScalar x = SkIntToScalar(20); SkScalar y = SkIntToScalar(100); for (size_t i = 0; i < len; ++i) { diff --git a/gm/hittestpath.cpp b/gm/hittestpath.cpp index 03275719fb..6ffc1f9f86 100644 --- a/gm/hittestpath.cpp +++ b/gm/hittestpath.cpp @@ -42,7 +42,7 @@ protected: virtual void onDraw(SkCanvas* canvas) { SkPath path; - SkRandom rand; + SkLCGRandom rand; int scale = 300; for (int i = 0; i < 4; ++i) { diff --git a/gm/linepaths.cpp b/gm/linepaths.cpp index fbf3faf947..69c47fe80c 100644 --- a/gm/linepaths.cpp +++ b/gm/linepaths.cpp @@ -90,7 +90,7 @@ protected: 20 * SK_Scalar1, titlePaint); - SkRandom rand; + SkLCGRandom rand; SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); canvas->save(); canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); @@ -232,7 +232,7 @@ protected: 20 * SK_Scalar1, titlePaint); - SkRandom rand; + SkLCGRandom rand; SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); canvas->save(); canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); diff --git a/gm/mixedxfermodes.cpp b/gm/mixedxfermodes.cpp index 645143a453..e3ce91a9dc 100644 --- a/gm/mixedxfermodes.cpp +++ b/gm/mixedxfermodes.cpp @@ -32,7 +32,7 @@ protected: void drawShape(SkCanvas* canvas, const SkPaint& paint, - SkMWCRandom* random) { + SkRandom* random) { static const SkRect kRect = SkRect::MakeXYWH(SkIntToScalar(-50), SkIntToScalar(-50), SkIntToScalar(75), SkIntToScalar(105)); int shape = random->nextULessThan(5); @@ -102,7 +102,7 @@ protected: canvas->drawPaint(bgPaint); SkISize size = canvas->getDeviceSize(); SkScalar maxScale = SkScalarSqrt((SkIntToScalar(size.fWidth * size.fHeight))) / 300; - SkMWCRandom random; + SkRandom random; for (int i = 0; i < kNumShapes; ++i) { SkScalar s = random.nextRangeScalar(SK_Scalar1 / 8, SK_Scalar1) * maxScale; SkScalar r = random.nextRangeScalar(0, SkIntToScalar(360)); diff --git a/gm/nested.cpp b/gm/nested.cpp index d5b61a490f..b3d75cfa39 100644 --- a/gm/nested.cpp +++ b/gm/nested.cpp @@ -73,7 +73,7 @@ protected: }; // draw a background pattern to make transparency errors more apparent - SkMWCRandom rand; + SkRandom rand; for (int y = 0; y < kImageHeight; y += 10) { for (int x = 0; x < kImageWidth; x += 10) { diff --git a/gm/ovals.cpp b/gm/ovals.cpp index ae727b9ef3..96e04885e3 100755 --- a/gm/ovals.cpp +++ b/gm/ovals.cpp @@ -125,7 +125,7 @@ protected: } } - SkColor genColor(SkMWCRandom* rand) { + SkColor genColor(SkRandom* rand) { SkScalar hsv[3]; hsv[0] = SkFloatToScalar(rand->nextRangeF(0.0f, 360.0f)); hsv[1] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f)); @@ -135,7 +135,7 @@ protected: } virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { - SkMWCRandom rand(1); + SkRandom rand(1); canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); SkRect oval = SkRect::MakeLTRB(-20, -30, 20, 30); diff --git a/gm/points.cpp b/gm/points.cpp index 0a83acf05f..4902c889cc 100644 --- a/gm/points.cpp +++ b/gm/points.cpp @@ -23,7 +23,7 @@ protected: return make_isize(640, 490); } - static void fill_pts(SkPoint pts[], size_t n, SkRandom* rand) { + static void fill_pts(SkPoint pts[], size_t n, SkLCGRandom* rand) { for (size_t i = 0; i < n; i++) { // Compute these independently and store in variables, rather // than in the parameter-passing expression, to get consistent @@ -37,7 +37,7 @@ protected: virtual void onDraw(SkCanvas* canvas) { canvas->translate(SK_Scalar1, SK_Scalar1); - SkRandom rand; + SkLCGRandom rand; SkPaint p0, p1, p2, p3; const size_t n = 99; diff --git a/gm/quadpaths.cpp b/gm/quadpaths.cpp index ac91c62df3..7351e45fcf 100644 --- a/gm/quadpaths.cpp +++ b/gm/quadpaths.cpp @@ -91,7 +91,7 @@ protected: 20 * SK_Scalar1, titlePaint); - SkRandom rand; + SkLCGRandom rand; SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); canvas->save(); canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); @@ -234,7 +234,7 @@ protected: 20 * SK_Scalar1, titlePaint); - SkRandom rand; + SkLCGRandom rand; SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); canvas->save(); canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); diff --git a/gm/roundrects.cpp b/gm/roundrects.cpp index c309b2a931..3f1c49ebdd 100644 --- a/gm/roundrects.cpp +++ b/gm/roundrects.cpp @@ -126,7 +126,7 @@ protected: } } - SkColor genColor(SkMWCRandom* rand) { + SkColor genColor(SkRandom* rand) { SkScalar hsv[3]; hsv[0] = SkFloatToScalar(rand->nextRangeF(0.0f, 360.0f)); hsv[1] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f)); @@ -136,7 +136,7 @@ protected: } virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { - SkMWCRandom rand(1); + SkRandom rand(1); canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); SkRect rect = SkRect::MakeLTRB(-20, -30, 20, 30); SkRRect circleRect; diff --git a/gm/strokerects.cpp b/gm/strokerects.cpp index 61ee9e0309..88641da695 100644 --- a/gm/strokerects.cpp +++ b/gm/strokerects.cpp @@ -33,7 +33,7 @@ protected: return make_isize(W*2, H*2); } - static void rnd_rect(SkRect* r, SkRandom& rand) { + static void rnd_rect(SkRect* r, SkLCGRandom& rand) { SkScalar x = rand.nextUScalar1() * W; SkScalar y = rand.nextUScalar1() * H; SkScalar w = rand.nextUScalar1() * (W >> 2); @@ -61,7 +61,7 @@ protected: , SW - SkIntToScalar(2), SH - SkIntToScalar(2) )); - SkRandom rand; + SkLCGRandom rand; for (int i = 0; i < N; i++) { SkRect r; rnd_rect(&r, rand); diff --git a/gm/strokes.cpp b/gm/strokes.cpp index 49a7fc63b4..861fd76352 100644 --- a/gm/strokes.cpp +++ b/gm/strokes.cpp @@ -18,7 +18,7 @@ static const SkScalar SW = SkIntToScalar(W); static const SkScalar SH = SkIntToScalar(H); -static void rnd_rect(SkRect* r, SkPaint* paint, SkRandom& rand) { +static void rnd_rect(SkRect* r, SkPaint* paint, SkLCGRandom& rand) { SkScalar x = rand.nextUScalar1() * W; SkScalar y = rand.nextUScalar1() * H; SkScalar w = rand.nextUScalar1() * (W >> 2); @@ -61,7 +61,7 @@ protected: , SW - SkIntToScalar(2), SH - SkIntToScalar(2) )); - SkRandom rand; + SkLCGRandom rand; for (int i = 0; i < N; i++) { SkRect r; rnd_rect(&r, &paint, rand); @@ -81,7 +81,7 @@ class Strokes2GM : public skiagm::GM { SkPath fPath; public: Strokes2GM() { - SkRandom rand; + SkLCGRandom rand; fPath.moveTo(0, 0); for (int i = 0; i < 13; i++) { SkScalar x = rand.nextUScalar1() * (W >> 1); @@ -121,7 +121,7 @@ protected: SW - SkIntToScalar(2), SH - SkIntToScalar(2))); - SkRandom rand; + SkLCGRandom rand; for (int i = 0; i < N/2; i++) { SkRect r; rnd_rect(&r, &paint, rand); diff --git a/include/gpu/GrEffectUnitTest.h b/include/gpu/GrEffectUnitTest.h index 557602fd5d..78506da197 100644 --- a/include/gpu/GrEffectUnitTest.h +++ b/include/gpu/GrEffectUnitTest.h @@ -25,7 +25,7 @@ enum { /** * A helper for use in GrEffect::TestCreate functions. */ -const SkMatrix& TestMatrix(SkMWCRandom*); +const SkMatrix& TestMatrix(SkRandom*); } @@ -38,7 +38,7 @@ class GrTexture; class GrEffectTestFactory : GrNoncopyable { public: - typedef GrEffectRef* (*CreateProc)(SkMWCRandom*, + typedef GrEffectRef* (*CreateProc)(SkRandom*, GrContext*, const GrDrawTargetCaps& caps, GrTexture* dummyTextures[]); @@ -48,7 +48,7 @@ public: GetFactories()->push_back(this); } - static GrEffectRef* CreateStage(SkMWCRandom* random, + static GrEffectRef* CreateStage(SkRandom* random, GrContext* context, const GrDrawTargetCaps& caps, GrTexture* dummyTextures[]) { @@ -67,14 +67,14 @@ private: */ #define GR_DECLARE_EFFECT_TEST \ static GrEffectTestFactory gTestFactory; \ - static GrEffectRef* TestCreate(SkMWCRandom*, \ + static GrEffectRef* TestCreate(SkRandom*, \ GrContext*, \ const GrDrawTargetCaps&, \ GrTexture* dummyTextures[2]) /** GrEffect subclasses should insert this macro in their implementation file. They must then * also implement this static function: - * GrEffect* TestCreate(SkMWCRandom*, + * GrEffect* TestCreate(SkRandom*, * GrContext*, * const GrDrawTargetCaps&, * GrTexture* dummyTextures[2]); @@ -91,7 +91,7 @@ private: // The unit test relies on static initializers. Just declare the TestCreate function so that // its definitions will compile. #define GR_DECLARE_EFFECT_TEST \ - static GrEffectRef* TestCreate(SkMWCRandom*, \ + static GrEffectRef* TestCreate(SkRandom*, \ GrContext*, \ const GrDrawTargetCaps&, \ GrTexture* dummyTextures[2]) diff --git a/include/utils/SkRandom.h b/include/utils/SkRandom.h index 3e2ef201ad..eeaa701c6e 100644 --- a/include/utils/SkRandom.h +++ b/include/utils/SkRandom.h @@ -13,16 +13,16 @@ #include "Sk64.h" #include "SkScalar.h" -/** \class SkRandom +/** \class SkLCGRandom Utility class that implements pseudo random 32bit numbers using a fast linear equation. Unlike rand(), this class holds its own seed (initially set to 0), so that multiple instances can be used with no side-effects. */ -class SkRandom { +class SkLCGRandom { public: - SkRandom() : fSeed(0) {} - SkRandom(uint32_t seed) : fSeed(seed) {} + SkLCGRandom() : fSeed(0) {} + SkLCGRandom(uint32_t seed) : fSeed(seed) {} /** Return the next pseudo random number as an unsigned 32bit value. */ @@ -151,7 +151,7 @@ private: uint32_t fSeed; }; -/** \class SkMWCRandom +/** \class SkRandom Utility class that implements pseudo random 32bit numbers using Marsaglia's multiply-with-carry "mother of all" algorithm. Unlike rand(), this class holds @@ -159,13 +159,13 @@ private: Has a large period and all bits are well-randomized. */ -class SkMWCRandom { +class SkRandom { public: - SkMWCRandom() { init(0); } - SkMWCRandom(uint32_t seed) { init(seed); } - SkMWCRandom(const SkMWCRandom& rand) : fK(rand.fK), fJ(rand.fJ) {} + SkRandom() { init(0); } + SkRandom(uint32_t seed) { init(seed); } + SkRandom(const SkRandom& rand) : fK(rand.fK), fJ(rand.fJ) {} - SkMWCRandom& operator=(const SkMWCRandom& rand) { + SkRandom& operator=(const SkRandom& rand) { fK = rand.fK; fJ = rand.fJ; diff --git a/samplecode/SampleAnimBlur.cpp b/samplecode/SampleAnimBlur.cpp index 1109fdfabf..5d6638ad87 100644 --- a/samplecode/SampleAnimBlur.cpp +++ b/samplecode/SampleAnimBlur.cpp @@ -43,7 +43,7 @@ protected: SkBlurMaskFilter::kSolid_BlurStyle, SkBlurMaskFilter::kOuter_BlurStyle, }; - SkMWCRandom random; + SkRandom random; for (size_t i = 0; i < SK_ARRAY_COUNT(gStyles); ++i) { SkMaskFilter* mf = SkBlurMaskFilter::Create( diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index ee51095de8..a5338d0ca2 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -2435,7 +2435,7 @@ template <typename T> void SkTBSort(T array[], int count) { #include "SkRandom.h" -static void rand_rect(SkIRect* rect, SkMWCRandom& rand) { +static void rand_rect(SkIRect* rect, SkRandom& rand) { int bits = 8; int shift = 32 - bits; rect->set(rand.nextU() >> shift, rand.nextU() >> shift, @@ -2499,7 +2499,7 @@ static void test() { test_rects(gRecs[i].fRects, gRecs[i].fCount); } - SkMWCRandom rand; + SkRandom rand; for (i = 0; i < 10000; i++) { SkRegion rgn0, rgn1; diff --git a/samplecode/SampleChart.cpp b/samplecode/SampleChart.cpp index 68d750f881..35f8206f76 100644 --- a/samplecode/SampleChart.cpp +++ b/samplecode/SampleChart.cpp @@ -16,7 +16,7 @@ namespace { // Generates y values for the chart plots. void gen_data(SkScalar yAvg, SkScalar ySpread, int count, SkTDArray<SkScalar>* dataPts) { dataPts->setCount(count); - static SkMWCRandom gRandom; + static SkRandom gRandom; for (int i = 0; i < count; ++i) { (*dataPts)[i] = gRandom.nextRangeScalar(yAvg - SkScalarHalf(ySpread), yAvg + SkScalarHalf(ySpread)); @@ -123,7 +123,7 @@ protected: canvas->clear(0xFFE0F0E0); - static SkMWCRandom colorRand; + static SkRandom colorRand; static SkColor gColors[kNumGraphs] = { 0x0 }; if (0 == gColors[0]) { for (int i = 0; i < kNumGraphs; ++i) { diff --git a/samplecode/SampleClip.cpp b/samplecode/SampleClip.cpp index a35f42c318..3a38724e9c 100644 --- a/samplecode/SampleClip.cpp +++ b/samplecode/SampleClip.cpp @@ -17,7 +17,7 @@ #define H 200 static void show_text(SkCanvas* canvas, bool doAA) { - SkMWCRandom rand; + SkRandom rand; SkPaint paint; paint.setAntiAlias(doAA); paint.setLCDRenderText(true); @@ -32,7 +32,7 @@ static void show_text(SkCanvas* canvas, bool doAA) { } static void show_fill(SkCanvas* canvas, bool doAA) { - SkMWCRandom rand; + SkRandom rand; SkPaint paint; paint.setAntiAlias(doAA); @@ -53,13 +53,13 @@ static void show_fill(SkCanvas* canvas, bool doAA) { } } -static SkScalar randRange(SkMWCRandom& rand, SkScalar min, SkScalar max) { +static SkScalar randRange(SkRandom& rand, SkScalar min, SkScalar max) { SkASSERT(min <= max); return min + SkScalarMul(rand.nextUScalar1(), max - min); } static void show_stroke(SkCanvas* canvas, bool doAA, SkScalar strokeWidth, int n) { - SkMWCRandom rand; + SkRandom rand; SkPaint paint; paint.setAntiAlias(doAA); paint.setStyle(SkPaint::kStroke_Style); diff --git a/samplecode/SampleCull.cpp b/samplecode/SampleCull.cpp index e6b110a96a..18f2d0cc40 100644 --- a/samplecode/SampleCull.cpp +++ b/samplecode/SampleCull.cpp @@ -96,7 +96,7 @@ FINISHED2: return array; } -static SkScalar nextScalarRange(SkMWCRandom& rand, SkScalar min, SkScalar max) { +static SkScalar nextScalarRange(SkRandom& rand, SkScalar min, SkScalar max) { return min + SkScalarMul(rand.nextUScalar1(), max - min); } @@ -105,7 +105,7 @@ public: CullView() { fClip.set(0, 0, SkIntToScalar(160), SkIntToScalar(160)); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 50; i++) { SkScalar x = nextScalarRange(rand, -fClip.width()*1, fClip.width()*2); diff --git a/samplecode/SampleEmptyPath.cpp b/samplecode/SampleEmptyPath.cpp index 986a088b5e..51c570eb43 100644 --- a/samplecode/SampleEmptyPath.cpp +++ b/samplecode/SampleEmptyPath.cpp @@ -73,7 +73,7 @@ protected: 100*SK_Scalar1, titlePaint); - SkMWCRandom rand; + SkRandom rand; SkRect rect = SkRect::MakeWH(125*SK_Scalar1, 100*SK_Scalar1); int i = 0; canvas->save(); diff --git a/samplecode/SampleFontCache.cpp b/samplecode/SampleFontCache.cpp index 050867effa..c5f4457729 100644 --- a/samplecode/SampleFontCache.cpp +++ b/samplecode/SampleFontCache.cpp @@ -16,7 +16,7 @@ static void call_measure() { SkPaint paint; uint16_t text[32]; - SkMWCRandom rand; + SkRandom rand; paint.setAntiAlias(true); paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); @@ -35,7 +35,7 @@ static void call_measure() { static void call_draw(SkCanvas* canvas) { SkPaint paint; uint16_t text[32]; - SkMWCRandom rand; + SkRandom rand; paint.setAntiAlias(true); paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); diff --git a/samplecode/SampleHairCurves.cpp b/samplecode/SampleHairCurves.cpp index 421c950183..2cf0b3c900 100644 --- a/samplecode/SampleHairCurves.cpp +++ b/samplecode/SampleHairCurves.cpp @@ -34,8 +34,8 @@ protected: paint.setStrokeWidth(0); canvas->save(); canvas->scale(1000 * SK_Scalar1, 1000 * SK_Scalar1); - SkMWCRandom rand; - SkMWCRandom randW; + SkRandom rand; + SkRandom randW; SkPath curves; SkPath hulls; SkPath ctrlPts; diff --git a/samplecode/SampleManyRects.cpp b/samplecode/SampleManyRects.cpp index d5d71f4267..5182341c71 100644 --- a/samplecode/SampleManyRects.cpp +++ b/samplecode/SampleManyRects.cpp @@ -69,7 +69,7 @@ protected: } private: - SkMWCRandom fRandom; + SkRandom fRandom; typedef SampleView INHERITED; }; diff --git a/samplecode/SamplePathEffects.cpp b/samplecode/SamplePathEffects.cpp index 4c6d03cbf9..ac77f210de 100644 --- a/samplecode/SamplePathEffects.cpp +++ b/samplecode/SamplePathEffects.cpp @@ -102,7 +102,7 @@ class PathEffectView : public SampleView { SkPoint fClickPt; public: PathEffectView() { - SkMWCRandom rand; + SkRandom rand; int steps = 20; SkScalar dist = SkIntToScalar(400); SkScalar x = SkIntToScalar(20); diff --git a/samplecode/SamplePicture.cpp b/samplecode/SamplePicture.cpp index 8afebc4523..825e561654 100644 --- a/samplecode/SamplePicture.cpp +++ b/samplecode/SamplePicture.cpp @@ -165,7 +165,7 @@ protected: // test that we can re-record a subpicture, and see the results - SkMWCRandom rand(SampleCode::GetAnimTime()); + SkRandom rand(SampleCode::GetAnimTime()); canvas->translate(SkIntToScalar(10), SkIntToScalar(250)); drawCircle(fSubPicture->beginRecording(50, 50), 25, rand.nextU() | 0xFF000000); diff --git a/samplecode/SamplePoints.cpp b/samplecode/SamplePoints.cpp index 3bb8126f57..ac2f625f99 100644 --- a/samplecode/SamplePoints.cpp +++ b/samplecode/SamplePoints.cpp @@ -41,7 +41,7 @@ protected: return this->INHERITED::onQuery(evt); } - static void fill_pts(SkPoint pts[], size_t n, SkMWCRandom* rand) { + static void fill_pts(SkPoint pts[], size_t n, SkRandom* rand) { for (size_t i = 0; i < n; i++) pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480); } @@ -49,7 +49,7 @@ protected: virtual void onDrawContent(SkCanvas* canvas) { canvas->translate(SK_Scalar1, SK_Scalar1); - SkMWCRandom rand; + SkRandom rand; SkPaint p0, p1, p2, p3; const size_t n = 99; diff --git a/samplecode/SampleRotateCircles.cpp b/samplecode/SampleRotateCircles.cpp index 2dd5be94a6..1f586be4fe 100644 --- a/samplecode/SampleRotateCircles.cpp +++ b/samplecode/SampleRotateCircles.cpp @@ -38,7 +38,7 @@ protected: } virtual void onDrawContent(SkCanvas* canvas) { - SkMWCRandom rand; + SkRandom rand; SkPaint paint; paint.setAntiAlias(true); paint.setStrokeWidth(20); diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp index 7a102469c7..98e4e72618 100644 --- a/samplecode/SampleSlides.cpp +++ b/samplecode/SampleSlides.cpp @@ -350,7 +350,7 @@ public: static void make_tris(Rec* rec) { int n = 10; - SkMWCRandom rand; + SkRandom rand; rec->fMode = SkCanvas::kTriangles_VertexMode; rec->fCount = n * 3; diff --git a/samplecode/SampleStrokePath.cpp b/samplecode/SampleStrokePath.cpp index dbf6bd4993..ce6a010347 100644 --- a/samplecode/SampleStrokePath.cpp +++ b/samplecode/SampleStrokePath.cpp @@ -132,7 +132,7 @@ protected: return this->INHERITED::onQuery(evt); } - SkMWCRandom rand; + SkRandom rand; void drawSet(SkCanvas* canvas, SkPaint* paint) { SkAutoCanvasRestore acr(canvas, true); diff --git a/samplecode/SampleText.cpp b/samplecode/SampleText.cpp index b4091ff328..c6aaa52a0b 100644 --- a/samplecode/SampleText.cpp +++ b/samplecode/SampleText.cpp @@ -135,7 +135,7 @@ static void test_breakText() { SkASSERT(mm == width); } -static SkMWCRandom gRand; +static SkRandom gRand; class SkPowerMode : public SkXfermode { public: @@ -287,7 +287,7 @@ protected: canvas.drawText(s, strlen(s), SkIntToScalar(8), SkIntToScalar(14), paint); } - static void fill_pts(SkPoint pts[], size_t n, SkMWCRandom* rand) { + static void fill_pts(SkPoint pts[], size_t n, SkRandom* rand) { for (size_t i = 0; i < n; i++) pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480); } diff --git a/samplecode/SampleTextAlpha.cpp b/samplecode/SampleTextAlpha.cpp index 8f8ae4fad0..83616f4260 100644 --- a/samplecode/SampleTextAlpha.cpp +++ b/samplecode/SampleTextAlpha.cpp @@ -74,7 +74,7 @@ protected: SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3)))); paint.getMaskFilter()->unref(); - SkMWCRandom rand; + SkRandom rand; for (int ps = 6; ps <= 35; ps++) { paint.setColor(rand.nextU() | (0xFF << 24)); diff --git a/samplecode/SampleVertices.cpp b/samplecode/SampleVertices.cpp index d71a1aefde..53db2ea3fa 100644 --- a/samplecode/SampleVertices.cpp +++ b/samplecode/SampleVertices.cpp @@ -144,7 +144,7 @@ private: void make_tris(Rec* rec) { int n = 10; - SkMWCRandom rand; + SkRandom rand; rec->fMode = SkCanvas::kTriangles_VertexMode; rec->fCount = n * 3; diff --git a/src/core/SkFloat.cpp b/src/core/SkFloat.cpp index 721d8ec53e..b5cc4f18e7 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()); - 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 1efd9efc4b..ac5cee4e35 100644 --- a/src/core/SkXfermode.cpp +++ b/src/core/SkXfermode.cpp @@ -1359,7 +1359,7 @@ private: }; 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 fd81d8246a..fd3a683fbb 100644 --- a/src/effects/SkArithmeticMode.cpp +++ b/src/effects/SkArithmeticMode.cpp @@ -415,7 +415,7 @@ GrGLEffect::EffectKey GrGLArithmeticEffect::GenKey(const GrDrawEffect& drawEffec 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 0df3aec09b..84cdbf262b 100644 --- a/src/effects/SkBitmapAlphaThresholdShader.cpp +++ b/src/effects/SkBitmapAlphaThresholdShader.cpp @@ -235,7 +235,7 @@ private: 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 fa4ad5e2bc..1f841d0489 100644 --- a/src/effects/SkColorMatrixFilter.cpp +++ b/src/effects/SkColorMatrixFilter.cpp @@ -461,7 +461,7 @@ private: 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 2c95208aac..eece2eff86 100644 --- a/src/effects/SkDiscretePathEffect.cpp +++ b/src/effects/SkDiscretePathEffect.cpp @@ -31,7 +31,7 @@ bool SkDiscretePathEffect::filterPath(SkPath* dst, const SkPath& src, 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 a0764ed223..a751365b75 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -366,7 +366,7 @@ void GrDisplacementMapEffect::getConstantColorComponents(GrColor*, 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 999b8f8bfa..ecf9913d2a 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -1026,13 +1026,13 @@ bool SkSpecularLightingImageFilter::asNewEffect(GrEffectRef** effect, GrTexture* #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 @@ bool GrDiffuseLightingEffect::onIsEqual(const GrEffect& sBase) const { 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 @@ bool GrSpecularLightingEffect::onIsEqual(const GrEffect& sBase) const { 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 24aef28583..c74b067267 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -196,7 +196,7 @@ GrGLEffect::EffectKey GrGLMagnifierEffect::GenKey(const GrDrawEffect& drawEffect 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 03b28969b3..9446b8ee19 100644 --- a/src/effects/SkMatrixConvolutionImageFilter.cpp +++ b/src/effects/SkMatrixConvolutionImageFilter.cpp @@ -530,7 +530,7 @@ GR_DEFINE_EFFECT_TEST(GrMatrixConvolutionEffect); // 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 331bbd7edd..83157bef6e 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -427,7 +427,7 @@ void GrMorphologyEffect::getConstantColorComponents(GrColor* color, uint32_t* va 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 b34afe7110..de418c35ec 100644 --- a/src/effects/SkPerlinNoiseShader.cpp +++ b/src/effects/SkPerlinNoiseShader.cpp @@ -712,7 +712,7 @@ private: ///////////////////////////////////////////////////////////////////// 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 bb72b82628..f6088f56be 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -375,7 +375,7 @@ void ColorTableEffect::getConstantColorComponents(GrColor* color, uint32_t* vali 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 f1b5e58291..8bbdc21a18 100644 --- a/src/effects/gradients/SkGradientShader.cpp +++ b/src/effects/gradients/SkGradientShader.cpp @@ -1127,7 +1127,7 @@ void GrGradientEffect::getConstantColorComponents(GrColor* color, uint32_t* vali } } -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 451bd2dfee..f7a41893db 100644 --- a/src/effects/gradients/SkGradientShaderPriv.h +++ b/src/effects/gradients/SkGradientShaderPriv.h @@ -282,7 +282,7 @@ protected: 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 0b2854e5f9..aa8486d3c8 100644 --- a/src/effects/gradients/SkLinearGradient.cpp +++ b/src/effects/gradients/SkLinearGradient.cpp @@ -496,7 +496,7 @@ private: 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 9f3230358e..923d31fe77 100644 --- a/src/effects/gradients/SkRadialGradient.cpp +++ b/src/effects/gradients/SkRadialGradient.cpp @@ -531,7 +531,7 @@ private: 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 350b20aaee..669acd2197 100644 --- a/src/effects/gradients/SkSweepGradient.cpp +++ b/src/effects/gradients/SkSweepGradient.cpp @@ -447,7 +447,7 @@ private: 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 9a23071250..6315565149 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp @@ -440,7 +440,7 @@ private: 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 b4b8402912..e3f5e9f9d9 100644 --- a/src/effects/gradients/SkTwoPointRadialGradient.cpp +++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp @@ -483,7 +483,7 @@ private: 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 5ecc4e2e3a..8fa94997b0 100644 --- a/src/gpu/GrAAConvexPathRenderer.cpp +++ b/src/gpu/GrAAConvexPathRenderer.cpp @@ -593,7 +593,7 @@ private: 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 8d5851fa0f..76a5c8c8a5 100644 --- a/src/gpu/GrAARectRenderer.cpp +++ b/src/gpu/GrAARectRenderer.cpp @@ -117,7 +117,7 @@ private: 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 @@ private: 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 f14c171286..dc83f7b7cb 100644 --- a/src/gpu/GrEffect.cpp +++ b/src/gpu/GrEffect.cpp @@ -21,7 +21,7 @@ SkTArray<GrEffectTestFactory*, true>* GrEffectTestFactory::GetFactories() { #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 4f41ae9e3a..667efc4a08 100644 --- a/src/gpu/GrOvalRenderer.cpp +++ b/src/gpu/GrOvalRenderer.cpp @@ -155,7 +155,7 @@ private: 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 @@ private: 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 @@ private: 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 1287d6a3bf..17d2738115 100644 --- a/src/gpu/GrRedBlackTree.h +++ b/src/gpu/GrRedBlackTree.h @@ -949,7 +949,7 @@ template <typename T, typename C> 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 a55ceabc4d..013169081d 100644 --- a/src/gpu/effects/GrBezierEffect.cpp +++ b/src/gpu/effects/GrBezierEffect.cpp @@ -144,7 +144,7 @@ bool GrConicEffect::onIsEqual(const GrEffect& other) const { GR_DEFINE_EFFECT_TEST(GrConicEffect); -GrEffectRef* GrConicEffect::TestCreate(SkMWCRandom* random, +GrEffectRef* GrConicEffect::TestCreate(SkRandom* random, GrContext*, const GrDrawTargetCaps& caps, GrTexture*[]) { @@ -278,7 +278,7 @@ bool GrQuadEffect::onIsEqual(const GrEffect& other) const { GR_DEFINE_EFFECT_TEST(GrQuadEffect); -GrEffectRef* GrQuadEffect::TestCreate(SkMWCRandom* random, +GrEffectRef* GrQuadEffect::TestCreate(SkRandom* random, GrContext*, const GrDrawTargetCaps& caps, GrTexture*[]) { @@ -423,7 +423,7 @@ bool GrCubicEffect::onIsEqual(const GrEffect& other) const { 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 1eb1fc25ae..cf20d15169 100644 --- a/src/gpu/effects/GrBicubicEffect.cpp +++ b/src/gpu/effects/GrBicubicEffect.cpp @@ -161,7 +161,7 @@ void GrBicubicEffect::getConstantColorComponents(GrColor* color, uint32_t* valid 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 d50484712c..935e074e03 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -134,7 +134,7 @@ void GrConfigConversionEffect::getConstantColorComponents(GrColor* color, 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 dd25d40e78..19fed1cfbd 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -219,7 +219,7 @@ bool GrConvolutionEffect::onIsEqual(const GrEffect& sBase) const { 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 97e711e8d2..88ba56a54c 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.cpp +++ b/src/gpu/effects/GrSimpleTextureEffect.cpp @@ -103,7 +103,7 @@ const GrBackendEffectFactory& GrSimpleTextureEffect::getFactory() const { 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 c7eda889aa..59bd9099a4 100644 --- a/src/gpu/effects/GrTextureDomainEffect.cpp +++ b/src/gpu/effects/GrTextureDomainEffect.cpp @@ -210,7 +210,7 @@ void GrTextureDomainEffect::getConstantColorComponents(GrColor* color, uint32_t* 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 495a2250cc..fb67a97e85 100644 --- a/src/gpu/gl/GrGLProgramDesc.h +++ b/src/gpu/gl/GrGLProgramDesc.h @@ -47,7 +47,7 @@ public: 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 2e17ccb1d3..86b2f10434 100644 --- a/src/utils/SkPathUtils.cpp +++ b/src/utils/SkPathUtils.cpp @@ -21,7 +21,7 @@ typedef void (*line2path)(SkPath*, const char*, int, int); /* 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(); diff --git a/tests/AAClipTest.cpp b/tests/AAClipTest.cpp index b50757038a..e3be006e57 100644 --- a/tests/AAClipTest.cpp +++ b/tests/AAClipTest.cpp @@ -87,7 +87,7 @@ static void copyToMask(const SkRegion& rgn, SkMask* mask) { canvas.drawColor(SK_ColorBLACK); } -static SkIRect rand_rect(SkMWCRandom& rand, int n) { +static SkIRect rand_rect(SkRandom& rand, int n) { int x = rand.nextS() % n; int y = rand.nextS() % n; int w = rand.nextU() % n; @@ -95,7 +95,7 @@ static SkIRect rand_rect(SkMWCRandom& rand, int n) { return SkIRect::MakeXYWH(x, y, w, h); } -static void make_rand_rgn(SkRegion* rgn, SkMWCRandom& rand) { +static void make_rand_rgn(SkRegion* rgn, SkRandom& rand) { int count = rand.nextU() % 20; for (int i = 0; i < count; ++i) { rgn->op(rand_rect(rand, 100), SkRegion::kXOR_Op); @@ -128,7 +128,7 @@ static void setRgnToPath(SkRegion* rgn, const SkPath& path) { // aaclip.setRegion should create idential masks to the region static void test_rgn(skiatest::Reporter* reporter) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 1000; i++) { SkRegion rgn; make_rand_rgn(&rgn, rand); @@ -232,7 +232,7 @@ static void test_empty(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, mask.fBounds.isEmpty()); } -static void rand_irect(SkIRect* r, int N, SkMWCRandom& rand) { +static void rand_irect(SkIRect* r, int N, SkRandom& rand) { r->setXYWH(0, 0, rand.nextU() % N, rand.nextU() % N); int dx = rand.nextU() % (2*N); int dy = rand.nextU() % (2*N); @@ -241,7 +241,7 @@ static void rand_irect(SkIRect* r, int N, SkMWCRandom& rand) { } static void test_irect(skiatest::Reporter* reporter) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 10000; i++) { SkAAClip clip0, clip1; diff --git a/tests/BitmapGetColorTest.cpp b/tests/BitmapGetColorTest.cpp index 06e3760245..11c22e6fa3 100644 --- a/tests/BitmapGetColorTest.cpp +++ b/tests/BitmapGetColorTest.cpp @@ -10,11 +10,11 @@ #include "SkRect.h" #include "SkRandom.h" -static int nextRand(SkMWCRandom& rand, int min, int max) { +static int nextRand(SkRandom& rand, int min, int max) { return min + (int)rand.nextRangeU(0, max - min); } -static void rand_irect(SkIRect* rect, int W, int H, SkMWCRandom& rand) { +static void rand_irect(SkIRect* rect, int W, int H, SkRandom& rand) { const int DX = W / 2; const int DY = H / 2; @@ -57,7 +57,7 @@ static void test_eraserect_A1(skiatest::Reporter* reporter) { bm8.setConfig(SkBitmap::kA8_Config, W, H); bm8.allocPixels(); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 10000; ++i) { SkIRect area; rand_irect(&area, W, H, rand); diff --git a/tests/ClampRangeTest.cpp b/tests/ClampRangeTest.cpp index 2462725a08..1d6bcd21ff 100644 --- a/tests/ClampRangeTest.cpp +++ b/tests/ClampRangeTest.cpp @@ -107,7 +107,7 @@ void TestClampRange(skiatest::Reporter* reporter) { test_range(ff(1)/2, ff(16384), 100); test_range(ff(1)/2, ff(-16384), 100); - SkMWCRandom rand; + SkRandom rand; // test non-overflow cases for (int i = 0; i < 1000000; i++) { diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp index cbed19364f..c16220e500 100644 --- a/tests/ClipStackTest.cpp +++ b/tests/ClipStackTest.cpp @@ -921,7 +921,7 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { add_oval, }; - SkMWCRandom r; + SkRandom r; for (int i = 0; i < kNumTests; ++i) { // Randomly generate a clip stack. diff --git a/tests/ColorFilterTest.cpp b/tests/ColorFilterTest.cpp index 02256493fa..4016f2193d 100644 --- a/tests/ColorFilterTest.cpp +++ b/tests/ColorFilterTest.cpp @@ -35,7 +35,7 @@ template <typename T> T* reincarnate(T* obj) { #define ILLEGAL_MODE ((SkXfermode::Mode)-1) static void test_asColorMode(skiatest::Reporter* reporter) { - SkMWCRandom rand; + SkRandom rand; for (int mode = 0; mode <= SkXfermode::kLastMode; mode++) { SkColor color = rand.nextU(); diff --git a/tests/ColorTest.cpp b/tests/ColorTest.cpp index c6e5485080..a720ff4eac 100644 --- a/tests/ColorTest.cpp +++ b/tests/ColorTest.cpp @@ -146,7 +146,7 @@ static inline void test_premul(skiatest::Reporter* reporter) { */ /* static void test_interp(skiatest::Reporter* reporter) { - SkMWCRandom r; + SkRandom r; U8CPU a0 = 0; U8CPU a255 = 255; @@ -163,7 +163,7 @@ static void test_interp(skiatest::Reporter* reporter) { */ static inline void test_fast_interp(skiatest::Reporter* reporter) { - SkMWCRandom r; + SkRandom r; U8CPU a0 = 0; U8CPU a255 = 255; diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp index 0538a12aad..bdfa755781 100644 --- a/tests/DrawBitmapRectTest.cpp +++ b/tests/DrawBitmapRectTest.cpp @@ -12,7 +12,7 @@ #include "SkRandom.h" #include "SkMatrixUtils.h" -static void rand_matrix(SkMatrix* mat, SkMWCRandom& rand, unsigned mask) { +static void rand_matrix(SkMatrix* mat, SkRandom& rand, unsigned mask) { mat->setIdentity(); if (mask & SkMatrix::kTranslate_Mask) { mat->postTranslate(rand.nextSScalar1(), rand.nextSScalar1()); @@ -29,7 +29,7 @@ static void rand_matrix(SkMatrix* mat, SkMWCRandom& rand, unsigned mask) { } } -static void rand_size(SkISize* size, SkMWCRandom& rand) { +static void rand_size(SkISize* size, SkRandom& rand) { size->set(rand.nextU() & 0xFFFF, rand.nextU() & 0xFFFF); } @@ -43,7 +43,7 @@ static void test_treatAsSprite(skiatest::Reporter* reporter) { SkMatrix mat; SkISize size; - SkMWCRandom rand; + SkRandom rand; // assert: translate-only no-filter can always be treated as sprite for (int i = 0; i < 1000; ++i) { diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 316465840e..10380f7924 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -22,7 +22,7 @@ #include "SkRandom.h" #include "Test.h" -void GrGLProgramDesc::setRandom(SkMWCRandom* random, +void GrGLProgramDesc::setRandom(SkRandom* random, const GrGpuGL* gpu, const GrRenderTarget* dstRenderTarget, const GrTexture* dstCopyTexture, @@ -132,7 +132,7 @@ bool GrGpuGL::programUnitTest(int maxStages) { static const int NUM_TESTS = 512; - SkMWCRandom random; + SkRandom random; for (int t = 0; t < NUM_TESTS; ++t) { #if 0 diff --git a/tests/GrMemoryPoolTest.cpp b/tests/GrMemoryPoolTest.cpp index 0ed77bf5b1..f7866ad5cb 100644 --- a/tests/GrMemoryPoolTest.cpp +++ b/tests/GrMemoryPoolTest.cpp @@ -47,7 +47,7 @@ public: SK_DECLARE_INST_COUNT_ROOT(A); - static A* Create(SkMWCRandom* r); + static A* Create(SkRandom* r); static void SetAllocator(size_t preallocSize, size_t minAllocSize) { #if SK_ENABLE_INST_COUNT @@ -160,7 +160,7 @@ private: typedef A INHERITED; }; -A* A::Create(SkMWCRandom* r) { +A* A::Create(SkRandom* r) { switch (r->nextRangeU(0, 4)) { case 0: return new A; @@ -201,7 +201,7 @@ static void test_memory_pool(skiatest::Reporter* reporter) { // number of iterations static const int kCheckPeriod = 500; - SkMWCRandom r; + SkRandom r; for (size_t s = 0; s < SK_ARRAY_COUNT(gSizes); ++s) { A::SetAllocator(gSizes[s][0], gSizes[s][1]); for (size_t c = 0; c < SK_ARRAY_COUNT(gCreateFraction); ++c) { diff --git a/tests/InfRectTest.cpp b/tests/InfRectTest.cpp index 95ef4be3ef..4d957dcf75 100644 --- a/tests/InfRectTest.cpp +++ b/tests/InfRectTest.cpp @@ -35,7 +35,7 @@ static void test_center(skiatest::Reporter* reporter) { gData[index].fRect.centerY() == gData[index].fCenter.y()); } - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 10000; ++i) { SkIRect r; diff --git a/tests/LListTest.cpp b/tests/LListTest.cpp index 88fe11dd39..6b373e33ac 100644 --- a/tests/LListTest.cpp +++ b/tests/LListTest.cpp @@ -124,7 +124,7 @@ static void TestTInternalLList(skiatest::Reporter* reporter) { static void TestTLList(skiatest::Reporter* reporter) { typedef SkTLList<ListElement> ElList; typedef ElList::Iter Iter; - SkMWCRandom random; + SkRandom random; for (int i = 1; i <= 16; i *= 2) { diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp index 5ec91a9e5b..cb4d0b8bd2 100644 --- a/tests/MathTest.cpp +++ b/tests/MathTest.cpp @@ -19,7 +19,7 @@ static void test_clz(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, 1 == SkCLZ(1 << 30)); REPORTER_ASSERT(reporter, 0 == SkCLZ(~0U)); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 1000; ++i) { uint32_t mask = rand.nextU(); // need to get some zeros for testing, but in some obscure way so the @@ -82,7 +82,7 @@ static void test_muldivround(skiatest::Reporter* reporter) { } #endif - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 10000; ++i) { unsigned a = rand.nextU() & 0x7FFF; unsigned b = rand.nextU() & 0x7FFF; @@ -219,7 +219,7 @@ static void check_length(skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, len > 0.999f && len < 1.001f); } -static float nextFloat(SkMWCRandom& rand) { +static float nextFloat(SkRandom& rand) { SkFloatIntUnion data; data.fSignBitInt = rand.nextU(); return data.fFloat; @@ -293,7 +293,7 @@ static void test_int2float(skiatest::Reporter* reporter, int ival) { } static void unittest_fastfloat(skiatest::Reporter* reporter) { - SkMWCRandom rand; + SkRandom rand; size_t i; static const float gFloats[] = { @@ -414,7 +414,7 @@ static void test_copysign(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, sk_float_copysign(x, y) == expected); } - SkMWCRandom rand; + SkRandom rand; for (int j = 0; j < 1000; j++) { int ix = rand.nextS(); REPORTER_ASSERT(reporter, SkCopySign32(ix, ix) == ix); @@ -433,7 +433,7 @@ static void test_copysign(skiatest::Reporter* reporter) { static void TestMath(skiatest::Reporter* reporter) { int i; int32_t x; - SkMWCRandom rand; + SkRandom rand; // these should assert #if 0 diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp index 0f4973f94d..d75de758f8 100644 --- a/tests/MatrixTest.cpp +++ b/tests/MatrixTest.cpp @@ -169,7 +169,7 @@ static void test_matrix_max_stretch(skiatest::Reporter* reporter) { bool invertable = mats[i].invert(&mats[i + SK_ARRAY_COUNT(baseMats)]); REPORTER_ASSERT(reporter, invertable); } - SkMWCRandom rand; + SkRandom rand; for (int m = 0; m < 1000; ++m) { SkMatrix mat; mat.reset(); @@ -492,7 +492,7 @@ static void test_matrix_decomposition(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2)); // try some random matrices - SkMWCRandom rand; + SkRandom rand; for (int m = 0; m < 1000; ++m) { SkScalar rot0 = rand.nextRangeF(-180, 180); SkScalar sx = rand.nextRangeF(-3000.f, 3000.f); @@ -574,7 +574,7 @@ static void test_matrix_homogeneous(skiatest::Reporter* reporter) { const int kTripleCount = 1000; const int kMatrixCount = 1000; - SkMWCRandom rand; + SkRandom rand; SkScalar randTriples[3*kTripleCount]; for (int i = 0; i < 3*kTripleCount; ++i) { diff --git a/tests/MipMapTest.cpp b/tests/MipMapTest.cpp index 5862d086c7..398827367a 100644 --- a/tests/MipMapTest.cpp +++ b/tests/MipMapTest.cpp @@ -10,7 +10,7 @@ #include "SkBitmap.h" #include "SkRandom.h" -static void make_bitmap(SkBitmap* bm, SkMWCRandom& rand) { +static void make_bitmap(SkBitmap* bm, SkRandom& rand) { // for now, Build needs a min size of 2, otherwise it will return NULL. // should fix that to support 1 X N, where N > 1 to return non-null. int w = 2 + rand.nextU() % 1000; @@ -22,7 +22,7 @@ static void make_bitmap(SkBitmap* bm, SkMWCRandom& rand) { static void TestMipMap(skiatest::Reporter* reporter) { SkBitmap bm; - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 500; ++i) { make_bitmap(&bm, rand); diff --git a/tests/PackBitsTest.cpp b/tests/PackBitsTest.cpp index 59c8a8cab9..f7d4b8e6b1 100644 --- a/tests/PackBitsTest.cpp +++ b/tests/PackBitsTest.cpp @@ -14,7 +14,7 @@ static const uint16_t gTest2[] = { 0, 0, 0, 1, 2, 3, 3, 3 }; static const uint16_t gTest3[] = { 0, 0, 0, 0, 0, 0, 1, 2, 3, 3, 3, 0, 0, 1 }; #include "SkRandom.h" -static SkMWCRandom gRand; +static SkRandom gRand; static void rand_fill(uint16_t buffer[], int count) { for (int i = 0; i < count; i++) buffer[i] = (uint16_t)gRand.nextU(); diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp index c8d2becba2..045c2d22e4 100644 --- a/tests/PaintTest.cpp +++ b/tests/PaintTest.cpp @@ -71,7 +71,7 @@ static void test_cmap(skiatest::Reporter* reporter) { { uni_to_utf32, SkPaint::kUTF32_TextEncoding }, }; - SkMWCRandom rand; + SkRandom rand; SkPaint paint; paint.setTypeface(SkTypeface::RefDefault())->unref(); SkTypeface* face = paint.getTypeface(); diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index ed80d41aa2..080ce285e0 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -426,7 +426,7 @@ static void make_arb_round_rect(SkPath* path, const SkRect& r, // Note: PathBench::ArbRoundRectBench performs almost exactly // the same test (but with drawing) static void test_arb_round_rect_is_convex(skiatest::Reporter* reporter) { - SkMWCRandom rand; + SkRandom rand; SkRect r; for (int i = 0; i < 5000; ++i) { @@ -453,7 +453,7 @@ static void test_arb_round_rect_is_convex(skiatest::Reporter* reporter) { // Note: PathBench::ArbRoundRectBench performs almost exactly // the same test (but with drawing) static void test_arb_zero_rad_round_rect_is_rect(skiatest::Reporter* reporter) { - SkMWCRandom rand; + SkRandom rand; SkRect r; for (int i = 0; i < 5000; ++i) { @@ -592,7 +592,7 @@ DONE: static void test_addPoly(skiatest::Reporter* reporter) { SkPoint pts[32]; - SkMWCRandom rand; + SkRandom rand; for (size_t i = 0; i < SK_ARRAY_COUNT(pts); ++i) { pts[i].fX = rand.nextSScalar1(); @@ -2035,7 +2035,7 @@ static void test_raw_iter(skiatest::Reporter* reporter) { } // Max of 10 segments, max 3 points per segment - SkMWCRandom rand(9876543); + SkRandom rand(9876543); SkPoint expectedPts[31]; // May have leading moveTo SkPath::Verb expectedVerbs[22]; // May have leading moveTo SkPath::Verb nextVerb; diff --git a/tests/PathUtilsTest.cpp b/tests/PathUtilsTest.cpp index 15f981bb90..fad5cae0bb 100644 --- a/tests/PathUtilsTest.cpp +++ b/tests/PathUtilsTest.cpp @@ -17,7 +17,7 @@ const int kNumIt = 100; static void fill_random_bits(int chars, char* bits){ - SkMWCRandom rand(SkTime::GetMSecs()); + SkRandom rand(SkTime::GetMSecs()); for (int i = 0; i < chars; ++i){ bits[i] = rand.nextU(); diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp index 349560b21c..a42112de8d 100644 --- a/tests/PictureTest.cpp +++ b/tests/PictureTest.cpp @@ -75,7 +75,7 @@ static SkPicture* record_bitmaps(const SkBitmap bm[], const SkPoint pos[], return pic; } -static void rand_rect(SkRect* rect, SkMWCRandom& rand, SkScalar W, SkScalar H) { +static void rand_rect(SkRect* rect, SkRandom& rand, SkScalar W, SkScalar H) { rect->fLeft = rand.nextRangeScalar(-W, 2*W); rect->fTop = rand.nextRangeScalar(-H, 2*H); rect->fRight = rect->fLeft + rand.nextRangeScalar(0, W); @@ -178,7 +178,7 @@ static void test_gatherpixelrefs(skiatest::Reporter* reporter) { drawbitmap_proc, drawbitmaprect_proc, drawshader_proc }; - SkMWCRandom rand; + SkRandom rand; for (size_t k = 0; k < SK_ARRAY_COUNT(procs); ++k) { SkAutoTUnref<SkPicture> pic(record_bitmaps(bm, pos, N, procs[k])); @@ -263,7 +263,7 @@ static void test_serializing_empty_picture() { } #endif -static void rand_op(SkCanvas* canvas, SkMWCRandom& rand) { +static void rand_op(SkCanvas* canvas, SkRandom& rand) { SkPaint paint; SkRect rect = SkRect::MakeWH(50, 50); @@ -284,10 +284,10 @@ static void rand_op(SkCanvas* canvas, SkMWCRandom& rand) { } static void test_peephole() { - SkMWCRandom rand; + SkRandom rand; for (int j = 0; j < 100; j++) { - SkMWCRandom rand2(rand); // remember the seed + SkRandom rand2(rand); // remember the seed SkPicture picture; SkCanvas* canvas = picture.beginRecording(100, 100); diff --git a/tests/RTreeTest.cpp b/tests/RTreeTest.cpp index 666750b531..a907d6d588 100644 --- a/tests/RTreeTest.cpp +++ b/tests/RTreeTest.cpp @@ -23,7 +23,7 @@ struct DataRect { void* data; }; -static SkIRect random_rect(SkMWCRandom& rand) { +static SkIRect random_rect(SkRandom& rand) { SkIRect rect = {0,0,0,0}; while (rect.isEmpty()) { rect.fLeft = rand.nextS() % 1000; @@ -35,7 +35,7 @@ static SkIRect random_rect(SkMWCRandom& rand) { return rect; } -static void random_data_rects(SkMWCRandom& rand, DataRect out[], int n) { +static void random_data_rects(SkRandom& rand, DataRect out[], int n) { for (int i = 0; i < n; ++i) { out[i].rect = random_rect(rand); out[i].data = reinterpret_cast<void*>(i); @@ -68,7 +68,7 @@ static bool verify_query(SkIRect query, DataRect rects[], return found == expected; } -static void run_queries(skiatest::Reporter* reporter, SkMWCRandom& rand, DataRect rects[], +static void run_queries(skiatest::Reporter* reporter, SkRandom& rand, DataRect rects[], SkRTree& tree) { for (size_t i = 0; i < NUM_QUERIES; ++i) { SkTDArray<void*> hits; @@ -80,7 +80,7 @@ static void run_queries(skiatest::Reporter* reporter, SkMWCRandom& rand, DataRec static void rtree_test_main(SkRTree* rtree, skiatest::Reporter* reporter) { DataRect rects[NUM_RECTS]; - SkMWCRandom rand; + SkRandom rand; REPORTER_ASSERT(reporter, NULL != rtree); int expectedDepthMin = -1; diff --git a/tests/RandomTest.cpp b/tests/RandomTest.cpp index 51408e9605..c9fee4aa23 100644 --- a/tests/RandomTest.cpp +++ b/tests/RandomTest.cpp @@ -61,7 +61,7 @@ static void test_random_byte(skiatest::Reporter* reporter, int shift) { int bins[256]; memset(bins, 0, sizeof(int)*256); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 256*10000; ++i) { bins[(rand.nextU() >> shift) & 0xff]++; } @@ -73,7 +73,7 @@ static void test_random_float(skiatest::Reporter* reporter) { int bins[256]; memset(bins, 0, sizeof(int)*256); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 256*10000; ++i) { float f = rand.nextF(); REPORTER_ASSERT(reporter, 0.0f <= f && f < 1.0f); @@ -108,7 +108,7 @@ static double test_single_gorilla(skiatest::Reporter* reporter, int shift) { const int kNumEntries = kN >> 5; // dividing by 32 unsigned int entries[kNumEntries]; - SkMWCRandom rand; + SkRandom rand; memset(entries, 0, sizeof(unsigned int)*kNumEntries); // pre-seed our string value int value = 0; @@ -161,7 +161,7 @@ static void test_gorilla(skiatest::Reporter* reporter) { } static void test_range(skiatest::Reporter* reporter) { - SkMWCRandom rand; + SkRandom rand; // just to make sure we don't crash in this case (void) rand.nextRangeU(0, 0xffffffff); diff --git a/tests/RegionTest.cpp b/tests/RegionTest.cpp index 1c06d7ecde..5d3946ebfe 100644 --- a/tests/RegionTest.cpp +++ b/tests/RegionTest.cpp @@ -98,7 +98,7 @@ enum { H = 256 }; -static SkIRect randRect(SkMWCRandom& rand) { +static SkIRect randRect(SkRandom& rand) { int x = rand.nextU() % W; int y = rand.nextU() % H; int w = rand.nextU() % W; @@ -106,7 +106,7 @@ static SkIRect randRect(SkMWCRandom& rand) { return SkIRect::MakeXYWH(x, y, w >> 1, h >> 1); } -static void randRgn(SkMWCRandom& rand, SkRegion* rgn, int n) { +static void randRgn(SkRandom& rand, SkRegion* rgn, int n) { rgn->setEmpty(); for (int i = 0; i < n; ++i) { rgn->op(randRect(rand), SkRegion::kUnion_Op); @@ -183,7 +183,7 @@ static void intersects_proc(skiatest::Reporter* reporter, static void test_proc(skiatest::Reporter* reporter, void (*proc)(skiatest::Reporter*, const SkRegion& a, const SkRegion&)) { - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 10000; ++i) { SkRegion outer; randRgn(rand, &outer, 8); @@ -193,7 +193,7 @@ static void test_proc(skiatest::Reporter* reporter, } } -static void rand_rect(SkIRect* rect, SkMWCRandom& rand) { +static void rand_rect(SkIRect* rect, SkRandom& rand) { int bits = 6; int shift = 32 - bits; rect->set(rand.nextU() >> shift, rand.nextU() >> shift, @@ -237,7 +237,7 @@ static void TestRegion(skiatest::Reporter* reporter) { }; REPORTER_ASSERT(reporter, test_rects(rects, SK_ARRAY_COUNT(rects))); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 1000; i++) { SkRegion rgn0, rgn1; diff --git a/tests/Sk64Test.cpp b/tests/Sk64Test.cpp index e956cbbd51..50b7ec7d2f 100644 --- a/tests/Sk64Test.cpp +++ b/tests/Sk64Test.cpp @@ -75,7 +75,7 @@ static void TestSk64(skiatest::Reporter* reporter) { // Now test add/sub - SkMWCRandom rand; + SkRandom rand; int i; for (i = 0; i < 1000; i++) diff --git a/tests/SortTest.cpp b/tests/SortTest.cpp index 6bfb300a72..28c6e682de 100644 --- a/tests/SortTest.cpp +++ b/tests/SortTest.cpp @@ -15,7 +15,7 @@ extern "C" { } } -static void rand_array(SkMWCRandom& rand, int array[], int n) { +static void rand_array(SkRandom& rand, int array[], int n) { for (int j = 0; j < n; j++) { array[j] = rand.nextS() & 0xFF; } @@ -40,7 +40,7 @@ static void TestSort(skiatest::Reporter* reporter) { /** The random numbers are copied into this array, sorted by an SkSort, then this array is compared against the reference sort. */ int workingArray[SK_ARRAY_COUNT(randomArray)]; - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 10000; i++) { int count = rand.nextRangeU(1, SK_ARRAY_COUNT(randomArray)); diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp index 33d5c97112..cb0668ed09 100644 --- a/tests/UtilsTest.cpp +++ b/tests/UtilsTest.cpp @@ -123,7 +123,7 @@ static void test_autostarray(skiatest::Reporter* reporter) { static void test_search(skiatest::Reporter* reporter) { int i, array[kSEARCH_COUNT]; - SkMWCRandom rand; + SkRandom rand; for (i = 0; i < kSEARCH_COUNT; i++) { array[i] = rand.nextS(); diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp index fd232fc4d0..8b4aba5ec3 100644 --- a/tests/Writer32Test.cpp +++ b/tests/Writer32Test.cpp @@ -153,7 +153,7 @@ static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) { SkAutoMalloc originalData(dataSize); { - SkMWCRandom rand(0); + SkRandom rand(0); uint32_t* ptr = static_cast<uint32_t*>(originalData.get()); uint32_t* stop = ptr + (dataSize>>2); while (ptr < stop) { |