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

Unified Diff: gm/points.cpp

Issue 23576015: Change old PRG to be SkLCGRandom; change new one to SkRandom (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix some spurious SkMWCRandoms Created 7 years, 3 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 | « gm/ovals.cpp ('k') | gm/quadpaths.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/points.cpp
diff --git a/gm/points.cpp b/gm/points.cpp
index 0a83acf05f742763f3757334149202e751ae7905..150a0ef6dc92eb12d58784083fad939181ed6a0d 100644
--- a/gm/points.cpp
+++ b/gm/points.cpp
@@ -1,73 +1,73 @@
-
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "gm.h"
-#include "SkRandom.h"
-
-namespace skiagm {
-
-class PointsGM : public GM {
-public:
- PointsGM() {}
-
-protected:
- virtual SkString onShortName() {
- return SkString("points");
- }
-
- virtual SkISize onISize() {
- return make_isize(640, 490);
- }
-
- static void fill_pts(SkPoint pts[], size_t n, SkRandom* 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
- // evaluation order across compilers.
- SkScalar y = rand->nextUScalar1() * 480;
- SkScalar x = rand->nextUScalar1() * 640;
- pts[i].set(x, y);
- }
- }
-
- virtual void onDraw(SkCanvas* canvas) {
- canvas->translate(SK_Scalar1, SK_Scalar1);
-
- SkRandom rand;
- SkPaint p0, p1, p2, p3;
- const size_t n = 99;
-
- p0.setColor(SK_ColorRED);
- p1.setColor(SK_ColorGREEN);
- p2.setColor(SK_ColorBLUE);
- p3.setColor(SK_ColorWHITE);
-
- p0.setStrokeWidth(SkIntToScalar(4));
- p2.setStrokeCap(SkPaint::kRound_Cap);
- p2.setStrokeWidth(SkIntToScalar(6));
-
- SkPoint* pts = new SkPoint[n];
- fill_pts(pts, n, &rand);
-
- canvas->drawPoints(SkCanvas::kPolygon_PointMode, n, pts, p0);
- canvas->drawPoints(SkCanvas::kLines_PointMode, n, pts, p1);
- canvas->drawPoints(SkCanvas::kPoints_PointMode, n, pts, p2);
- canvas->drawPoints(SkCanvas::kPoints_PointMode, n, pts, p3);
-
- delete[] pts;
- }
-
-private:
- typedef GM INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-static GM* MyFactory(void*) { return new PointsGM; }
-static GMRegistry reg(MyFactory);
-
-}
+
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include "gm.h"
+#include "SkRandom.h"
+
+namespace skiagm {
+
+class PointsGM : public GM {
+public:
+ PointsGM() {}
+
+protected:
+ virtual SkString onShortName() {
+ return SkString("points");
+ }
+
+ virtual SkISize onISize() {
+ return make_isize(640, 490);
+ }
+
+ 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
+ // evaluation order across compilers.
+ SkScalar y = rand->nextUScalar1() * 480;
+ SkScalar x = rand->nextUScalar1() * 640;
+ pts[i].set(x, y);
+ }
+ }
+
+ virtual void onDraw(SkCanvas* canvas) {
+ canvas->translate(SK_Scalar1, SK_Scalar1);
+
+ SkLCGRandom rand;
+ SkPaint p0, p1, p2, p3;
+ const size_t n = 99;
+
+ p0.setColor(SK_ColorRED);
+ p1.setColor(SK_ColorGREEN);
+ p2.setColor(SK_ColorBLUE);
+ p3.setColor(SK_ColorWHITE);
+
+ p0.setStrokeWidth(SkIntToScalar(4));
+ p2.setStrokeCap(SkPaint::kRound_Cap);
+ p2.setStrokeWidth(SkIntToScalar(6));
+
+ SkPoint* pts = new SkPoint[n];
+ fill_pts(pts, n, &rand);
+
+ canvas->drawPoints(SkCanvas::kPolygon_PointMode, n, pts, p0);
+ canvas->drawPoints(SkCanvas::kLines_PointMode, n, pts, p1);
+ canvas->drawPoints(SkCanvas::kPoints_PointMode, n, pts, p2);
+ canvas->drawPoints(SkCanvas::kPoints_PointMode, n, pts, p3);
+
+ delete[] pts;
+ }
+
+private:
+ typedef GM INHERITED;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+static GM* MyFactory(void*) { return new PointsGM; }
+static GMRegistry reg(MyFactory);
+
+}
« no previous file with comments | « gm/ovals.cpp ('k') | gm/quadpaths.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698