add 'p' to toggle on/off testing the pipe
git-svn-id: http://skia.googlecode.com/svn/trunk@1317 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index bbde414..9b35be8 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -1039,6 +1039,7 @@
break;
case 'p':
fUsePipe = !fUsePipe;
+ this->updateTitle();
this->inval(NULL);
break;
case 'r':
@@ -1283,6 +1284,12 @@
if (fMeasureFPS) {
title.appendf(" %4d ms", fMeasureFPS_Time);
}
+ if (fUsePipe && SampleView::IsSampleView(view)) {
+ title.prepend("<P> ");
+ }
+ if (SampleView::IsSampleView(view)) {
+ title.prepend("! ");
+ }
this->setTitle(title.c_str());
}
@@ -1321,9 +1328,15 @@
///////////////////////////////////////////////////////////////////////////////
+static const char is_sample_view_tag[] = "sample-is-sample-view";
static const char repeat_count_tag[] = "sample-set-repeat-count";
static const char set_use_pipe_tag[] = "sample-set-use-pipe";
+bool SampleView::IsSampleView(SkView* view) {
+ SkEvent evt(is_sample_view_tag);
+ return view->doQuery(&evt);
+}
+
bool SampleView::SetRepeatDraw(SkView* view, int count) {
SkEvent evt(repeat_count_tag);
evt.setFast32(count);
@@ -1349,6 +1362,9 @@
}
bool SampleView::onQuery(SkEvent* evt) {
+ if (evt->isType(is_sample_view_tag)) {
+ return true;
+ }
return this->INHERITED::onQuery(evt);
}