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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // A set of scrolling line plots with the area between each plot filled. Stresse
s out GPU path | 81 // A set of scrolling line plots with the area between each plot filled. Stresse
s out GPU path |
82 // filling | 82 // filling |
83 class ChartView : public SampleView { | 83 class ChartView : public SampleView { |
84 public: | 84 public: |
85 ChartView() { | 85 ChartView() { |
86 fShift = 0; | 86 fShift = 0; |
87 fSize.set(-1, -1); | 87 fSize.set(-1, -1); |
88 } | 88 } |
89 | 89 |
90 protected: | 90 protected: |
91 virtual bool onQuery(SkEvent* evt) SK_OVERRIDE { | 91 bool onQuery(SkEvent* evt) SK_OVERRIDE { |
92 if (SampleCode::TitleQ(*evt)) { | 92 if (SampleCode::TitleQ(*evt)) { |
93 SampleCode::TitleR(evt, "Chart"); | 93 SampleCode::TitleR(evt, "Chart"); |
94 return true; | 94 return true; |
95 } | 95 } |
96 return this->INHERITED::onQuery(evt); | 96 return this->INHERITED::onQuery(evt); |
97 } | 97 } |
98 | 98 |
99 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { | 99 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { |
100 bool sizeChanged = false; | 100 bool sizeChanged = false; |
101 if (canvas->getDeviceSize() != fSize) { | 101 if (canvas->getDeviceSize() != fSize) { |
102 fSize = canvas->getDeviceSize(); | 102 fSize = canvas->getDeviceSize(); |
103 sizeChanged = true; | 103 sizeChanged = true; |
104 } | 104 } |
105 | 105 |
106 SkScalar ySpread = SkIntToScalar(fSize.fHeight / 20); | 106 SkScalar ySpread = SkIntToScalar(fSize.fHeight / 20); |
107 | 107 |
108 SkScalar height = SkIntToScalar(fSize.fHeight); | 108 SkScalar height = SkIntToScalar(fSize.fHeight); |
109 | 109 |
(...skipping 65 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 |