43 if (
nullptr == bottomData) {
49 leftShift %= topData.
size();
53 int shiftToEndCount = topData.
size() - leftShift;
54 plot->moveTo(
x, topData[leftShift]);
55 fill->
moveTo(
x, topData[leftShift]);
57 for (
int i = 1;
i < shiftToEndCount; ++
i) {
58 plot->lineTo(
x, topData[
i + leftShift]);
59 fill->
lineTo(
x, topData[
i + leftShift]);
63 for (
int i = 0;
i < leftShift; ++
i) {
64 plot->lineTo(
x, topData[
i]);
73 for (
int i = 0;
i < leftShift; ++
i) {
75 fill->
lineTo(
x, (*bottomData)[leftShift - 1 -
i]);
77 for (
int i = 0;
i < shiftToEndCount; ++
i) {
79 fill->
lineTo(
x, (*bottomData)[bottomData->
size() - 1 -
i]);
82 fill->
lineTo(
x - xDelta, yBase);
83 fill->
lineTo(xLeft, yBase);
108 bool sizeChanged =
false;
118 int dataPointCount =
std::max(fSize.
fWidth / kPixelsPerTick + 1, 2);
121 for (
int i = 0;
i < kNumGraphs; ++
i) {
124 gen_data(
y, ySpread, dataPointCount, &random, fData +
i);
130 for (
int i = 0;
i < kNumGraphs; ++
i) {
150 for (
int i = 0;
i < kNumGraphs; ++
i) {
162 canvas->
drawPath(fillPath, fillPaint);
165 canvas->
drawPath(plotPath, plotPaint);
167 prevData = fData +
i;
170 fShift += kShiftPerFrame;
static void gen_paths(const SkTDArray< SkScalar > &topData, const SkTDArray< SkScalar > *bottomData, SkScalar yBase, SkScalar xLeft, SkScalar xDelta, int leftShift, SkPath *plot, SkPath *fill)
static void gen_data(SkScalar yAvg, SkScalar ySpread, int count, SkRandom *random, SkTDArray< SkScalar > *dataPts)
const char * onGetName() override
void onDraw(int loops, SkCanvas *canvas) override
virtual SkISize getBaseLayerSize() const
void drawPath(const SkPath &path, const SkPaint &paint)
void setStyle(Style style)
void setColor(SkColor color)
void setAntiAlias(bool aa)
void setStrokeCap(Cap cap)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
void setStrokeJoin(Join join)
void setStrokeWidth(SkScalar width)
SkPath & moveTo(SkScalar x, SkScalar y)
SkPath & lineTo(SkScalar x, SkScalar y)
void incReserve(int extraPtCount, int extraVerbCount=0, int extraConicCount=0)
SkScalar nextRangeScalar(SkScalar min, SkScalar max)
static float max(float r, float g, float b)
PODArray< SkColor > colors
static void plot(SkCanvas *canvas, const char *fn, float xMin, float xMax, float yMin, float yMax, const char *label=nullptr, bool requireES3=false)