Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: tests/PictureTest.cpp

Issue 12334131: Change random number generator for tests to SkMWCRandom (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Rebase to latest Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/PathTest.cpp ('k') | tests/RTreeTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PictureTest.cpp
===================================================================
--- tests/PictureTest.cpp (revision 7902)
+++ tests/PictureTest.cpp (working copy)
@@ -73,7 +73,7 @@
return pic;
}
-static void rand_rect(SkRect* rect, SkRandom& rand, SkScalar W, SkScalar H) {
+static void rand_rect(SkRect* rect, SkMWCRandom& rand, SkScalar W, SkScalar H) {
rect->fLeft = rand.nextRangeScalar(-W, 2*W);
rect->fTop = rand.nextRangeScalar(-H, 2*H);
rect->fRight = rect->fLeft + rand.nextRangeScalar(0, W);
@@ -176,7 +176,7 @@
drawbitmap_proc, drawbitmaprect_proc, drawshader_proc
};
- SkRandom rand;
+ SkMWCRandom rand;
for (size_t k = 0; k < SK_ARRAY_COUNT(procs); ++k) {
SkAutoTUnref<SkPicture> pic(record_bitmaps(bm, pos, N, procs[k]));
@@ -259,7 +259,7 @@
}
#endif
-static void rand_op(SkCanvas* canvas, SkRandom& rand) {
+static void rand_op(SkCanvas* canvas, SkMWCRandom& rand) {
SkPaint paint;
SkRect rect = SkRect::MakeWH(50, 50);
@@ -280,10 +280,10 @@
}
static void test_peephole() {
- SkRandom rand;
+ SkMWCRandom rand;
for (int j = 0; j < 100; j++) {
- SkRandom rand2(rand.getSeed()); // remember the seed
+ SkMWCRandom rand2(rand); // remember the seed
SkPicture picture;
SkCanvas* canvas = picture.beginRecording(100, 100);
@@ -292,6 +292,8 @@
rand_op(canvas, rand);
}
picture.endRecording();
+
+ rand = rand2;
}
{
« no previous file with comments | « tests/PathTest.cpp ('k') | tests/RTreeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698