aboutsummaryrefslogtreecommitdiff
path: root/samplecode/SampleApp.cpp
diff options
context:
space:
mode:
authorreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-12 22:08:24 +0000
committerreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-12 22:08:24 +0000
commita6ff4dc22d5006dc588769aa20c8b0bb4fde6d43 (patch)
tree94b611f0c3c182b582c567bee346daac4acb1c1c /samplecode/SampleApp.cpp
parent12ad3aa49b8fae2a09a668414b0b908baf47c846 (diff)
add 'p' to toggle on/off testing the pipe
git-svn-id: http://skia.googlecode.com/svn/trunk@1317 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SampleApp.cpp')
-rw-r--r--samplecode/SampleApp.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index bbde4144ed..9b35be81b9 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -1039,6 +1039,7 @@ bool SampleWindow::onHandleChar(SkUnichar uni) {
break;
case 'p':
fUsePipe = !fUsePipe;
+ this->updateTitle();
this->inval(NULL);
break;
case 'r':
@@ -1283,6 +1284,12 @@ void SampleWindow::updateTitle() {
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 @@ void SampleWindow::onSizeChange() {
///////////////////////////////////////////////////////////////////////////////
+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::onEvent(const SkEvent& evt) {
}
bool SampleView::onQuery(SkEvent* evt) {
+ if (evt->isType(is_sample_view_tag)) {
+ return true;
+ }
return this->INHERITED::onQuery(evt);
}