aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/PictureNestingBench.cpp
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-01-09 08:33:36 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-09 08:33:36 -0800
commitd0256a2fbcc344a7eabea76a083372260cab0969 (patch)
tree14c2905e5c42815c88c7219084eeb6ed5c1d7b86 /bench/PictureNestingBench.cpp
parentfcfea99d9d27284f2ef3cb30ba400f53d443a6e6 (diff)
PictureNestingBench: stay in ints.
Diffstat (limited to 'bench/PictureNestingBench.cpp')
-rw-r--r--bench/PictureNestingBench.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/bench/PictureNestingBench.cpp b/bench/PictureNestingBench.cpp
index 7868f46c9f..a3193e61aa 100644
--- a/bench/PictureNestingBench.cpp
+++ b/bench/PictureNestingBench.cpp
@@ -14,8 +14,6 @@
#include "SkPictureRecorder.h"
#include "SkString.h"
-#include <math.h>
-
class PictureNesting : public Benchmark {
public:
PictureNesting(const char* name, int maxLevel, int maxPictureLevel)
@@ -93,7 +91,13 @@ private:
// f(0) = 0
// via "recursive function to closed form" tricks
// f(m) = 1/2 (3^m - 1)
- return static_cast<int>((pow(3.0, fMaxPictureLevel) - 1.0) / 2.0);
+ int pics = 1;
+ for (int i = 0; i < fMaxPictureLevel; i++) {
+ pics *= 3;
+ }
+ pics--;
+ pics /= 2;
+ return pics;
}
SkString fName;