aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/ChartBench.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-22 16:07:59 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-22 16:07:59 +0000
commitcd7421bf3833314a400a53dda7fca5959ac7fff0 (patch)
treec63367d3e617c39f6ac001234aa11eeecd71ed49 /bench/ChartBench.cpp
parentad51132b1b494e9921c500167adc899e6cfc8684 (diff)
Fix ChartBench crash.
git-svn-id: http://skia.googlecode.com/svn/trunk@7826 2bbb7eff-a529-9590-31e7-b0007b416f81
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);