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
This commit is contained in:
commit-bot@chromium.org 2013-09-09 20:09:12 +00:00
parent 50b2e33dc6
commit e0e7cfe44b
129 changed files with 259 additions and 259 deletions

View File

@ -94,7 +94,7 @@ class NestedAAClipBench : public SkBenchmark {
SkString fName; SkString fName;
bool fDoAA; bool fDoAA;
SkRect fDrawRect; SkRect fDrawRect;
SkMWCRandom fRandom; SkRandom fRandom;
static const int kNumDraws = SkBENCHLOOP(2); static const int kNumDraws = SkBENCHLOOP(2);
static const int kNestingDepth = 3; static const int kNestingDepth = 3;

View File

@ -37,7 +37,7 @@ protected:
paint.setAntiAlias(true); paint.setAntiAlias(true);
SkMWCRandom rand; SkRandom rand;
SkRect r = SkRect::MakeWH(40, 40); SkRect r = SkRect::MakeWH(40, 40);
SkAutoTUnref<SkImageFilter> bicubic(SkBicubicImageFilter::CreateMitchell(fScale)); SkAutoTUnref<SkImageFilter> bicubic(SkBicubicImageFilter::CreateMitchell(fScale));
paint.setImageFilter(bicubic); paint.setImageFilter(bicubic);

View File

@ -137,7 +137,7 @@ protected:
virtual void onDraw(SkCanvas* canvas) { virtual void onDraw(SkCanvas* canvas) {
SkIPoint dim = this->getSize(); SkIPoint dim = this->getSize();
SkMWCRandom rand; SkRandom rand;
SkPaint paint(fPaint); SkPaint paint(fPaint);
this->setupPaint(&paint); this->setupPaint(&paint);

View File

@ -86,7 +86,7 @@ protected:
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
SkMWCRandom rand; SkRandom rand;
SkPaint paint; SkPaint paint;
this->setupPaint(&paint); this->setupPaint(&paint);

View File

@ -59,7 +59,7 @@ protected:
paint.setAntiAlias(true); paint.setAntiAlias(true);
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < SkBENCHLOOP(10); i++) { for (int i = 0; i < SkBENCHLOOP(10); i++) {
SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400, SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400,
rand.nextUScalar1() * 400); rand.nextUScalar1() * 400);

View File

@ -21,7 +21,7 @@ namespace {
// Generates y values for the chart plots. // Generates y values for the chart plots.
void gen_data(SkScalar yAvg, SkScalar ySpread, int count, SkTDArray<SkScalar>* dataPts) { void gen_data(SkScalar yAvg, SkScalar ySpread, int count, SkTDArray<SkScalar>* dataPts) {
dataPts->setCount(count); dataPts->setCount(count);
static SkMWCRandom gRandom; static SkRandom gRandom;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
(*dataPts)[i] = gRandom.nextRangeScalar(yAvg - SkScalarHalf(ySpread), (*dataPts)[i] = gRandom.nextRangeScalar(yAvg - SkScalarHalf(ySpread),
yAvg + SkScalarHalf(ySpread)); yAvg + SkScalarHalf(ySpread));
@ -131,7 +131,7 @@ protected:
canvas->clear(0xFFE0F0E0); canvas->clear(0xFFE0F0E0);
static SkMWCRandom colorRand; static SkRandom colorRand;
static SkColor gColors[kNumGraphs] = { 0x0 }; static SkColor gColors[kNumGraphs] = { 0x0 };
if (0 == gColors[0]) { if (0 == gColors[0]) {
for (int i = 0; i < kNumGraphs; ++i) { for (int i = 0; i < kNumGraphs; ++i) {

View File

@ -30,7 +30,7 @@ class ComputeChecksumBench : public SkBenchmark {
public: public:
ComputeChecksumBench(void* param, ChecksumType type) : INHERITED(param), fType(type) { ComputeChecksumBench(void* param, ChecksumType type) : INHERITED(param), fType(type) {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < U32COUNT; ++i) { for (int i = 0; i < U32COUNT; ++i) {
fData[i] = rand.nextU(); fData[i] = rand.nextU();
} }

View File

@ -27,7 +27,7 @@ protected:
virtual void onPreDraw() SK_OVERRIDE { virtual void onPreDraw() SK_OVERRIDE {
if (!fInit) { if (!fInit) {
SkMWCRandom rand; SkRandom rand;
static const SkScalar kMinOffset = 0; static const SkScalar kMinOffset = 0;
static const SkScalar kMaxOffset = 100 * SK_Scalar1; static const SkScalar kMaxOffset = 100 * SK_Scalar1;
static const SkScalar kOffsetRange = kMaxOffset - kMinOffset; static const SkScalar kOffsetRange = kMaxOffset - kMinOffset;

View File

@ -88,9 +88,9 @@ protected:
} }
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
SkMWCRandom scaleRand; SkRandom scaleRand;
SkMWCRandom transRand; SkRandom transRand;
SkMWCRandom rotRand; SkRandom rotRand;
int width, height; int width, height;
if (fUseAtlas) { if (fUseAtlas) {
@ -280,7 +280,7 @@ private:
// Note: the resulting atlas has transparency // Note: the resulting atlas has transparency
void makeAtlas() { void makeAtlas() {
SkMWCRandom rand; SkRandom rand;
SkColor colors[kNumAtlasedX][kNumAtlasedY]; SkColor colors[kNumAtlasedX][kNumAtlasedY];

View File

@ -47,7 +47,7 @@ protected:
} }
virtual void onDraw(SkCanvas*) { virtual void onDraw(SkCanvas*) {
SkMWCRandom r; SkRandom r;
enum { enum {
kMaxObjects = 4 * (1 << 10), kMaxObjects = 4 * (1 << 10),
}; };
@ -103,7 +103,7 @@ protected:
} }
virtual void onDraw(SkCanvas*) { virtual void onDraw(SkCanvas*) {
SkMWCRandom r; SkRandom r;
enum { enum {
kMaxObjects = 4 * (1 << 10), kMaxObjects = 4 * (1 << 10),
}; };
@ -141,7 +141,7 @@ protected:
} }
virtual void onDraw(SkCanvas*) { virtual void onDraw(SkCanvas*) {
SkMWCRandom r; SkRandom r;
A* objects[M]; A* objects[M];
for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) {
uint32_t count = r.nextRangeU(0, M-1); uint32_t count = r.nextRangeU(0, M-1);

View File

@ -85,7 +85,7 @@ public:
name->append("line"); name->append("line");
} }
virtual void makePath(SkPath* path) SK_OVERRIDE { virtual void makePath(SkPath* path) SK_OVERRIDE {
SkMWCRandom rand; SkRandom rand;
int size = SK_ARRAY_COUNT(points); int size = SK_ARRAY_COUNT(points);
int hSize = size / 2; int hSize = size / 2;
for (int i = 0; i < kMaxPathSize; ++i) { for (int i = 0; i < kMaxPathSize; ++i) {
@ -117,7 +117,7 @@ public:
name->append("quad"); name->append("quad");
} }
virtual void makePath(SkPath* path) SK_OVERRIDE { virtual void makePath(SkPath* path) SK_OVERRIDE {
SkMWCRandom rand; SkRandom rand;
int size = SK_ARRAY_COUNT(points); int size = SK_ARRAY_COUNT(points);
int hSize = size / 2; int hSize = size / 2;
for (int i = 0; i < kMaxPathSize; ++i) { for (int i = 0; i < kMaxPathSize; ++i) {
@ -149,8 +149,8 @@ public:
name->append("conic"); name->append("conic");
} }
virtual void makePath(SkPath* path) SK_OVERRIDE { virtual void makePath(SkPath* path) SK_OVERRIDE {
SkMWCRandom rand; SkRandom rand;
SkMWCRandom randWeight; SkRandom randWeight;
int size = SK_ARRAY_COUNT(points); int size = SK_ARRAY_COUNT(points);
int hSize = size / 2; int hSize = size / 2;
for (int i = 0; i < kMaxPathSize; ++i) { for (int i = 0; i < kMaxPathSize; ++i) {
@ -184,7 +184,7 @@ public:
name->append("cubic"); name->append("cubic");
} }
virtual void makePath(SkPath* path) SK_OVERRIDE { virtual void makePath(SkPath* path) SK_OVERRIDE {
SkMWCRandom rand; SkRandom rand;
int size = SK_ARRAY_COUNT(points); int size = SK_ARRAY_COUNT(points);
int hSize = size / 2; int hSize = size / 2;
for (int i = 0; i < kMaxPathSize; ++i) { for (int i = 0; i < kMaxPathSize; ++i) {

View File

@ -32,7 +32,7 @@ public:
fDoAA = doAA; fDoAA = doAA;
fName.printf("lines_%g_%s", width, doAA ? "AA" : "BW"); fName.printf("lines_%g_%s", width, doAA ? "AA" : "BW");
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < PTS; ++i) { for (int i = 0; i < PTS; ++i) {
fPts[i].set(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480); fPts[i].set(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480);
} }

View File

@ -26,7 +26,7 @@ public:
MathBench(void* param, const char name[]) : INHERITED(param) { MathBench(void* param, const char name[]) : INHERITED(param) {
fName.printf("math_%s", name); fName.printf("math_%s", name);
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < kBuffer; ++i) { for (int i = 0; i < kBuffer; ++i) {
fSrc[i] = rand.nextSScalar1(); fSrc[i] = rand.nextSScalar1();
} }
@ -254,7 +254,7 @@ class IsFiniteBench : public SkBenchmark {
public: public:
IsFiniteBench(void* param, int index) : INHERITED(param) { IsFiniteBench(void* param, int index) : INHERITED(param) {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < N; ++i) { for (int i = 0; i < N; ++i) {
fData[i] = rand.nextSScalar1(); fData[i] = rand.nextSScalar1();
@ -322,7 +322,7 @@ class FloorBench : public SkBenchmark {
public: public:
FloorBench(void* param, bool fast) : INHERITED(param), fFast(fast) { FloorBench(void* param, bool fast) : INHERITED(param), fFast(fast) {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < ARRAY; ++i) { for (int i = 0; i < ARRAY; ++i) {
fData[i] = rand.nextSScalar1(); fData[i] = rand.nextSScalar1();
@ -340,7 +340,7 @@ public:
protected: protected:
virtual void onDraw(SkCanvas*) { virtual void onDraw(SkCanvas*) {
SkMWCRandom rand; SkRandom rand;
float accum = 0; float accum = 0;
const float* data = fData; const float* data = fData;
@ -384,7 +384,7 @@ public:
: INHERITED(param) : INHERITED(param)
, fUsePortable(usePortable) { , fUsePortable(usePortable) {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < ARRAY; ++i) { for (int i = 0; i < ARRAY; ++i) {
fData[i] = rand.nextU(); fData[i] = rand.nextU();
} }
@ -444,7 +444,7 @@ public:
NormalizeBench(void* param) NormalizeBench(void* param)
: INHERITED(param) { : INHERITED(param) {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < ARRAY; ++i) { for (int i = 0; i < ARRAY; ++i) {
fVec[i].set(rand.nextSScalar1(), rand.nextSScalar1()); fVec[i].set(rand.nextSScalar1(), rand.nextSScalar1());
} }
@ -490,7 +490,7 @@ class FixedMathBench : public SkBenchmark {
public: public:
FixedMathBench(void* param) : INHERITED(param) { FixedMathBench(void* param) : INHERITED(param) {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < N; ++i) { for (int i = 0; i < N; ++i) {
fData[i] = rand.nextSScalar1(); fData[i] = rand.nextSScalar1();
} }

View File

@ -95,7 +95,7 @@ private:
// handling NaN values is a lot slower. Anyway, this guy is just meant to put // handling NaN values is a lot slower. Anyway, this guy is just meant to put
// reasonable values in our arrays. // reasonable values in our arrays.
template <typename T> void init9(T array[9]) { template <typename T> void init9(T array[9]) {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
array[i] = rand.nextSScalar1(); array[i] = rand.nextSScalar1();
} }
@ -261,7 +261,7 @@ protected:
private: private:
SkMatrix fMatrix; SkMatrix fMatrix;
float fArray[9]; float fArray[9];
SkMWCRandom fRnd; SkRandom fRnd;
typedef MatrixBench INHERITED; typedef MatrixBench INHERITED;
}; };
@ -302,7 +302,7 @@ class ScaleTransMixedMatrixBench : public MatrixBench {
SkMatrix fMatrix; SkMatrix fMatrix;
SkPoint fSrc [16]; SkPoint fSrc [16];
SkPoint fDst [16]; SkPoint fDst [16];
SkMWCRandom fRandom; SkRandom fRandom;
typedef MatrixBench INHERITED; typedef MatrixBench INHERITED;
}; };
@ -342,7 +342,7 @@ class ScaleTransDoubleMatrixBench : public MatrixBench {
double fMatrix [9]; double fMatrix [9];
SkPoint fSrc [16]; SkPoint fSrc [16];
SkPoint fDst [16]; SkPoint fDst [16];
SkMWCRandom fRandom; SkRandom fRandom;
typedef MatrixBench INHERITED; typedef MatrixBench INHERITED;
}; };
@ -370,7 +370,7 @@ protected:
} }
private: private:
SkMatrix fMatrix[10]; SkMatrix fMatrix[10];
SkMWCRandom fRandom; SkRandom fRandom;
typedef MatrixBench INHERITED; typedef MatrixBench INHERITED;
}; };

View File

@ -39,7 +39,7 @@ protected:
SkPaint paint; SkPaint paint;
this->setupPaint(&paint); this->setupPaint(&paint);
paint.setAntiAlias(true); paint.setAntiAlias(true);
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < SkBENCHLOOP(3); i++) { for (int i = 0; i < SkBENCHLOOP(3); i++) {
SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400, SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400,
rand.nextUScalar1() * 400); rand.nextUScalar1() * 400);

View File

@ -59,7 +59,7 @@ protected:
paint.setAntiAlias(true); paint.setAntiAlias(true);
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < SkBENCHLOOP(3); i++) { for (int i = 0; i < SkBENCHLOOP(3); i++) {
SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400, SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400,
rand.nextUScalar1() * 400); rand.nextUScalar1() * 400);

View File

@ -183,7 +183,7 @@ public:
name->append("long_curved"); name->append("long_curved");
} }
virtual void makePath(SkPath* path) SK_OVERRIDE { virtual void makePath(SkPath* path) SK_OVERRIDE {
SkMWCRandom rand (12); SkRandom rand (12);
int i; int i;
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
path->quadTo(SkScalarMul(rand.nextUScalar1(), SkIntToScalar(640)), path->quadTo(SkScalarMul(rand.nextUScalar1(), SkIntToScalar(640)),
@ -208,7 +208,7 @@ public:
name->append("long_line"); name->append("long_line");
} }
virtual void makePath(SkPath* path) SK_OVERRIDE { virtual void makePath(SkPath* path) SK_OVERRIDE {
SkMWCRandom rand; SkRandom rand;
path->moveTo(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480); path->moveTo(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480);
for (size_t i = 1; i < 100; i++) { for (size_t i = 1; i < 100; i++) {
path->lineTo(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480); path->lineTo(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480);
@ -316,7 +316,7 @@ private:
int fCurrPath; int fCurrPath;
int fCurrVerb; int fCurrVerb;
int fCurrPoint; int fCurrPoint;
SkMWCRandom fRandom; SkRandom fRandom;
typedef SkBenchmark INHERITED; typedef SkBenchmark INHERITED;
}; };
@ -653,7 +653,7 @@ protected:
paint.setStyle(SkPaint::kStroke_Style); paint.setStyle(SkPaint::kStroke_Style);
} }
SkMWCRandom rand; SkRandom rand;
SkRect r; SkRect r;
@ -754,7 +754,7 @@ protected:
} }
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
SkMWCRandom rand; SkRandom rand;
SkRect r; SkRect r;
for (int i = 0; i < 5000; ++i) { for (int i = 0; i < 5000; ++i) {
@ -834,7 +834,7 @@ private:
virtual void onPreDraw() SK_OVERRIDE { virtual void onPreDraw() SK_OVERRIDE {
fQueryRects.setCount(kQueryRectCnt); fQueryRects.setCount(kQueryRectCnt);
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < kQueryRectCnt; ++i) { for (int i = 0; i < kQueryRectCnt; ++i) {
SkSize size; SkSize size;
SkPoint xy; 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) { for (int i = 0; i < 3; ++i) {
conic->fPts[i].set(rand.nextUScalar1() * 100, rand.nextUScalar1() * 100); 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 { class ConicBench : public SkBenchmark {
public: public:
ConicBench(void* param) : INHERITED(param) { ConicBench(void* param) : INHERITED(param) {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < CONICS; ++i) { for (int i = 0; i < CONICS; ++i) {
rand_conic(&fConics[i], rand); rand_conic(&fConics[i], rand);
} }

View File

@ -14,7 +14,7 @@
#include "SkShader.h" #include "SkShader.h"
#include "SkString.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; int n = rand.nextU() & 3;
n += 1; n += 1;
@ -37,7 +37,7 @@ public:
fName.printf("pathiter_%s", raw ? "raw" : "consume"); fName.printf("pathiter_%s", raw ? "raw" : "consume");
fRaw = raw; fRaw = raw;
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < 1000; ++i) { for (int i = 0; i < 1000; ++i) {
SkPoint pts[4]; SkPoint pts[4];
int n = rand_pts(rand, pts); int n = rand_pts(rand, pts);

View File

@ -18,7 +18,7 @@
//this function is redefined for sample, test, and bench. is there anywhere //this function is redefined for sample, test, and bench. is there anywhere
// I can put it to avoid code duplcation? // I can put it to avoid code duplcation?
static void fillRandomBits( int chars, char* bits ){ static void fillRandomBits( int chars, char* bits ){
SkMWCRandom rand(SkTime::GetMSecs()); SkRandom rand(SkTime::GetMSecs());
for (int i = 0; i < chars; ++i){ for (int i = 0; i < chars; ++i){
bits[i] = rand.nextU(); bits[i] = rand.nextU();

View File

@ -143,7 +143,7 @@ public:
protected: protected:
virtual float innerLoopScale() const SK_OVERRIDE { return 0.1f; } virtual float innerLoopScale() const SK_OVERRIDE { return 0.1f; }
virtual void recordCanvas(SkCanvas* canvas) { virtual void recordCanvas(SkCanvas* canvas) {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < M; i++) { for (int i = 0; i < M; i++) {
SkPaint paint; SkPaint paint;
paint.setColor(rand.nextU()); paint.setColor(rand.nextU());
@ -167,7 +167,7 @@ class RecurringPaintDictionaryRecordBench : public PictureRecordBench {
public: public:
RecurringPaintDictionaryRecordBench(void* param) RecurringPaintDictionaryRecordBench(void* param)
: INHERITED(param, "recurring_paint_dictionary") { : INHERITED(param, "recurring_paint_dictionary") {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < ObjCount; i++) { for (int i = 0; i < ObjCount; i++) {
fPaint[i].setColor(rand.nextU()); fPaint[i].setColor(rand.nextU());
} }

View File

@ -19,7 +19,7 @@ static const int NUM_QUERY_RECTS = 5000;
static const int NUM_QUERIES = 1000; static const int NUM_QUERIES = 1000;
static const int GRID_WIDTH = 100; 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 // Time how long it takes to build an R-Tree either bulk-loaded or not
class BBoxBuildBench : public SkBenchmark { class BBoxBuildBench : public SkBenchmark {
@ -46,7 +46,7 @@ protected:
return fName.c_str(); return fName.c_str();
} }
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < SkBENCHLOOP(100); ++i) { for (int i = 0; i < SkBENCHLOOP(100); ++i) {
for (int j = 0; j < NUM_BUILD_RECTS; ++j) { for (int j = 0; j < NUM_BUILD_RECTS; ++j) {
fTree->insert(reinterpret_cast<void*>(j), fProc(rand, j, NUM_BUILD_RECTS), fTree->insert(reinterpret_cast<void*>(j), fProc(rand, j, NUM_BUILD_RECTS),
@ -97,7 +97,7 @@ protected:
return fName.c_str(); return fName.c_str();
} }
virtual void onPreDraw() SK_OVERRIDE { virtual void onPreDraw() SK_OVERRIDE {
SkMWCRandom rand; SkRandom rand;
for (int j = 0; j < SkBENCHLOOP(NUM_QUERY_RECTS); ++j) { for (int j = 0; j < SkBENCHLOOP(NUM_QUERY_RECTS); ++j) {
fTree->insert(reinterpret_cast<void*>(j), fProc(rand, j, fTree->insert(reinterpret_cast<void*>(j), fProc(rand, j,
SkBENCHLOOP(NUM_QUERY_RECTS)), fBulkLoad); SkBENCHLOOP(NUM_QUERY_RECTS)), fBulkLoad);
@ -106,7 +106,7 @@ protected:
} }
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < SkBENCHLOOP(NUM_QUERIES); ++i) { for (int i = 0; i < SkBENCHLOOP(NUM_QUERIES); ++i) {
SkTDArray<void*> hits; SkTDArray<void*> hits;
SkIRect query; SkIRect query;
@ -149,22 +149,22 @@ private:
typedef SkBenchmark INHERITED; 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}; SkIRect out = {0, 0, GENERATE_EXTENTS, GENERATE_EXTENTS};
return out; 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}; SkIRect out = {0, 0, index + 1, index + 1};
return out; 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}; SkIRect out = {0, 0, numRects - index, numRects - index};
return out; 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; SkIRect out;
out.fLeft = index % GRID_WIDTH; out.fLeft = index % GRID_WIDTH;
out.fTop = 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); out.fBottom = out.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 3);
return out; 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; SkIRect out;
out.fLeft = index / GRID_WIDTH; out.fLeft = index / GRID_WIDTH;
out.fTop = 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; 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; SkIRect out;
out.fLeft = rand.nextU() % GENERATE_EXTENTS; out.fLeft = rand.nextU() % GENERATE_EXTENTS;
out.fTop = 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; 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; SkIRect out;
out.fLeft = rand.nextS() % GENERATE_EXTENTS; out.fLeft = rand.nextS() % GENERATE_EXTENTS;
out.fTop = 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; 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; SkIRect out;
out.fLeft = rand.nextU() % GENERATE_EXTENTS; out.fLeft = rand.nextU() % GENERATE_EXTENTS;
out.fTop = rand.nextU() % GENERATE_EXTENTS; out.fTop = rand.nextU() % GENERATE_EXTENTS;

View File

@ -27,7 +27,7 @@ public:
: INHERITED(param) : INHERITED(param)
, fShift(shift) , fShift(shift)
, fStroke(stroke) { , fStroke(stroke) {
SkMWCRandom rand; SkRandom rand;
const SkScalar offset = SK_Scalar1/3; const SkScalar offset = SK_Scalar1/3;
for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) {
int x = rand.nextU() % W; int x = rand.nextU() % W;
@ -246,7 +246,7 @@ protected:
gSizes[0] = this->getStrokeWidth(); gSizes[0] = this->getStrokeWidth();
sizes = 1; sizes = 1;
} }
SkMWCRandom rand; SkRandom rand;
SkColor color = 0xFF000000; SkColor color = 0xFF000000;
U8CPU alpha = 0xFF; U8CPU alpha = 0xFF;
SkPaint paint; SkPaint paint;

View File

@ -25,7 +25,7 @@ protected:
} }
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
SkMWCRandom Random; SkRandom Random;
for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) {
SkScalar blurSigma = Random.nextRangeScalar(1.5f, 25.0f); SkScalar blurSigma = Random.nextRangeScalar(1.5f, 25.0f);

View File

@ -82,7 +82,7 @@ public:
N = SkBENCHLOOP(2000) N = SkBENCHLOOP(2000)
}; };
SkIRect randrect(SkMWCRandom& rand) { SkIRect randrect(SkRandom& rand) {
int x = rand.nextU() % W; int x = rand.nextU() % W;
int y = rand.nextU() % H; int y = rand.nextU() % H;
int w = rand.nextU() % W; int w = rand.nextU() % W;
@ -95,7 +95,7 @@ public:
fName.printf("region_%s_%d", name, count); fName.printf("region_%s_%d", name, count);
fLoopMul = mul; fLoopMul = mul;
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
fA.op(randrect(rand), SkRegion::kXOR_Op); fA.op(randrect(rand), SkRegion::kXOR_Op);
fB.op(randrect(rand), SkRegion::kXOR_Op); fB.op(randrect(rand), SkRegion::kXOR_Op);

View File

@ -29,7 +29,7 @@ public:
N = SkBENCHLOOP(20000) N = SkBENCHLOOP(20000)
}; };
SkIRect randrect(SkMWCRandom& rand, int i) { SkIRect randrect(SkRandom& rand, int i) {
int w = rand.nextU() % W; int w = rand.nextU() % W;
return SkIRect::MakeXYWH(0, i*H/COUNT, w, H/COUNT); return SkIRect::MakeXYWH(0, i*H/COUNT, w, H/COUNT);
} }
@ -38,7 +38,7 @@ public:
fProc = proc; fProc = proc;
fName.printf("region_contains_%s", name); fName.printf("region_contains_%s", name);
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < COUNT; i++) { for (int i = 0; i < COUNT; i++) {
fA.op(randrect(rand, i), SkRegion::kXOR_Op); fA.op(randrect(rand, i), SkRegion::kXOR_Op);
} }

View File

@ -56,7 +56,7 @@ int gScalarBench_NonStaticGlobal;
// handling NaN values is a lot slower. Anyway, this guy is just meant to put // handling NaN values is a lot slower. Anyway, this guy is just meant to put
// reasonable values in our arrays. // reasonable values in our arrays.
template <typename T> void init9(T array[9]) { template <typename T> void init9(T array[9]) {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
array[i] = rand.nextSScalar1(); array[i] = rand.nextSScalar1();
} }
@ -102,7 +102,7 @@ private:
class IsFiniteScalarBench : public ScalarBench { class IsFiniteScalarBench : public ScalarBench {
public: public:
IsFiniteScalarBench(void* param) : INHERITED(param, "isfinite") { IsFiniteScalarBench(void* param) : INHERITED(param, "isfinite") {
SkMWCRandom rand; SkRandom rand;
for (size_t i = 0; i < ARRAY_N; ++i) { for (size_t i = 0; i < ARRAY_N; ++i) {
fArray[i] = rand.nextSScalar1(); fArray[i] = rand.nextSScalar1();
} }
@ -141,7 +141,7 @@ class RectBoundsBench : public SkBenchmark {
public: public:
RectBoundsBench(void* param) : INHERITED(param) { RectBoundsBench(void* param) : INHERITED(param) {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < PTS; ++i) { for (int i = 0; i < PTS; ++i) {
fPts[i].fX = rand.nextSScalar1(); fPts[i].fX = rand.nextSScalar1();
fPts[i].fY = rand.nextSScalar1(); fPts[i].fY = rand.nextSScalar1();

View File

@ -59,7 +59,7 @@ protected:
virtual void onDraw(SkCanvas* canvas) { virtual void onDraw(SkCanvas* canvas) {
const SkIPoint dim = this->getSize(); const SkIPoint dim = this->getSize();
SkMWCRandom rand; SkRandom rand;
SkPaint paint(fPaint); SkPaint paint(fPaint);
this->setupPaint(&paint); this->setupPaint(&paint);

View File

@ -13,14 +13,14 @@
static const int N = 1000; static const int N = 1000;
static void rand_proc(int array[], int count) { static void rand_proc(int array[], int count) {
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
array[i] = rand.nextS(); array[i] = rand.nextS();
} }
} }
static void randN_proc(int array[], int count) { static void randN_proc(int array[], int count) {
SkMWCRandom rand; SkRandom rand;
int mod = N / 10; int mod = N / 10;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
array[i] = rand.nextU() % mod; array[i] = rand.nextU() % mod;

View File

@ -94,7 +94,7 @@ protected:
virtual void onDraw(SkCanvas* canvas) { virtual void onDraw(SkCanvas* canvas) {
const SkIPoint dim = this->getSize(); const SkIPoint dim = this->getSize();
SkMWCRandom rand; SkRandom rand;
SkPaint paint(fPaint); SkPaint paint(fPaint);
this->setupPaint(&paint); this->setupPaint(&paint);

View File

@ -68,7 +68,7 @@ public:
SkASSERT(PTS == pts - fPts); SkASSERT(PTS == pts - fPts);
SkASSERT(IDX == idx - fIdx); SkASSERT(IDX == idx - fIdx);
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < PTS; ++i) { for (int i = 0; i < PTS; ++i) {
fColors[i] = rand.nextU() | (0xFF << 24); fColors[i] = rand.nextU() | (0xFF << 24);
} }

View File

@ -35,7 +35,7 @@ protected:
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
SkISize size = canvas->getDeviceSize(); SkISize size = canvas->getDeviceSize();
SkMWCRandom random; SkRandom random;
for (int i = 0; i < kNumRects; ++i) { for (int i = 0; i < kNumRects; ++i) {
SkPaint paint; SkPaint paint;
paint.setXfermode(fXfermode.get()); paint.setXfermode(fXfermode.get());

View File

@ -29,7 +29,7 @@ protected:
} }
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
SkMWCRandom rand; SkRandom rand;
SkRect rect = SkRect::MakeXYWH(10, 10, 200, 200); SkRect rect = SkRect::MakeXYWH(10, 10, 200, 200);

View File

@ -74,7 +74,7 @@ protected:
}; };
static const int kNumCubics = 15; static const int kNumCubics = 15;
SkMWCRandom rand; SkRandom rand;
// Mult by 3 for each edge effect type // Mult by 3 for each edge effect type
int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumCubics*3))); int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumCubics*3)));
@ -226,7 +226,7 @@ protected:
}; };
static const int kNumConics = 10; static const int kNumConics = 10;
SkMWCRandom rand; SkRandom rand;
// Mult by 3 for each edge effect type // Mult by 3 for each edge effect type
int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumConics*3))); int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumConics*3)));
@ -411,7 +411,7 @@ protected:
}; };
static const int kNumQuads = 5; static const int kNumQuads = 5;
SkMWCRandom rand; SkRandom rand;
int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumQuads*3))); int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumQuads*3)));
int numRows = SkScalarCeilToInt(SkIntToScalar(kNumQuads*3) / numCols); int numRows = SkScalarCeilToInt(SkIntToScalar(kNumQuads*3) / numCols);

View File

@ -152,9 +152,8 @@ protected:
} }
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
SkRandom rand; SkLCGRandom rand;
canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1);
int i; int i;
for (i = 0; i < fPaints.count(); ++i) { for (i = 0; i < fPaints.count(); ++i) {
canvas->save(); canvas->save();
@ -206,3 +205,4 @@ static GM* MyFactory(void*) { return new CircleGM; }
static GMRegistry reg(MyFactory); static GMRegistry reg(MyFactory);
} }

View File

@ -70,7 +70,7 @@ public:
SkRegion::kReplace_Op, SkRegion::kReplace_Op,
}; };
SkRandom r; SkLCGRandom r;
for (int i = 0; i < kRows; ++i) { for (int i = 0; i < kRows; ++i) {
for (int j = 0; j < kCols; ++j) { for (int j = 0; j < kCols; ++j) {
for (int k = 0; k < 5; ++k) { for (int k = 0; k < 5; ++k) {

View File

@ -261,7 +261,7 @@ protected:
SkPaint paint; SkPaint paint;
paint.setAntiAlias(true); paint.setAntiAlias(true);
SkRandom rand; SkLCGRandom rand;
canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1);
// As we've added more paths this has gotten pretty big. Scale the whole thing down. // As we've added more paths this has gotten pretty big. Scale the whole thing down.

View File

@ -131,7 +131,7 @@ protected:
20 * SK_Scalar1, 20 * SK_Scalar1,
titlePaint); titlePaint);
SkRandom rand; SkLCGRandom rand;
SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1);
canvas->save(); canvas->save();
canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);
@ -275,7 +275,7 @@ protected:
20 * SK_Scalar1, 20 * SK_Scalar1,
titlePaint); titlePaint);
SkRandom rand; SkLCGRandom rand;
SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1);
canvas->save(); canvas->save();
canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);

View File

@ -297,7 +297,7 @@ protected:
20 * SK_Scalar1, 20 * SK_Scalar1,
titlePaint); titlePaint);
SkRandom rand; SkLCGRandom rand;
SkRect rect = SkRect::MakeWH(220*SK_Scalar1, 50*SK_Scalar1); SkRect rect = SkRect::MakeWH(220*SK_Scalar1, 50*SK_Scalar1);
canvas->save(); canvas->save();
canvas->translate(2*SK_Scalar1, 30 * SK_Scalar1); // The title canvas->translate(2*SK_Scalar1, 30 * SK_Scalar1); // The title

View File

@ -72,7 +72,7 @@ protected:
20 * SK_Scalar1, 20 * SK_Scalar1,
titlePaint); titlePaint);
SkRandom rand; SkLCGRandom rand;
SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1);
int i = 0; int i = 0;
canvas->save(); canvas->save();

View File

@ -51,7 +51,7 @@ protected:
SkAutoTArray<SkScalar> widths(len); SkAutoTArray<SkScalar> widths(len);
paint.getTextWidths(text, len, &widths[0]); paint.getTextWidths(text, len, &widths[0]);
SkRandom rand; SkLCGRandom rand;
SkScalar x = SkIntToScalar(20); SkScalar x = SkIntToScalar(20);
SkScalar y = SkIntToScalar(100); SkScalar y = SkIntToScalar(100);
for (size_t i = 0; i < len; ++i) { for (size_t i = 0; i < len; ++i) {

View File

@ -42,7 +42,7 @@ protected:
virtual void onDraw(SkCanvas* canvas) { virtual void onDraw(SkCanvas* canvas) {
SkPath path; SkPath path;
SkRandom rand; SkLCGRandom rand;
int scale = 300; int scale = 300;
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {

View File

@ -90,7 +90,7 @@ protected:
20 * SK_Scalar1, 20 * SK_Scalar1,
titlePaint); titlePaint);
SkRandom rand; SkLCGRandom rand;
SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1);
canvas->save(); canvas->save();
canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);
@ -232,7 +232,7 @@ protected:
20 * SK_Scalar1, 20 * SK_Scalar1,
titlePaint); titlePaint);
SkRandom rand; SkLCGRandom rand;
SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1);
canvas->save(); canvas->save();
canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);

View File

@ -32,7 +32,7 @@ protected:
void drawShape(SkCanvas* canvas, void drawShape(SkCanvas* canvas,
const SkPaint& paint, const SkPaint& paint,
SkMWCRandom* random) { SkRandom* random) {
static const SkRect kRect = SkRect::MakeXYWH(SkIntToScalar(-50), SkIntToScalar(-50), static const SkRect kRect = SkRect::MakeXYWH(SkIntToScalar(-50), SkIntToScalar(-50),
SkIntToScalar(75), SkIntToScalar(105)); SkIntToScalar(75), SkIntToScalar(105));
int shape = random->nextULessThan(5); int shape = random->nextULessThan(5);
@ -102,7 +102,7 @@ protected:
canvas->drawPaint(bgPaint); canvas->drawPaint(bgPaint);
SkISize size = canvas->getDeviceSize(); SkISize size = canvas->getDeviceSize();
SkScalar maxScale = SkScalarSqrt((SkIntToScalar(size.fWidth * size.fHeight))) / 300; SkScalar maxScale = SkScalarSqrt((SkIntToScalar(size.fWidth * size.fHeight))) / 300;
SkMWCRandom random; SkRandom random;
for (int i = 0; i < kNumShapes; ++i) { for (int i = 0; i < kNumShapes; ++i) {
SkScalar s = random.nextRangeScalar(SK_Scalar1 / 8, SK_Scalar1) * maxScale; SkScalar s = random.nextRangeScalar(SK_Scalar1 / 8, SK_Scalar1) * maxScale;
SkScalar r = random.nextRangeScalar(0, SkIntToScalar(360)); SkScalar r = random.nextRangeScalar(0, SkIntToScalar(360));

View File

@ -73,7 +73,7 @@ protected:
}; };
// draw a background pattern to make transparency errors more apparent // draw a background pattern to make transparency errors more apparent
SkMWCRandom rand; SkRandom rand;
for (int y = 0; y < kImageHeight; y += 10) { for (int y = 0; y < kImageHeight; y += 10) {
for (int x = 0; x < kImageWidth; x += 10) { for (int x = 0; x < kImageWidth; x += 10) {

View File

@ -125,7 +125,7 @@ protected:
} }
} }
SkColor genColor(SkMWCRandom* rand) { SkColor genColor(SkRandom* rand) {
SkScalar hsv[3]; SkScalar hsv[3];
hsv[0] = SkFloatToScalar(rand->nextRangeF(0.0f, 360.0f)); hsv[0] = SkFloatToScalar(rand->nextRangeF(0.0f, 360.0f));
hsv[1] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f)); hsv[1] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f));
@ -135,7 +135,7 @@ protected:
} }
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
SkMWCRandom rand(1); SkRandom rand(1);
canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1);
SkRect oval = SkRect::MakeLTRB(-20, -30, 20, 30); SkRect oval = SkRect::MakeLTRB(-20, -30, 20, 30);

View File

@ -23,7 +23,7 @@ protected:
return make_isize(640, 490); 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++) { for (size_t i = 0; i < n; i++) {
// Compute these independently and store in variables, rather // Compute these independently and store in variables, rather
// than in the parameter-passing expression, to get consistent // than in the parameter-passing expression, to get consistent
@ -37,7 +37,7 @@ protected:
virtual void onDraw(SkCanvas* canvas) { virtual void onDraw(SkCanvas* canvas) {
canvas->translate(SK_Scalar1, SK_Scalar1); canvas->translate(SK_Scalar1, SK_Scalar1);
SkRandom rand; SkLCGRandom rand;
SkPaint p0, p1, p2, p3; SkPaint p0, p1, p2, p3;
const size_t n = 99; const size_t n = 99;

View File

@ -91,7 +91,7 @@ protected:
20 * SK_Scalar1, 20 * SK_Scalar1,
titlePaint); titlePaint);
SkRandom rand; SkLCGRandom rand;
SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1);
canvas->save(); canvas->save();
canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);
@ -234,7 +234,7 @@ protected:
20 * SK_Scalar1, 20 * SK_Scalar1,
titlePaint); titlePaint);
SkRandom rand; SkLCGRandom rand;
SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1);
canvas->save(); canvas->save();
canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);

View File

@ -126,7 +126,7 @@ protected:
} }
} }
SkColor genColor(SkMWCRandom* rand) { SkColor genColor(SkRandom* rand) {
SkScalar hsv[3]; SkScalar hsv[3];
hsv[0] = SkFloatToScalar(rand->nextRangeF(0.0f, 360.0f)); hsv[0] = SkFloatToScalar(rand->nextRangeF(0.0f, 360.0f));
hsv[1] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f)); hsv[1] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f));
@ -136,7 +136,7 @@ protected:
} }
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
SkMWCRandom rand(1); SkRandom rand(1);
canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1);
SkRect rect = SkRect::MakeLTRB(-20, -30, 20, 30); SkRect rect = SkRect::MakeLTRB(-20, -30, 20, 30);
SkRRect circleRect; SkRRect circleRect;

View File

@ -33,7 +33,7 @@ protected:
return make_isize(W*2, H*2); 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 x = rand.nextUScalar1() * W;
SkScalar y = rand.nextUScalar1() * H; SkScalar y = rand.nextUScalar1() * H;
SkScalar w = rand.nextUScalar1() * (W >> 2); SkScalar w = rand.nextUScalar1() * (W >> 2);
@ -61,7 +61,7 @@ protected:
, SW - SkIntToScalar(2), SH - SkIntToScalar(2) , SW - SkIntToScalar(2), SH - SkIntToScalar(2)
)); ));
SkRandom rand; SkLCGRandom rand;
for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) {
SkRect r; SkRect r;
rnd_rect(&r, rand); rnd_rect(&r, rand);

View File

@ -18,7 +18,7 @@
static const SkScalar SW = SkIntToScalar(W); static const SkScalar SW = SkIntToScalar(W);
static const SkScalar SH = SkIntToScalar(H); 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 x = rand.nextUScalar1() * W;
SkScalar y = rand.nextUScalar1() * H; SkScalar y = rand.nextUScalar1() * H;
SkScalar w = rand.nextUScalar1() * (W >> 2); SkScalar w = rand.nextUScalar1() * (W >> 2);
@ -61,7 +61,7 @@ protected:
, SW - SkIntToScalar(2), SH - SkIntToScalar(2) , SW - SkIntToScalar(2), SH - SkIntToScalar(2)
)); ));
SkRandom rand; SkLCGRandom rand;
for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) {
SkRect r; SkRect r;
rnd_rect(&r, &paint, rand); rnd_rect(&r, &paint, rand);
@ -81,7 +81,7 @@ class Strokes2GM : public skiagm::GM {
SkPath fPath; SkPath fPath;
public: public:
Strokes2GM() { Strokes2GM() {
SkRandom rand; SkLCGRandom rand;
fPath.moveTo(0, 0); fPath.moveTo(0, 0);
for (int i = 0; i < 13; i++) { for (int i = 0; i < 13; i++) {
SkScalar x = rand.nextUScalar1() * (W >> 1); SkScalar x = rand.nextUScalar1() * (W >> 1);
@ -121,7 +121,7 @@ protected:
SW - SkIntToScalar(2), SW - SkIntToScalar(2),
SH - SkIntToScalar(2))); SH - SkIntToScalar(2)));
SkRandom rand; SkLCGRandom rand;
for (int i = 0; i < N/2; i++) { for (int i = 0; i < N/2; i++) {
SkRect r; SkRect r;
rnd_rect(&r, &paint, rand); rnd_rect(&r, &paint, rand);

View File

@ -25,7 +25,7 @@ enum {
/** /**
* A helper for use in GrEffect::TestCreate functions. * 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 { class GrEffectTestFactory : GrNoncopyable {
public: public:
typedef GrEffectRef* (*CreateProc)(SkMWCRandom*, typedef GrEffectRef* (*CreateProc)(SkRandom*,
GrContext*, GrContext*,
const GrDrawTargetCaps& caps, const GrDrawTargetCaps& caps,
GrTexture* dummyTextures[]); GrTexture* dummyTextures[]);
@ -48,7 +48,7 @@ public:
GetFactories()->push_back(this); GetFactories()->push_back(this);
} }
static GrEffectRef* CreateStage(SkMWCRandom* random, static GrEffectRef* CreateStage(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps& caps, const GrDrawTargetCaps& caps,
GrTexture* dummyTextures[]) { GrTexture* dummyTextures[]) {
@ -67,14 +67,14 @@ private:
*/ */
#define GR_DECLARE_EFFECT_TEST \ #define GR_DECLARE_EFFECT_TEST \
static GrEffectTestFactory gTestFactory; \ static GrEffectTestFactory gTestFactory; \
static GrEffectRef* TestCreate(SkMWCRandom*, \ static GrEffectRef* TestCreate(SkRandom*, \
GrContext*, \ GrContext*, \
const GrDrawTargetCaps&, \ const GrDrawTargetCaps&, \
GrTexture* dummyTextures[2]) GrTexture* dummyTextures[2])
/** GrEffect subclasses should insert this macro in their implementation file. They must then /** GrEffect subclasses should insert this macro in their implementation file. They must then
* also implement this static function: * also implement this static function:
* GrEffect* TestCreate(SkMWCRandom*, * GrEffect* TestCreate(SkRandom*,
* GrContext*, * GrContext*,
* const GrDrawTargetCaps&, * const GrDrawTargetCaps&,
* GrTexture* dummyTextures[2]); * GrTexture* dummyTextures[2]);
@ -91,7 +91,7 @@ private:
// The unit test relies on static initializers. Just declare the TestCreate function so that // The unit test relies on static initializers. Just declare the TestCreate function so that
// its definitions will compile. // its definitions will compile.
#define GR_DECLARE_EFFECT_TEST \ #define GR_DECLARE_EFFECT_TEST \
static GrEffectRef* TestCreate(SkMWCRandom*, \ static GrEffectRef* TestCreate(SkRandom*, \
GrContext*, \ GrContext*, \
const GrDrawTargetCaps&, \ const GrDrawTargetCaps&, \
GrTexture* dummyTextures[2]) GrTexture* dummyTextures[2])

View File

@ -13,16 +13,16 @@
#include "Sk64.h" #include "Sk64.h"
#include "SkScalar.h" #include "SkScalar.h"
/** \class SkRandom /** \class SkLCGRandom
Utility class that implements pseudo random 32bit numbers using a fast Utility class that implements pseudo random 32bit numbers using a fast
linear equation. Unlike rand(), this class holds its own seed (initially 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. set to 0), so that multiple instances can be used with no side-effects.
*/ */
class SkRandom { class SkLCGRandom {
public: public:
SkRandom() : fSeed(0) {} SkLCGRandom() : fSeed(0) {}
SkRandom(uint32_t seed) : fSeed(seed) {} SkLCGRandom(uint32_t seed) : fSeed(seed) {}
/** Return the next pseudo random number as an unsigned 32bit value. /** Return the next pseudo random number as an unsigned 32bit value.
*/ */
@ -151,7 +151,7 @@ private:
uint32_t fSeed; uint32_t fSeed;
}; };
/** \class SkMWCRandom /** \class SkRandom
Utility class that implements pseudo random 32bit numbers using Marsaglia's Utility class that implements pseudo random 32bit numbers using Marsaglia's
multiply-with-carry "mother of all" algorithm. Unlike rand(), this class holds 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. Has a large period and all bits are well-randomized.
*/ */
class SkMWCRandom { class SkRandom {
public: public:
SkMWCRandom() { init(0); } SkRandom() { init(0); }
SkMWCRandom(uint32_t seed) { init(seed); } SkRandom(uint32_t seed) { init(seed); }
SkMWCRandom(const SkMWCRandom& rand) : fK(rand.fK), fJ(rand.fJ) {} SkRandom(const SkRandom& rand) : fK(rand.fK), fJ(rand.fJ) {}
SkMWCRandom& operator=(const SkMWCRandom& rand) { SkRandom& operator=(const SkRandom& rand) {
fK = rand.fK; fK = rand.fK;
fJ = rand.fJ; fJ = rand.fJ;

View File

@ -43,7 +43,7 @@ protected:
SkBlurMaskFilter::kSolid_BlurStyle, SkBlurMaskFilter::kSolid_BlurStyle,
SkBlurMaskFilter::kOuter_BlurStyle, SkBlurMaskFilter::kOuter_BlurStyle,
}; };
SkMWCRandom random; SkRandom random;
for (size_t i = 0; i < SK_ARRAY_COUNT(gStyles); ++i) { for (size_t i = 0; i < SK_ARRAY_COUNT(gStyles); ++i) {
SkMaskFilter* mf = SkBlurMaskFilter::Create( SkMaskFilter* mf = SkBlurMaskFilter::Create(

View File

@ -2435,7 +2435,7 @@ template <typename T> void SkTBSort(T array[], int count) {
#include "SkRandom.h" #include "SkRandom.h"
static void rand_rect(SkIRect* rect, SkMWCRandom& rand) { static void rand_rect(SkIRect* rect, SkRandom& rand) {
int bits = 8; int bits = 8;
int shift = 32 - bits; int shift = 32 - bits;
rect->set(rand.nextU() >> shift, rand.nextU() >> shift, rect->set(rand.nextU() >> shift, rand.nextU() >> shift,
@ -2499,7 +2499,7 @@ static void test() {
test_rects(gRecs[i].fRects, gRecs[i].fCount); test_rects(gRecs[i].fRects, gRecs[i].fCount);
} }
SkMWCRandom rand; SkRandom rand;
for (i = 0; i < 10000; i++) { for (i = 0; i < 10000; i++) {
SkRegion rgn0, rgn1; SkRegion rgn0, rgn1;

View File

@ -16,7 +16,7 @@ namespace {
// Generates y values for the chart plots. // Generates y values for the chart plots.
void gen_data(SkScalar yAvg, SkScalar ySpread, int count, SkTDArray<SkScalar>* dataPts) { void gen_data(SkScalar yAvg, SkScalar ySpread, int count, SkTDArray<SkScalar>* dataPts) {
dataPts->setCount(count); dataPts->setCount(count);
static SkMWCRandom gRandom; static SkRandom gRandom;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
(*dataPts)[i] = gRandom.nextRangeScalar(yAvg - SkScalarHalf(ySpread), (*dataPts)[i] = gRandom.nextRangeScalar(yAvg - SkScalarHalf(ySpread),
yAvg + SkScalarHalf(ySpread)); yAvg + SkScalarHalf(ySpread));
@ -123,7 +123,7 @@ protected:
canvas->clear(0xFFE0F0E0); canvas->clear(0xFFE0F0E0);
static SkMWCRandom colorRand; static SkRandom colorRand;
static SkColor gColors[kNumGraphs] = { 0x0 }; static SkColor gColors[kNumGraphs] = { 0x0 };
if (0 == gColors[0]) { if (0 == gColors[0]) {
for (int i = 0; i < kNumGraphs; ++i) { for (int i = 0; i < kNumGraphs; ++i) {

View File

@ -17,7 +17,7 @@
#define H 200 #define H 200
static void show_text(SkCanvas* canvas, bool doAA) { static void show_text(SkCanvas* canvas, bool doAA) {
SkMWCRandom rand; SkRandom rand;
SkPaint paint; SkPaint paint;
paint.setAntiAlias(doAA); paint.setAntiAlias(doAA);
paint.setLCDRenderText(true); paint.setLCDRenderText(true);
@ -32,7 +32,7 @@ static void show_text(SkCanvas* canvas, bool doAA) {
} }
static void show_fill(SkCanvas* canvas, bool doAA) { static void show_fill(SkCanvas* canvas, bool doAA) {
SkMWCRandom rand; SkRandom rand;
SkPaint paint; SkPaint paint;
paint.setAntiAlias(doAA); 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); SkASSERT(min <= max);
return min + SkScalarMul(rand.nextUScalar1(), max - min); return min + SkScalarMul(rand.nextUScalar1(), max - min);
} }
static void show_stroke(SkCanvas* canvas, bool doAA, SkScalar strokeWidth, int n) { static void show_stroke(SkCanvas* canvas, bool doAA, SkScalar strokeWidth, int n) {
SkMWCRandom rand; SkRandom rand;
SkPaint paint; SkPaint paint;
paint.setAntiAlias(doAA); paint.setAntiAlias(doAA);
paint.setStyle(SkPaint::kStroke_Style); paint.setStyle(SkPaint::kStroke_Style);

View File

@ -96,7 +96,7 @@ FINISHED2:
return array; 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); return min + SkScalarMul(rand.nextUScalar1(), max - min);
} }
@ -105,7 +105,7 @@ public:
CullView() { CullView() {
fClip.set(0, 0, SkIntToScalar(160), SkIntToScalar(160)); fClip.set(0, 0, SkIntToScalar(160), SkIntToScalar(160));
SkMWCRandom rand; SkRandom rand;
for (int i = 0; i < 50; i++) { for (int i = 0; i < 50; i++) {
SkScalar x = nextScalarRange(rand, -fClip.width()*1, fClip.width()*2); SkScalar x = nextScalarRange(rand, -fClip.width()*1, fClip.width()*2);

View File

@ -73,7 +73,7 @@ protected:
100*SK_Scalar1, 100*SK_Scalar1,
titlePaint); titlePaint);
SkMWCRandom rand; SkRandom rand;
SkRect rect = SkRect::MakeWH(125*SK_Scalar1, 100*SK_Scalar1); SkRect rect = SkRect::MakeWH(125*SK_Scalar1, 100*SK_Scalar1);
int i = 0; int i = 0;
canvas->save(); canvas->save();

View File

@ -16,7 +16,7 @@
static void call_measure() { static void call_measure() {
SkPaint paint; SkPaint paint;
uint16_t text[32]; uint16_t text[32];
SkMWCRandom rand; SkRandom rand;
paint.setAntiAlias(true); paint.setAntiAlias(true);
paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
@ -35,7 +35,7 @@ static void call_measure() {
static void call_draw(SkCanvas* canvas) { static void call_draw(SkCanvas* canvas) {
SkPaint paint; SkPaint paint;
uint16_t text[32]; uint16_t text[32];
SkMWCRandom rand; SkRandom rand;
paint.setAntiAlias(true); paint.setAntiAlias(true);
paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);

View File

@ -34,8 +34,8 @@ protected:
paint.setStrokeWidth(0); paint.setStrokeWidth(0);
canvas->save(); canvas->save();
canvas->scale(1000 * SK_Scalar1, 1000 * SK_Scalar1); canvas->scale(1000 * SK_Scalar1, 1000 * SK_Scalar1);
SkMWCRandom rand; SkRandom rand;
SkMWCRandom randW; SkRandom randW;
SkPath curves; SkPath curves;
SkPath hulls; SkPath hulls;
SkPath ctrlPts; SkPath ctrlPts;

View File

@ -69,7 +69,7 @@ protected:
} }
private: private:
SkMWCRandom fRandom; SkRandom fRandom;
typedef SampleView INHERITED; typedef SampleView INHERITED;
}; };

View File

@ -102,7 +102,7 @@ class PathEffectView : public SampleView {
SkPoint fClickPt; SkPoint fClickPt;
public: public:
PathEffectView() { PathEffectView() {
SkMWCRandom rand; SkRandom rand;
int steps = 20; int steps = 20;
SkScalar dist = SkIntToScalar(400); SkScalar dist = SkIntToScalar(400);
SkScalar x = SkIntToScalar(20); SkScalar x = SkIntToScalar(20);

View File

@ -165,7 +165,7 @@ protected:
// test that we can re-record a subpicture, and see the results // 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)); canvas->translate(SkIntToScalar(10), SkIntToScalar(250));
drawCircle(fSubPicture->beginRecording(50, 50), 25, drawCircle(fSubPicture->beginRecording(50, 50), 25,
rand.nextU() | 0xFF000000); rand.nextU() | 0xFF000000);

View File

@ -41,7 +41,7 @@ protected:
return this->INHERITED::onQuery(evt); 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++) for (size_t i = 0; i < n; i++)
pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480); pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480);
} }
@ -49,7 +49,7 @@ protected:
virtual void onDrawContent(SkCanvas* canvas) { virtual void onDrawContent(SkCanvas* canvas) {
canvas->translate(SK_Scalar1, SK_Scalar1); canvas->translate(SK_Scalar1, SK_Scalar1);
SkMWCRandom rand; SkRandom rand;
SkPaint p0, p1, p2, p3; SkPaint p0, p1, p2, p3;
const size_t n = 99; const size_t n = 99;

View File

@ -38,7 +38,7 @@ protected:
} }
virtual void onDrawContent(SkCanvas* canvas) { virtual void onDrawContent(SkCanvas* canvas) {
SkMWCRandom rand; SkRandom rand;
SkPaint paint; SkPaint paint;
paint.setAntiAlias(true); paint.setAntiAlias(true);
paint.setStrokeWidth(20); paint.setStrokeWidth(20);

View File

@ -350,7 +350,7 @@ public:
static void make_tris(Rec* rec) { static void make_tris(Rec* rec) {
int n = 10; int n = 10;
SkMWCRandom rand; SkRandom rand;
rec->fMode = SkCanvas::kTriangles_VertexMode; rec->fMode = SkCanvas::kTriangles_VertexMode;
rec->fCount = n * 3; rec->fCount = n * 3;

View File

@ -132,7 +132,7 @@ protected:
return this->INHERITED::onQuery(evt); return this->INHERITED::onQuery(evt);
} }
SkMWCRandom rand; SkRandom rand;
void drawSet(SkCanvas* canvas, SkPaint* paint) { void drawSet(SkCanvas* canvas, SkPaint* paint) {
SkAutoCanvasRestore acr(canvas, true); SkAutoCanvasRestore acr(canvas, true);

View File

@ -135,7 +135,7 @@ static void test_breakText() {
SkASSERT(mm == width); SkASSERT(mm == width);
} }
static SkMWCRandom gRand; static SkRandom gRand;
class SkPowerMode : public SkXfermode { class SkPowerMode : public SkXfermode {
public: public:
@ -287,7 +287,7 @@ protected:
canvas.drawText(s, strlen(s), SkIntToScalar(8), SkIntToScalar(14), paint); 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++) for (size_t i = 0; i < n; i++)
pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480); pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480);
} }

View File

@ -74,7 +74,7 @@ protected:
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3)))); SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3))));
paint.getMaskFilter()->unref(); paint.getMaskFilter()->unref();
SkMWCRandom rand; SkRandom rand;
for (int ps = 6; ps <= 35; ps++) { for (int ps = 6; ps <= 35; ps++) {
paint.setColor(rand.nextU() | (0xFF << 24)); paint.setColor(rand.nextU() | (0xFF << 24));

View File

@ -144,7 +144,7 @@ private:
void make_tris(Rec* rec) { void make_tris(Rec* rec) {
int n = 10; int n = 10;
SkMWCRandom rand; SkRandom rand;
rec->fMode = SkCanvas::kTriangles_VertexMode; rec->fMode = SkCanvas::kTriangles_VertexMode;
rec->fCount = n * 3; rec->fCount = n * 3;

View File

@ -291,7 +291,7 @@ void SkFloat::UnitTest()
d.setAdd(c, b); d.setAdd(c, b);
SkDebugf("SkFloat: %d + %d = %d\n", c.getInt(), b.getInt(), d.getInt()); SkDebugf("SkFloat: %d + %d = %d\n", c.getInt(), b.getInt(), d.getInt());
SkMWCRandom rand; SkRandom rand;
int i; int i;
for (i = 0; i < 1000; i++) for (i = 0; i < 1000; i++)

View File

@ -1359,7 +1359,7 @@ private:
}; };
GR_DEFINE_EFFECT_TEST(XferEffect); GR_DEFINE_EFFECT_TEST(XferEffect);
GrEffectRef* XferEffect::TestCreate(SkMWCRandom* rand, GrEffectRef* XferEffect::TestCreate(SkRandom* rand,
GrContext*, GrContext*,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture*[]) { GrTexture*[]) {

View File

@ -415,7 +415,7 @@ GrGLEffect::EffectKey GrGLArithmeticEffect::GenKey(const GrDrawEffect& drawEffec
return bgKey; return bgKey;
} }
GrEffectRef* GrArithmeticEffect::TestCreate(SkMWCRandom* rand, GrEffectRef* GrArithmeticEffect::TestCreate(SkRandom* rand,
GrContext*, GrContext*,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture*[]) { GrTexture*[]) {

View File

@ -235,7 +235,7 @@ private:
GR_DEFINE_EFFECT_TEST(ThresholdEffect); GR_DEFINE_EFFECT_TEST(ThresholdEffect);
GrEffectRef* ThresholdEffect::TestCreate(SkMWCRandom* rand, GrEffectRef* ThresholdEffect::TestCreate(SkRandom* rand,
GrContext*, GrContext*,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {

View File

@ -461,7 +461,7 @@ private:
GR_DEFINE_EFFECT_TEST(ColorMatrixEffect); GR_DEFINE_EFFECT_TEST(ColorMatrixEffect);
GrEffectRef* ColorMatrixEffect::TestCreate(SkMWCRandom* random, GrEffectRef* ColorMatrixEffect::TestCreate(SkRandom* random,
GrContext*, GrContext*,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* dummyTextures[2]) { GrTexture* dummyTextures[2]) {

View File

@ -31,7 +31,7 @@ bool SkDiscretePathEffect::filterPath(SkPath* dst, const SkPath& src,
SkPathMeasure meas(src, doFill); SkPathMeasure meas(src, doFill);
uint32_t seed = SkScalarRound(meas.getLength()); uint32_t seed = SkScalarRound(meas.getLength());
SkRandom rand(seed ^ ((seed << 16) | (seed >> 16))); SkLCGRandom rand(seed ^ ((seed << 16) | (seed >> 16)));
SkScalar scale = fPerterb; SkScalar scale = fPerterb;
SkPoint p; SkPoint p;
SkVector v; SkVector v;

View File

@ -366,7 +366,7 @@ void GrDisplacementMapEffect::getConstantColorComponents(GrColor*,
GR_DEFINE_EFFECT_TEST(GrDisplacementMapEffect); GR_DEFINE_EFFECT_TEST(GrDisplacementMapEffect);
GrEffectRef* GrDisplacementMapEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrDisplacementMapEffect::TestCreate(SkRandom* random,
GrContext*, GrContext*,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {

View File

@ -1026,13 +1026,13 @@ bool SkSpecularLightingImageFilter::asNewEffect(GrEffectRef** effect, GrTexture*
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
namespace { namespace {
SkPoint3 random_point3(SkMWCRandom* random) { SkPoint3 random_point3(SkRandom* random) {
return SkPoint3(SkScalarToFloat(random->nextSScalar1()), return SkPoint3(SkScalarToFloat(random->nextSScalar1()),
SkScalarToFloat(random->nextSScalar1()), 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); int type = random->nextULessThan(3);
switch (type) { switch (type) {
case 0: { case 0: {
@ -1168,7 +1168,7 @@ bool GrDiffuseLightingEffect::onIsEqual(const GrEffect& sBase) const {
GR_DEFINE_EFFECT_TEST(GrDiffuseLightingEffect); GR_DEFINE_EFFECT_TEST(GrDiffuseLightingEffect);
GrEffectRef* GrDiffuseLightingEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrDiffuseLightingEffect::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {
@ -1386,7 +1386,7 @@ bool GrSpecularLightingEffect::onIsEqual(const GrEffect& sBase) const {
GR_DEFINE_EFFECT_TEST(GrSpecularLightingEffect); GR_DEFINE_EFFECT_TEST(GrSpecularLightingEffect);
GrEffectRef* GrSpecularLightingEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrSpecularLightingEffect::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {

View File

@ -196,7 +196,7 @@ GrGLEffect::EffectKey GrGLMagnifierEffect::GenKey(const GrDrawEffect& drawEffect
GR_DEFINE_EFFECT_TEST(GrMagnifierEffect); GR_DEFINE_EFFECT_TEST(GrMagnifierEffect);
GrEffectRef* GrMagnifierEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrMagnifierEffect::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture** textures) { GrTexture** textures) {

View File

@ -530,7 +530,7 @@ GR_DEFINE_EFFECT_TEST(GrMatrixConvolutionEffect);
// Allows for a 5x5 kernel (or 25x1, for that matter). // Allows for a 5x5 kernel (or 25x1, for that matter).
#define MAX_KERNEL_SIZE 25 #define MAX_KERNEL_SIZE 25
GrEffectRef* GrMatrixConvolutionEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrMatrixConvolutionEffect::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {

View File

@ -427,7 +427,7 @@ void GrMorphologyEffect::getConstantColorComponents(GrColor* color, uint32_t* va
GR_DEFINE_EFFECT_TEST(GrMorphologyEffect); GR_DEFINE_EFFECT_TEST(GrMorphologyEffect);
GrEffectRef* GrMorphologyEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrMorphologyEffect::TestCreate(SkRandom* random,
GrContext*, GrContext*,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {

View File

@ -712,7 +712,7 @@ private:
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
GR_DEFINE_EFFECT_TEST(GrPerlinNoiseEffect); GR_DEFINE_EFFECT_TEST(GrPerlinNoiseEffect);
GrEffectRef* GrPerlinNoiseEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrPerlinNoiseEffect::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture**) { GrTexture**) {

View File

@ -375,7 +375,7 @@ void ColorTableEffect::getConstantColorComponents(GrColor* color, uint32_t* vali
GR_DEFINE_EFFECT_TEST(ColorTableEffect); GR_DEFINE_EFFECT_TEST(ColorTableEffect);
GrEffectRef* ColorTableEffect::TestCreate(SkMWCRandom* random, GrEffectRef* ColorTableEffect::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {

View File

@ -1127,7 +1127,7 @@ void GrGradientEffect::getConstantColorComponents(GrColor* color, uint32_t* vali
} }
} }
int GrGradientEffect::RandomGradientParams(SkMWCRandom* random, int GrGradientEffect::RandomGradientParams(SkRandom* random,
SkColor colors[], SkColor colors[],
SkScalar** stops, SkScalar** stops,
SkShader::TileMode* tm) { SkShader::TileMode* tm) {

View File

@ -282,7 +282,7 @@ protected:
passed to the gradient factory rather than the array. passed to the gradient factory rather than the array.
*/ */
static const int kMaxRandomGradientColors = 4; static const int kMaxRandomGradientColors = 4;
static int RandomGradientParams(SkMWCRandom* r, static int RandomGradientParams(SkRandom* r,
SkColor colors[kMaxRandomGradientColors], SkColor colors[kMaxRandomGradientColors],
SkScalar** stops, SkScalar** stops,
SkShader::TileMode* tm); SkShader::TileMode* tm);

View File

@ -496,7 +496,7 @@ private:
GR_DEFINE_EFFECT_TEST(GrLinearGradient); GR_DEFINE_EFFECT_TEST(GrLinearGradient);
GrEffectRef* GrLinearGradient::TestCreate(SkMWCRandom* random, GrEffectRef* GrLinearGradient::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture**) { GrTexture**) {

View File

@ -531,7 +531,7 @@ private:
GR_DEFINE_EFFECT_TEST(GrRadialGradient); GR_DEFINE_EFFECT_TEST(GrRadialGradient);
GrEffectRef* GrRadialGradient::TestCreate(SkMWCRandom* random, GrEffectRef* GrRadialGradient::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture**) { GrTexture**) {

View File

@ -447,7 +447,7 @@ private:
GR_DEFINE_EFFECT_TEST(GrSweepGradient); GR_DEFINE_EFFECT_TEST(GrSweepGradient);
GrEffectRef* GrSweepGradient::TestCreate(SkMWCRandom* random, GrEffectRef* GrSweepGradient::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture**) { GrTexture**) {

View File

@ -440,7 +440,7 @@ private:
GR_DEFINE_EFFECT_TEST(GrConical2Gradient); GR_DEFINE_EFFECT_TEST(GrConical2Gradient);
GrEffectRef* GrConical2Gradient::TestCreate(SkMWCRandom* random, GrEffectRef* GrConical2Gradient::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture**) { GrTexture**) {

View File

@ -483,7 +483,7 @@ private:
GR_DEFINE_EFFECT_TEST(GrRadial2Gradient); GR_DEFINE_EFFECT_TEST(GrRadial2Gradient);
GrEffectRef* GrRadial2Gradient::TestCreate(SkMWCRandom* random, GrEffectRef* GrRadial2Gradient::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture**) { GrTexture**) {

View File

@ -593,7 +593,7 @@ private:
GR_DEFINE_EFFECT_TEST(QuadEdgeEffect); GR_DEFINE_EFFECT_TEST(QuadEdgeEffect);
GrEffectRef* QuadEdgeEffect::TestCreate(SkMWCRandom* random, GrEffectRef* QuadEdgeEffect::TestCreate(SkRandom* random,
GrContext*, GrContext*,
const GrDrawTargetCaps& caps, const GrDrawTargetCaps& caps,
GrTexture*[]) { GrTexture*[]) {

View File

@ -117,7 +117,7 @@ private:
GR_DEFINE_EFFECT_TEST(GrAlignedRectEffect); GR_DEFINE_EFFECT_TEST(GrAlignedRectEffect);
GrEffectRef* GrAlignedRectEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrAlignedRectEffect::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {
@ -256,7 +256,7 @@ private:
GR_DEFINE_EFFECT_TEST(GrRectEffect); GR_DEFINE_EFFECT_TEST(GrRectEffect);
GrEffectRef* GrRectEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrRectEffect::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {

View File

@ -21,7 +21,7 @@ SkTArray<GrEffectTestFactory*, true>* GrEffectTestFactory::GetFactories() {
#endif #endif
namespace GrEffectUnitTest { namespace GrEffectUnitTest {
const SkMatrix& TestMatrix(SkMWCRandom* random) { const SkMatrix& TestMatrix(SkRandom* random) {
static SkMatrix gMatrices[5]; static SkMatrix gMatrices[5];
static bool gOnce; static bool gOnce;
if (!gOnce) { if (!gOnce) {

View File

@ -155,7 +155,7 @@ private:
GR_DEFINE_EFFECT_TEST(CircleEdgeEffect); GR_DEFINE_EFFECT_TEST(CircleEdgeEffect);
GrEffectRef* CircleEdgeEffect::TestCreate(SkMWCRandom* random, GrEffectRef* CircleEdgeEffect::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {
@ -293,7 +293,7 @@ private:
GR_DEFINE_EFFECT_TEST(EllipseEdgeEffect); GR_DEFINE_EFFECT_TEST(EllipseEdgeEffect);
GrEffectRef* EllipseEdgeEffect::TestCreate(SkMWCRandom* random, GrEffectRef* EllipseEdgeEffect::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {
@ -454,7 +454,7 @@ private:
GR_DEFINE_EFFECT_TEST(DIEllipseEdgeEffect); GR_DEFINE_EFFECT_TEST(DIEllipseEdgeEffect);
GrEffectRef* DIEllipseEdgeEffect::TestCreate(SkMWCRandom* random, GrEffectRef* DIEllipseEdgeEffect::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {

View File

@ -949,7 +949,7 @@ template <typename T, typename C>
void GrRedBlackTree<T,C>::UnitTest() { void GrRedBlackTree<T,C>::UnitTest() {
GrRedBlackTree<int> tree; GrRedBlackTree<int> tree;
SkMWCRandom r; SkRandom r;
int count[100] = {0}; int count[100] = {0};
// add 10K ints // add 10K ints

View File

@ -144,7 +144,7 @@ bool GrConicEffect::onIsEqual(const GrEffect& other) const {
GR_DEFINE_EFFECT_TEST(GrConicEffect); GR_DEFINE_EFFECT_TEST(GrConicEffect);
GrEffectRef* GrConicEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrConicEffect::TestCreate(SkRandom* random,
GrContext*, GrContext*,
const GrDrawTargetCaps& caps, const GrDrawTargetCaps& caps,
GrTexture*[]) { GrTexture*[]) {
@ -278,7 +278,7 @@ bool GrQuadEffect::onIsEqual(const GrEffect& other) const {
GR_DEFINE_EFFECT_TEST(GrQuadEffect); GR_DEFINE_EFFECT_TEST(GrQuadEffect);
GrEffectRef* GrQuadEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrQuadEffect::TestCreate(SkRandom* random,
GrContext*, GrContext*,
const GrDrawTargetCaps& caps, const GrDrawTargetCaps& caps,
GrTexture*[]) { GrTexture*[]) {
@ -423,7 +423,7 @@ bool GrCubicEffect::onIsEqual(const GrEffect& other) const {
GR_DEFINE_EFFECT_TEST(GrCubicEffect); GR_DEFINE_EFFECT_TEST(GrCubicEffect);
GrEffectRef* GrCubicEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrCubicEffect::TestCreate(SkRandom* random,
GrContext*, GrContext*,
const GrDrawTargetCaps& caps, const GrDrawTargetCaps& caps,
GrTexture*[]) { GrTexture*[]) {

View File

@ -161,7 +161,7 @@ void GrBicubicEffect::getConstantColorComponents(GrColor* color, uint32_t* valid
GR_DEFINE_EFFECT_TEST(GrBicubicEffect); GR_DEFINE_EFFECT_TEST(GrBicubicEffect);
GrEffectRef* GrBicubicEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrBicubicEffect::TestCreate(SkRandom* random,
GrContext* context, GrContext* context,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {

View File

@ -134,7 +134,7 @@ void GrConfigConversionEffect::getConstantColorComponents(GrColor* color,
GR_DEFINE_EFFECT_TEST(GrConfigConversionEffect); GR_DEFINE_EFFECT_TEST(GrConfigConversionEffect);
GrEffectRef* GrConfigConversionEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrConfigConversionEffect::TestCreate(SkRandom* random,
GrContext*, GrContext*,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {

View File

@ -219,7 +219,7 @@ bool GrConvolutionEffect::onIsEqual(const GrEffect& sBase) const {
GR_DEFINE_EFFECT_TEST(GrConvolutionEffect); GR_DEFINE_EFFECT_TEST(GrConvolutionEffect);
GrEffectRef* GrConvolutionEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrConvolutionEffect::TestCreate(SkRandom* random,
GrContext*, GrContext*,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {

View File

@ -103,7 +103,7 @@ const GrBackendEffectFactory& GrSimpleTextureEffect::getFactory() const {
GR_DEFINE_EFFECT_TEST(GrSimpleTextureEffect); GR_DEFINE_EFFECT_TEST(GrSimpleTextureEffect);
GrEffectRef* GrSimpleTextureEffect::TestCreate(SkMWCRandom* random, GrEffectRef* GrSimpleTextureEffect::TestCreate(SkRandom* random,
GrContext*, GrContext*,
const GrDrawTargetCaps&, const GrDrawTargetCaps&,
GrTexture* textures[]) { GrTexture* textures[]) {

Some files were not shown because too many files have changed in this diff Show More