aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleSlides.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-12 21:13:48 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-12 21:13:48 +0000
commit7b1859034fd1febd69eeeca9efd5e3eb297fb168 (patch)
tree5a4cad9bd184003765d71d918e7c71ed3850ce6d /samplecode/SampleSlides.cpp
parent0a0726542ed62f07a2df5e1ac082472006355e66 (diff)
add init() method, so we don't draw in our constructor (makes debugging harder)
git-svn-id: http://skia.googlecode.com/svn/trunk@3368 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SampleSlides.cpp')
-rw-r--r--samplecode/SampleSlides.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp
index d39cee02b5..9b72afb726 100644
--- a/samplecode/SampleSlides.cpp
+++ b/samplecode/SampleSlides.cpp
@@ -724,8 +724,18 @@ static const SlideProc gProc[] = {
class SlideView : public SampleView {
int fIndex;
+ bool fOnce;
public:
SlideView() {
+ fOnce = false;
+ }
+
+ void init() {
+ if (fOnce) {
+ return;
+ }
+ fOnce = true;
+
fIndex = 0;
SkBitmap bm;
@@ -757,10 +767,12 @@ protected:
}
virtual void onDrawContent(SkCanvas* canvas) {
+ this->init();
gProc[fIndex](canvas);
}
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
+ this->init();
fIndex = (fIndex + 1) % SK_ARRAY_COUNT(gProc);
this->inval(NULL);
return NULL;