Go to the source code of this file.
|
static void | gen_data (SkScalar yAvg, SkScalar ySpread, int count, SkTDArray< SkScalar > *dataPts) |
|
static void | gen_paths (const SkTDArray< SkScalar > &topData, const SkTDArray< SkScalar > *bottomData, SkScalar yBase, SkScalar xLeft, SkScalar xDelta, int leftShift, SkPathBuilder *plot, SkPathBuilder *fill) |
|
◆ gen_data()
Definition at line 16 of file ChartSlide.cpp.
16 {
22 }
23}
SkScalar nextRangeScalar(SkScalar min, SkScalar max)
◆ gen_paths()
Definition at line 29 of file ChartSlide.cpp.
34 {
36 if (nullptr == bottomData) {
38 } else {
40 }
41
42 leftShift %= topData.
size();
44
45
46 int shiftToEndCount = topData.
size() - leftShift;
47 plot->moveTo(
x, topData[leftShift]);
48 fill->
moveTo(
x, topData[leftShift]);
49
50 for (
int i = 1;
i < shiftToEndCount; ++
i) {
51 plot->lineTo(
x, topData[
i + leftShift]);
52 fill->
lineTo(
x, topData[
i + leftShift]);
54 }
55
56 for (
int i = 0;
i < leftShift; ++
i) {
57 plot->lineTo(
x, topData[
i]);
60 }
61
62 if (bottomData) {
64
65
66 for (
int i = 0;
i < leftShift; ++
i) {
68 fill->
lineTo(
x, (*bottomData)[leftShift - 1 -
i]);
69 }
70 for (
int i = 0;
i < shiftToEndCount; ++
i) {
72 fill->
lineTo(
x, (*bottomData)[bottomData->
size() - 1 -
i]);
73 }
74 } else {
75 fill->
lineTo(
x - xDelta, yBase);
76 fill->
lineTo(xLeft, yBase);
77 }
78}
SkPathBuilder & lineTo(SkPoint pt)
void incReserve(int extraPtCount, int extraVerbCount)
SkPathBuilder & moveTo(SkPoint pt)
static void plot(SkCanvas *canvas, const char *fn, float xMin, float xMax, float yMin, float yMax, const char *label=nullptr, bool requireES3=false)