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

Unified Diff: samplecode/SampleApp.cpp

Issue 2164193002: Initial SVG model (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: warning fix Created 4 years, 5 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 | « include/xml/SkXMLParser.h ('k') | samplecode/SampleSVGFile.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleApp.cpp
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index a02a360be7f47476b16efdc972786f4c36bc7775..fc917579d4e8a79a2863ab7111407aee27b249b7 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -80,6 +80,17 @@ public:
}
};
+extern SampleView* CreateSampleSVGFileView(const char filename[]);
+
+class SVGFileFactory : public SkViewFactory {
+ SkString fFilename;
+public:
+ SVGFileFactory(const SkString& filename) : fFilename(filename) {}
+ SkView* operator() () const override {
+ return CreateSampleSVGFileView(fFilename.c_str());
+ }
+};
+
#ifdef SAMPLE_PDF_FILE_VIEWER
extern SampleView* CreateSamplePdfFileViewer(const char filename[]);
@@ -678,6 +689,8 @@ DEFINE_int32(msaa, 0, "Request multisampling with this count.");
DEFINE_bool(deepColor, false, "Request deep color (10-bit/channel or more) display buffer.");
DEFINE_string(pictureDir, "", "Read pictures from here.");
DEFINE_string(picture, "", "Path to single picture.");
+DEFINE_string(svg, "", "Path to single SVG file.");
+DEFINE_string(svgDir, "", "Read SVGs from here.");
DEFINE_string(sequence, "", "Path to file containing the desired samples/gms to show.");
DEFINE_bool(sort, false, "Sort samples by title.");
DEFINE_bool(list, false, "List samples?");
@@ -711,6 +724,19 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
fCurrIndex = fSamples.count();
*fSamples.append() = new PictFileFactory(path);
}
+ if (!FLAGS_svg.isEmpty()) {
+ SkString path(FLAGS_svg[0]);
+ fCurrIndex = fSamples.count();
+ *fSamples.append() = new SVGFileFactory(path);
+ }
+ if (!FLAGS_svgDir.isEmpty()) {
+ SkOSFile::Iter iter(FLAGS_svgDir[0], "svg");
+ SkString filename;
+ while (iter.next(&filename)) {
+ *fSamples.append() = new SVGFileFactory(
+ SkOSPath::Join(FLAGS_svgDir[0], filename.c_str()));
+ }
+ }
#ifdef SAMPLE_PDF_FILE_VIEWER
if (!FLAGS_pdfPath.isEmpty()) {
SkOSFile::Iter iter(FLAGS_pdfPath[0], "pdf");
« no previous file with comments | « include/xml/SkXMLParser.h ('k') | samplecode/SampleSVGFile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698