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;
bool fDoAA;
SkRect fDrawRect;
SkMWCRandom fRandom;
SkRandom fRandom;
static const int kNumDraws = SkBENCHLOOP(2);
static const int kNestingDepth = 3;

View File

@ -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);

View File

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

View File

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

View File

@ -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);

View File

@ -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) {

View File

@ -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();
}

View File

@ -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;

View File

@ -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];

View File

@ -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);

View File

@ -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) {

View File

@ -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);
}

View File

@ -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();
}

View File

@ -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;
};

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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();

View File

@ -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());
}

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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();

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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());

View File

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

View File

@ -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);

View File

@ -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);
}

View File

@ -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) {

View File

@ -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.

View File

@ -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);

View File

@ -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

View File

@ -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();

View File

@ -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) {

View File

@ -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) {

View File

@ -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);

View File

@ -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));

View File

@ -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) {

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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])

View File

@ -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;

View File

@ -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(

View File

@ -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;

View File

@ -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) {

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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);

View File

@ -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;

View File

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

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

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

View File

@ -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;

View File

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

View File

@ -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);
}

View File

@ -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));

View File

@ -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;

View File

@ -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++)

View File

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

View File

@ -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*[]) {

View File

@ -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[]) {

View File

@ -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]) {

View File

@ -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;

View File

@ -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[]) {

View File

@ -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[]) {

View File

@ -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) {

View File

@ -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[]) {

View File

@ -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[]) {

View File

@ -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**) {

View File

@ -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[]) {

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[],
SkScalar** stops,
SkShader::TileMode* tm) {

View File

@ -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);

View File

@ -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**) {

View File

@ -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**) {

View File

@ -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**) {

View File

@ -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**) {

View File

@ -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**) {

View File

@ -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*[]) {

View File

@ -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[]) {

View File

@ -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) {

View File

@ -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[]) {

View File

@ -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

View File

@ -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*[]) {

View File

@ -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[]) {

View File

@ -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[]) {

View File

@ -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[]) {

View File

@ -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[]) {

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