diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-09 20:09:12 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-09 20:09:12 +0000 |
commit | e0e7cfe44bb9d66d76120a79e5275c294bacaa22 (patch) | |
tree | d3d282beb8e498659f87abafa5a651946eea6ee8 /samplecode | |
parent | 50b2e33dc6acaed906bfdc89af9b359ea2665c52 (diff) |
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
Diffstat (limited to 'samplecode')
-rw-r--r-- | samplecode/SampleAnimBlur.cpp | 2 | ||||
-rw-r--r-- | samplecode/SampleApp.cpp | 4 | ||||
-rw-r--r-- | samplecode/SampleChart.cpp | 4 | ||||
-rw-r--r-- | samplecode/SampleClip.cpp | 8 | ||||
-rw-r--r-- | samplecode/SampleCull.cpp | 4 | ||||
-rw-r--r-- | samplecode/SampleEmptyPath.cpp | 2 | ||||
-rw-r--r-- | samplecode/SampleFontCache.cpp | 4 | ||||
-rw-r--r-- | samplecode/SampleHairCurves.cpp | 4 | ||||
-rw-r--r-- | samplecode/SampleManyRects.cpp | 2 | ||||
-rw-r--r-- | samplecode/SamplePathEffects.cpp | 2 | ||||
-rw-r--r-- | samplecode/SamplePicture.cpp | 2 | ||||
-rw-r--r-- | samplecode/SamplePoints.cpp | 4 | ||||
-rw-r--r-- | samplecode/SampleRotateCircles.cpp | 2 | ||||
-rw-r--r-- | samplecode/SampleSlides.cpp | 2 | ||||
-rw-r--r-- | samplecode/SampleStrokePath.cpp | 2 | ||||
-rw-r--r-- | samplecode/SampleText.cpp | 4 | ||||
-rw-r--r-- | samplecode/SampleTextAlpha.cpp | 2 | ||||
-rw-r--r-- | samplecode/SampleVertices.cpp | 2 |
18 files changed, 28 insertions, 28 deletions
diff --git a/samplecode/SampleAnimBlur.cpp b/samplecode/SampleAnimBlur.cpp index 1109fdfabf..5d6638ad87 100644 --- a/samplecode/SampleAnimBlur.cpp +++ b/samplecode/SampleAnimBlur.cpp @@ -43,7 +43,7 @@ protected: SkBlurMaskFilter::kSolid_BlurStyle, SkBlurMaskFilter::kOuter_BlurStyle, }; - SkMWCRandom random; + SkRandom random; for (size_t i = 0; i < SK_ARRAY_COUNT(gStyles); ++i) { SkMaskFilter* mf = SkBlurMaskFilter::Create( diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index ee51095de8..a5338d0ca2 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -2435,7 +2435,7 @@ template <typename T> void SkTBSort(T array[], int count) { #include "SkRandom.h" -static void rand_rect(SkIRect* rect, SkMWCRandom& rand) { +static void rand_rect(SkIRect* rect, SkRandom& rand) { int bits = 8; int shift = 32 - bits; rect->set(rand.nextU() >> shift, rand.nextU() >> shift, @@ -2499,7 +2499,7 @@ static void test() { test_rects(gRecs[i].fRects, gRecs[i].fCount); } - SkMWCRandom rand; + SkRandom rand; for (i = 0; i < 10000; i++) { SkRegion rgn0, rgn1; diff --git a/samplecode/SampleChart.cpp b/samplecode/SampleChart.cpp index 68d750f881..35f8206f76 100644 --- a/samplecode/SampleChart.cpp +++ b/samplecode/SampleChart.cpp @@ -16,7 +16,7 @@ namespace { // Generates y values for the chart plots. void gen_data(SkScalar yAvg, SkScalar ySpread, int count, SkTDArray<SkScalar>* dataPts) { dataPts->setCount(count); - static SkMWCRandom gRandom; + static SkRandom gRandom; for (int i = 0; i < count; ++i) { (*dataPts)[i] = gRandom.nextRangeScalar(yAvg - SkScalarHalf(ySpread), yAvg + SkScalarHalf(ySpread)); @@ -123,7 +123,7 @@ protected: canvas->clear(0xFFE0F0E0); - static SkMWCRandom colorRand; + static SkRandom colorRand; static SkColor gColors[kNumGraphs] = { 0x0 }; if (0 == gColors[0]) { for (int i = 0; i < kNumGraphs; ++i) { diff --git a/samplecode/SampleClip.cpp b/samplecode/SampleClip.cpp index a35f42c318..3a38724e9c 100644 --- a/samplecode/SampleClip.cpp +++ b/samplecode/SampleClip.cpp @@ -17,7 +17,7 @@ #define H 200 static void show_text(SkCanvas* canvas, bool doAA) { - SkMWCRandom rand; + SkRandom rand; SkPaint paint; paint.setAntiAlias(doAA); paint.setLCDRenderText(true); @@ -32,7 +32,7 @@ static void show_text(SkCanvas* canvas, bool doAA) { } static void show_fill(SkCanvas* canvas, bool doAA) { - SkMWCRandom rand; + SkRandom rand; SkPaint paint; paint.setAntiAlias(doAA); @@ -53,13 +53,13 @@ static void show_fill(SkCanvas* canvas, bool doAA) { } } -static SkScalar randRange(SkMWCRandom& rand, SkScalar min, SkScalar max) { +static SkScalar randRange(SkRandom& rand, SkScalar min, SkScalar max) { SkASSERT(min <= max); return min + SkScalarMul(rand.nextUScalar1(), max - min); } static void show_stroke(SkCanvas* canvas, bool doAA, SkScalar strokeWidth, int n) { - SkMWCRandom rand; + SkRandom rand; SkPaint paint; paint.setAntiAlias(doAA); paint.setStyle(SkPaint::kStroke_Style); diff --git a/samplecode/SampleCull.cpp b/samplecode/SampleCull.cpp index e6b110a96a..18f2d0cc40 100644 --- a/samplecode/SampleCull.cpp +++ b/samplecode/SampleCull.cpp @@ -96,7 +96,7 @@ FINISHED2: return array; } -static SkScalar nextScalarRange(SkMWCRandom& rand, SkScalar min, SkScalar max) { +static SkScalar nextScalarRange(SkRandom& rand, SkScalar min, SkScalar max) { return min + SkScalarMul(rand.nextUScalar1(), max - min); } @@ -105,7 +105,7 @@ public: CullView() { fClip.set(0, 0, SkIntToScalar(160), SkIntToScalar(160)); - SkMWCRandom rand; + SkRandom rand; for (int i = 0; i < 50; i++) { SkScalar x = nextScalarRange(rand, -fClip.width()*1, fClip.width()*2); diff --git a/samplecode/SampleEmptyPath.cpp b/samplecode/SampleEmptyPath.cpp index 986a088b5e..51c570eb43 100644 --- a/samplecode/SampleEmptyPath.cpp +++ b/samplecode/SampleEmptyPath.cpp @@ -73,7 +73,7 @@ protected: 100*SK_Scalar1, titlePaint); - SkMWCRandom rand; + SkRandom rand; SkRect rect = SkRect::MakeWH(125*SK_Scalar1, 100*SK_Scalar1); int i = 0; canvas->save(); diff --git a/samplecode/SampleFontCache.cpp b/samplecode/SampleFontCache.cpp index 050867effa..c5f4457729 100644 --- a/samplecode/SampleFontCache.cpp +++ b/samplecode/SampleFontCache.cpp @@ -16,7 +16,7 @@ static void call_measure() { SkPaint paint; uint16_t text[32]; - SkMWCRandom rand; + SkRandom rand; paint.setAntiAlias(true); paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); @@ -35,7 +35,7 @@ static void call_measure() { static void call_draw(SkCanvas* canvas) { SkPaint paint; uint16_t text[32]; - SkMWCRandom rand; + SkRandom rand; paint.setAntiAlias(true); paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); diff --git a/samplecode/SampleHairCurves.cpp b/samplecode/SampleHairCurves.cpp index 421c950183..2cf0b3c900 100644 --- a/samplecode/SampleHairCurves.cpp +++ b/samplecode/SampleHairCurves.cpp @@ -34,8 +34,8 @@ protected: paint.setStrokeWidth(0); canvas->save(); canvas->scale(1000 * SK_Scalar1, 1000 * SK_Scalar1); - SkMWCRandom rand; - SkMWCRandom randW; + SkRandom rand; + SkRandom randW; SkPath curves; SkPath hulls; SkPath ctrlPts; diff --git a/samplecode/SampleManyRects.cpp b/samplecode/SampleManyRects.cpp index d5d71f4267..5182341c71 100644 --- a/samplecode/SampleManyRects.cpp +++ b/samplecode/SampleManyRects.cpp @@ -69,7 +69,7 @@ protected: } private: - SkMWCRandom fRandom; + SkRandom fRandom; typedef SampleView INHERITED; }; diff --git a/samplecode/SamplePathEffects.cpp b/samplecode/SamplePathEffects.cpp index 4c6d03cbf9..ac77f210de 100644 --- a/samplecode/SamplePathEffects.cpp +++ b/samplecode/SamplePathEffects.cpp @@ -102,7 +102,7 @@ class PathEffectView : public SampleView { SkPoint fClickPt; public: PathEffectView() { - SkMWCRandom rand; + SkRandom rand; int steps = 20; SkScalar dist = SkIntToScalar(400); SkScalar x = SkIntToScalar(20); diff --git a/samplecode/SamplePicture.cpp b/samplecode/SamplePicture.cpp index 8afebc4523..825e561654 100644 --- a/samplecode/SamplePicture.cpp +++ b/samplecode/SamplePicture.cpp @@ -165,7 +165,7 @@ protected: // test that we can re-record a subpicture, and see the results - SkMWCRandom rand(SampleCode::GetAnimTime()); + SkRandom rand(SampleCode::GetAnimTime()); canvas->translate(SkIntToScalar(10), SkIntToScalar(250)); drawCircle(fSubPicture->beginRecording(50, 50), 25, rand.nextU() | 0xFF000000); diff --git a/samplecode/SamplePoints.cpp b/samplecode/SamplePoints.cpp index 3bb8126f57..ac2f625f99 100644 --- a/samplecode/SamplePoints.cpp +++ b/samplecode/SamplePoints.cpp @@ -41,7 +41,7 @@ protected: return this->INHERITED::onQuery(evt); } - static void fill_pts(SkPoint pts[], size_t n, SkMWCRandom* rand) { + static void fill_pts(SkPoint pts[], size_t n, SkRandom* rand) { for (size_t i = 0; i < n; i++) pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480); } @@ -49,7 +49,7 @@ protected: virtual void onDrawContent(SkCanvas* canvas) { canvas->translate(SK_Scalar1, SK_Scalar1); - SkMWCRandom rand; + SkRandom rand; SkPaint p0, p1, p2, p3; const size_t n = 99; diff --git a/samplecode/SampleRotateCircles.cpp b/samplecode/SampleRotateCircles.cpp index 2dd5be94a6..1f586be4fe 100644 --- a/samplecode/SampleRotateCircles.cpp +++ b/samplecode/SampleRotateCircles.cpp @@ -38,7 +38,7 @@ protected: } virtual void onDrawContent(SkCanvas* canvas) { - SkMWCRandom rand; + SkRandom rand; SkPaint paint; paint.setAntiAlias(true); paint.setStrokeWidth(20); diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp index 7a102469c7..98e4e72618 100644 --- a/samplecode/SampleSlides.cpp +++ b/samplecode/SampleSlides.cpp @@ -350,7 +350,7 @@ public: static void make_tris(Rec* rec) { int n = 10; - SkMWCRandom rand; + SkRandom rand; rec->fMode = SkCanvas::kTriangles_VertexMode; rec->fCount = n * 3; diff --git a/samplecode/SampleStrokePath.cpp b/samplecode/SampleStrokePath.cpp index dbf6bd4993..ce6a010347 100644 --- a/samplecode/SampleStrokePath.cpp +++ b/samplecode/SampleStrokePath.cpp @@ -132,7 +132,7 @@ protected: return this->INHERITED::onQuery(evt); } - SkMWCRandom rand; + SkRandom rand; void drawSet(SkCanvas* canvas, SkPaint* paint) { SkAutoCanvasRestore acr(canvas, true); diff --git a/samplecode/SampleText.cpp b/samplecode/SampleText.cpp index b4091ff328..c6aaa52a0b 100644 --- a/samplecode/SampleText.cpp +++ b/samplecode/SampleText.cpp @@ -135,7 +135,7 @@ static void test_breakText() { SkASSERT(mm == width); } -static SkMWCRandom gRand; +static SkRandom gRand; class SkPowerMode : public SkXfermode { public: @@ -287,7 +287,7 @@ protected: canvas.drawText(s, strlen(s), SkIntToScalar(8), SkIntToScalar(14), paint); } - static void fill_pts(SkPoint pts[], size_t n, SkMWCRandom* rand) { + static void fill_pts(SkPoint pts[], size_t n, SkRandom* rand) { for (size_t i = 0; i < n; i++) pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480); } diff --git a/samplecode/SampleTextAlpha.cpp b/samplecode/SampleTextAlpha.cpp index 8f8ae4fad0..83616f4260 100644 --- a/samplecode/SampleTextAlpha.cpp +++ b/samplecode/SampleTextAlpha.cpp @@ -74,7 +74,7 @@ protected: SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3)))); paint.getMaskFilter()->unref(); - SkMWCRandom rand; + SkRandom rand; for (int ps = 6; ps <= 35; ps++) { paint.setColor(rand.nextU() | (0xFF << 24)); diff --git a/samplecode/SampleVertices.cpp b/samplecode/SampleVertices.cpp index d71a1aefde..53db2ea3fa 100644 --- a/samplecode/SampleVertices.cpp +++ b/samplecode/SampleVertices.cpp @@ -144,7 +144,7 @@ private: void make_tris(Rec* rec) { int n = 10; - SkMWCRandom rand; + SkRandom rand; rec->fMode = SkCanvas::kTriangles_VertexMode; rec->fCount = n * 3; |