OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 fill->lineTo(x, topData[i + leftShift]); | 53 fill->lineTo(x, topData[i + leftShift]); |
54 x += xDelta; | 54 x += xDelta; |
55 } | 55 } |
56 | 56 |
57 for (int i = 0; i < leftShift; ++i) { | 57 for (int i = 0; i < leftShift; ++i) { |
58 plot->lineTo(x, topData[i]); | 58 plot->lineTo(x, topData[i]); |
59 fill->lineTo(x, topData[i]); | 59 fill->lineTo(x, topData[i]); |
60 x += xDelta; | 60 x += xDelta; |
61 } | 61 } |
62 | 62 |
63 if (NULL != bottomData) { | 63 if (bottomData) { |
64 SkASSERT(bottomData->count() == topData.count()); | 64 SkASSERT(bottomData->count() == topData.count()); |
65 // iterate backwards over the previous graph's data to generate the bott
om of the filled | 65 // iterate backwards over the previous graph's data to generate the bott
om of the filled |
66 // area (and account for leftShift). | 66 // area (and account for leftShift). |
67 for (int i = 0; i < leftShift; ++i) { | 67 for (int i = 0; i < leftShift; ++i) { |
68 x -= xDelta; | 68 x -= xDelta; |
69 fill->lineTo(x, (*bottomData)[leftShift - 1 - i]); | 69 fill->lineTo(x, (*bottomData)[leftShift - 1 - i]); |
70 } | 70 } |
71 for (int i = 0; i < shiftToEndCount; ++i) { | 71 for (int i = 0; i < shiftToEndCount; ++i) { |
72 x -= xDelta; | 72 x -= xDelta; |
73 fill->lineTo(x, (*bottomData)[bottomData->count() - 1 - i]); | 73 fill->lineTo(x, (*bottomData)[bottomData->count() - 1 - i]); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 int fShift; | 175 int fShift; |
176 SkISize fSize; | 176 SkISize fSize; |
177 SkTDArray<SkScalar> fData[kNumGraphs]; | 177 SkTDArray<SkScalar> fData[kNumGraphs]; |
178 typedef SampleView INHERITED; | 178 typedef SampleView INHERITED; |
179 }; | 179 }; |
180 | 180 |
181 ////////////////////////////////////////////////////////////////////////////// | 181 ////////////////////////////////////////////////////////////////////////////// |
182 | 182 |
183 static SkView* MyFactory() { return new ChartView; } | 183 static SkView* MyFactory() { return new ChartView; } |
184 static SkViewRegister reg(MyFactory); | 184 static SkViewRegister reg(MyFactory); |
OLD | NEW |