From e0e7cfe44bb9d66d76120a79e5275c294bacaa22 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Mon, 9 Sep 2013 20:09:12 +0000 Subject: 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 --- bench/RTreeBench.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'bench/RTreeBench.cpp') 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(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(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 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; -- cgit v1.2.3