aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/SampleApp.cpp10
-rw-r--r--samplecode/SampleApp.h1
2 files changed, 6 insertions, 5 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 2d5d0ca9c9..9c2b7d1344 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -53,9 +53,9 @@ extern SkView* create_overview(int, const SkViewFactory[]);
///////////////
static const char view_inval_msg[] = "view-inval-msg";
-static void postInvalDelay(SkEventSinkID sinkID) {
+void SampleWindow::postInvalDelay() {
SkEvent* evt = new SkEvent(view_inval_msg);
- evt->post(sinkID, 1);
+ evt->post(this->getSinkID(), 1);
}
static bool isInvalEvent(const SkEvent& evt) {
@@ -844,7 +844,7 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
if (fMeasureFPS && fMeasureFPS_Time) {
fMeasureFPS_Time = SkTime::GetMSecs() - fMeasureFPS_Time;
this->updateTitle();
- postInvalDelay(this->getSinkID());
+ this->postInvalDelay();
}
// if ((fScrollTestX | fScrollTestY) != 0)
@@ -928,7 +928,7 @@ void SampleWindow::changeZoomLevel(float delta) {
}
bool SampleWindow::previousSample() {
- fCurrIndex = (fCurrIndex - 1) % fSamples.count();
+ fCurrIndex = (fCurrIndex - 1 + fSamples.count()) % fSamples.count();
this->loadView(fSamples[fCurrIndex]());
return true;
}
@@ -1428,7 +1428,7 @@ void SampleWindow::onSizeChange() {
#ifdef ANDROID
// FIXME: The first draw after a size change does not work on Android, so
// we post an invalidate.
- postInvalDelay(this->getSinkID());
+ this->postInvalDelay();
#endif
this->updateTitle(); // to refresh our config
}
diff --git a/samplecode/SampleApp.h b/samplecode/SampleApp.h
index a58c68873e..4d16121d04 100644
--- a/samplecode/SampleApp.h
+++ b/samplecode/SampleApp.h
@@ -61,6 +61,7 @@ public:
bool handleTouch(int ownerId, float x, float y,
SkView::Click::State state);
void saveToPdf();
+ void postInvalDelay();
protected:
virtual void onDraw(SkCanvas* canvas);