Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: samplecode/SampleSVGFile.cpp

Issue 2217483002: Show SVG file name in SampleApp title (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleSVGFile.cpp
diff --git a/samplecode/SampleSVGFile.cpp b/samplecode/SampleSVGFile.cpp
index 01a1958f114ae6f62e74d847313e54ea38cf6b56..12c91a95fe1055f878d79eba41e6fdb2b791f7ae 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;
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698