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

Unified Diff: include/utils/SkRandom.h

Issue 122293002: Revert "Revert of https://codereview.chromium.org/113823003/" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 | « include/core/SkTypes.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/utils/SkRandom.h
diff --git a/include/utils/SkRandom.h b/include/utils/SkRandom.h
index eeaa701c6ec64bf209e11bd3c5aecbd09c3ea570..9191ec35c14e39b4a7882024a4bf22e4c06975b4 100644
--- a/include/utils/SkRandom.h
+++ b/include/utils/SkRandom.h
@@ -10,9 +10,12 @@
#ifndef SkRandom_DEFINED
#define SkRandom_DEFINED
-#include "Sk64.h"
#include "SkScalar.h"
+#ifdef SK_SUPPORT_LEGACY_SK64
+ #include "Sk64.h"
+#endif
+
/** \class SkLCGRandom
Utility class that implements pseudo random 32bit numbers using a fast
@@ -123,13 +126,21 @@ public:
return this->nextUScalar1() <= fractionTrue;
}
- /** Return the next pseudo random number as a signed 64bit value.
- */
+ /**
+ * Return the next pseudo random number as a signed 64bit value.
+ */
+ int64_t next64() {
+ int64_t hi = this->nextS();
+ return (hi << 32) | this->nextU();
+ }
+
+#ifdef SK_SUPPORT_LEGACY_SK64
+ SK_ATTR_DEPRECATED("use next64()")
void next64(Sk64* a) {
SkASSERT(a);
a->set(this->nextS(), this->nextU());
}
-
+#endif
/**
* Return the current seed. This allows the caller to later reset to the
* same seed (using setSeed) so it can generate the same sequence.
@@ -276,12 +287,21 @@ public:
return this->nextUScalar1() <= fractionTrue;
}
- /** Return the next pseudo random number as a signed 64bit value.
+ /**
+ * Return the next pseudo random number as a signed 64bit value.
*/
+ int64_t next64() {
+ int64_t hi = this->nextS();
+ return (hi << 32) | this->nextU();
+ }
+
+#ifdef SK_SUPPORT_LEGACY_SK64
+ SK_ATTR_DEPRECATED("use next64()")
void next64(Sk64* a) {
SkASSERT(a);
a->set(this->nextS(), this->nextU());
}
+#endif
/** Reset the random object.
*/
« no previous file with comments | « include/core/SkTypes.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698