diff options
| author | fmalita <fmalita@chromium.org> | 2016-07-26 18:46:34 -0700 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2016-07-26 18:46:34 -0700 |
| commit | 6ceef3dd67617c5f4572ada98d5ee85777d2db99 (patch) | |
| tree | 80d683062d7bba05f8fe4df14cedcb489dd4aa00 /samplecode/SampleApp.cpp | |
| parent | fc49d56feb2d890ccb3827ed087ab32e18a9da12 (diff) | |
Initial SVG model
A minimal subset needed to render tiger.svg: <svg>, <g>, <path>, 'd', 'fill'/'stroke' (color-only), 'transform'.
R=reed@google.com,robertphillips@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2164193002
Review-Url: https://codereview.chromium.org/2164193002
Diffstat (limited to 'samplecode/SampleApp.cpp')
| -rw-r--r-- | samplecode/SampleApp.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index 0747fcf22d..64d460fd9d 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"); |
