aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/ChartBench.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'bench/ChartBench.cpp')
-rw-r--r--bench/ChartBench.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/bench/ChartBench.cpp b/bench/ChartBench.cpp
index 0693f49da0..0a692cfc80 100644
--- a/bench/ChartBench.cpp
+++ b/bench/ChartBench.cpp
@@ -94,6 +94,8 @@ public:
ChartBench(void* param, bool aa) : SkBenchmark(param) {
fShift = 0;
fAA = aa;
+ fSize.fWidth = -1;
+ fSize.fHeight = -1;
}
protected:
@@ -115,18 +117,17 @@ protected:
SkScalar ySpread = SkIntToScalar(fSize.fHeight / 20);
SkScalar height = SkIntToScalar(fSize.fHeight);
+ if (sizeChanged) {
+ int dataPointCount = SkMax32(fSize.fWidth / kPixelsPerTick + 1, 2);
- for (int frame = 0; frame < kFramesPerRun; ++frame) {
- if (sizeChanged) {
- int dataPointCount = SkMax32(fSize.fWidth / kPixelsPerTick + 1, 2);
-
- for (int i = 0; i < kNumGraphs; ++i) {
- SkScalar y = (kNumGraphs - i) * (height - ySpread) / (kNumGraphs + 1);
- fData[i].reset();
- gen_data(y, ySpread, dataPointCount, fData + i);
- }
- sizeChanged = false;
+ for (int i = 0; i < kNumGraphs; ++i) {
+ SkScalar y = (kNumGraphs - i) * (height - ySpread) / (kNumGraphs + 1);
+ fData[i].reset();
+ gen_data(y, ySpread, dataPointCount, fData + i);
}
+ }
+
+ for (int frame = 0; frame < kFramesPerRun; ++frame) {
canvas->clear(0xFFE0F0E0);