diff options
author | tfarina@chromium.org <tfarina@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-21 22:38:36 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-21 22:38:36 +0000 |
commit | 223137f49d1a4e805f5c1b1c20b7fd68719ac54b (patch) | |
tree | 511963f798f4ab68d8e2d0f5bfd33088b61f4522 /src/gpu | |
parent | 729e1c46cea63dfaa6e4a05608b8f3be41e19dce (diff) |
Remove GrRandom API in favor of SkRandom.
TEST=tests
R=bsalomon@google.com
Review URL: https://codereview.appspot.com/6855062
git-svn-id: http://skia.googlecode.com/svn/trunk@6539 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrClipMaskManager.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrRandom.h | 55 | ||||
-rw-r--r-- | src/gpu/GrRedBlackTree.h | 4 |
3 files changed, 4 insertions, 59 deletions
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index 893bcb18ef..772ba561ee 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -242,8 +242,8 @@ bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn) { #define VISUALIZE_COMPLEX_CLIP 0 #if VISUALIZE_COMPLEX_CLIP - #include "GrRandom.h" - GrRandom gRandom; + #include "SkRandom.h" + SkRandom gRandom; #define SET_RANDOM_COLOR drawState->setColor(0xff000000 | gRandom.nextU()); #else #define SET_RANDOM_COLOR diff --git a/src/gpu/GrRandom.h b/src/gpu/GrRandom.h deleted file mode 100644 index c98a8fbd94..0000000000 --- a/src/gpu/GrRandom.h +++ /dev/null @@ -1,55 +0,0 @@ - -/* - * Copyright 2010 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - - -#ifndef GrRandom_DEFINED -#define GrRandom_DEFINED - -class GrRandom { -public: - GrRandom() : fSeed(0) {} - GrRandom(uint32_t seed) : fSeed(seed) {} - - uint32_t seed() const { return fSeed; } - - uint32_t nextU() { - fSeed = fSeed * kMUL + kADD; - return fSeed; - } - - int32_t nextS() { return (int32_t)this->nextU(); } - - /** - * Returns value [0...1) as a float - */ - float nextF() { - // const is 1 / (2^32 - 1) - return (float)(this->nextU() * 2.32830644e-10); - } - - /** - * Returns value [min...max) as a float - */ - float nextF(float min, float max) { - return min + this->nextF() * (max - min); - } - -private: - /* - * These constants taken from "Numerical Recipes in C", reprinted 1999 - */ - enum { - kMUL = 1664525, - kADD = 1013904223 - }; - uint32_t fSeed; -}; - -#endif - diff --git a/src/gpu/GrRedBlackTree.h b/src/gpu/GrRedBlackTree.h index 8187d8160d..5038bb07bd 100644 --- a/src/gpu/GrRedBlackTree.h +++ b/src/gpu/GrRedBlackTree.h @@ -943,14 +943,14 @@ bool GrRedBlackTree<T,C>::validateChildRelations(const Node* n, } #endif -#include "GrRandom.h" +#include "SkRandom.h" template <typename T, typename C> void GrRedBlackTree<T,C>::UnitTest() { GrRedBlackTree<int> tree; typedef GrRedBlackTree<int>::Iter iter; - GrRandom r; + SkRandom r; int count[100] = {0}; // add 10K ints |