diff options
author | 2016-08-04 08:39:41 -0700 | |
---|---|---|
committer | 2016-08-04 08:39:41 -0700 | |
commit | b83cdbcbb0829bf6e0c9cb2c7d9a0ff460f7f431 (patch) | |
tree | 798a8675ec2ec33174fca44ef003f46de42b83dd /samplecode | |
parent | 2825bad08cc2ad63f0f11f50039c944914d07e0a (diff) |
Show SVG file name in SampleApp title
R=robertphillips@google.com,stephana@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2217483002
Review-Url: https://codereview.chromium.org/2217483002
Diffstat (limited to 'samplecode')
-rw-r--r-- | samplecode/SampleSVGFile.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/samplecode/SampleSVGFile.cpp b/samplecode/SampleSVGFile.cpp index 01a1958f11..12c91a95fe 100644 --- a/samplecode/SampleSVGFile.cpp +++ b/samplecode/SampleSVGFile.cpp @@ -8,6 +8,7 @@ #include "SampleCode.h" #include "SkCanvas.h" #include "SkDOM.h" +#include "SkOSFile.h" #include "SkStream.h" #include "SkSVGDOM.h" #include "SkView.h" @@ -16,7 +17,8 @@ namespace { class SVGFileView : public SampleView { public: - SVGFileView(const char path[]) { + SVGFileView(const char path[]) + : fLabel(SkStringPrintf("[%s]", SkOSPath::Basename(path).c_str())) { SkFILEStream svgStream(path); if (!svgStream.isValid()) { SkDebugf("file not found: \"path\"\n", path); @@ -49,8 +51,17 @@ protected: this->INHERITED::onSizeChange(); } + bool onQuery(SkEvent* evt) override { + if (SampleCode::TitleQ(*evt)) { + SampleCode::TitleR(evt, fLabel.c_str()); + return true; + } + + return this->INHERITED::onQuery(evt); + } private: sk_sp<SkSVGDOM> fDom; + SkString fLabel; typedef SampleView INHERITED; }; |