From 6f449692c148c6b36d65c4bfa2941e3b09e25c38 Mon Sep 17 00:00:00 2001 From: Jim Van Verth Date: Tue, 14 Feb 2017 15:16:46 -0500 Subject: Add more SampleApp support to viewer. Fixes loading a Sample as first slide. Adds char input. Adds --slide and --list options. Change-Id: I34b66818e3673fcfdc649443e7d9dfb74b478062 Reviewed-on: https://skia-review.googlesource.com/8445 Reviewed-by: Brian Osman Commit-Queue: Jim Van Verth --- samplecode/SampleAndroidShadows.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'samplecode/SampleAndroidShadows.cpp') diff --git a/samplecode/SampleAndroidShadows.cpp b/samplecode/SampleAndroidShadows.cpp index 0e0a4b4a79..803ea49f4a 100644 --- a/samplecode/SampleAndroidShadows.cpp +++ b/samplecode/SampleAndroidShadows.cpp @@ -70,32 +70,43 @@ protected: SkUnichar uni; if (SampleCode::CharQ(*evt, &uni)) { + bool handled = false; switch (uni) { case 'W': fShowAmbient = !fShowAmbient; + handled = true; break; case 'S': fShowSpot = !fShowSpot; + handled = true; break; case 'T': fUseAlt = !fUseAlt; + handled = true; break; case 'O': fShowObject = !fShowObject; + handled = true; break; case '>': fZDelta += 0.5f; + handled = true; break; case '<': fZDelta -= 0.5f; + handled = true; break; case '?': fIgnoreShadowAlpha = !fIgnoreShadowAlpha; + handled = true; break; default: break; } - this->inval(nullptr); + if (handled) { + this->inval(nullptr); + return true; + } } return this->INHERITED::onQuery(evt); } @@ -503,7 +514,7 @@ protected: } private: - typedef SkView INHERITED; + typedef SampleView INHERITED; }; ////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3