| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SampleApp.h" | 8 #include "SampleApp.h" |
| 9 | 9 |
| 10 #include "OverView.h" | 10 #include "OverView.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 class PictFileFactory : public SkViewFactory { | 74 class PictFileFactory : public SkViewFactory { |
| 75 SkString fFilename; | 75 SkString fFilename; |
| 76 public: | 76 public: |
| 77 PictFileFactory(const SkString& filename) : fFilename(filename) {} | 77 PictFileFactory(const SkString& filename) : fFilename(filename) {} |
| 78 SkView* operator() () const override { | 78 SkView* operator() () const override { |
| 79 return CreateSamplePictFileView(fFilename.c_str()); | 79 return CreateSamplePictFileView(fFilename.c_str()); |
| 80 } | 80 } |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 extern SampleView* CreateSampleSVGFileView(const char filename[]); |
| 84 |
| 85 class SVGFileFactory : public SkViewFactory { |
| 86 SkString fFilename; |
| 87 public: |
| 88 SVGFileFactory(const SkString& filename) : fFilename(filename) {} |
| 89 SkView* operator() () const override { |
| 90 return CreateSampleSVGFileView(fFilename.c_str()); |
| 91 } |
| 92 }; |
| 93 |
| 83 #ifdef SAMPLE_PDF_FILE_VIEWER | 94 #ifdef SAMPLE_PDF_FILE_VIEWER |
| 84 extern SampleView* CreateSamplePdfFileViewer(const char filename[]); | 95 extern SampleView* CreateSamplePdfFileViewer(const char filename[]); |
| 85 | 96 |
| 86 class PdfFileViewerFactory : public SkViewFactory { | 97 class PdfFileViewerFactory : public SkViewFactory { |
| 87 SkString fFilename; | 98 SkString fFilename; |
| 88 public: | 99 public: |
| 89 PdfFileViewerFactory(const SkString& filename) : fFilename(filename) {} | 100 PdfFileViewerFactory(const SkString& filename) : fFilename(filename) {} |
| 90 SkView* operator() () const override { | 101 SkView* operator() () const override { |
| 91 return CreateSamplePdfFileViewer(fFilename.c_str()); | 102 return CreateSamplePdfFileViewer(fFilename.c_str()); |
| 92 } | 103 } |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 if (newCount) { | 682 if (newCount) { |
| 672 factories.setCount(newCount); | 683 factories.setCount(newCount); |
| 673 } | 684 } |
| 674 } | 685 } |
| 675 | 686 |
| 676 DEFINE_string(slide, "", "Start on this sample."); | 687 DEFINE_string(slide, "", "Start on this sample."); |
| 677 DEFINE_int32(msaa, 0, "Request multisampling with this count."); | 688 DEFINE_int32(msaa, 0, "Request multisampling with this count."); |
| 678 DEFINE_bool(deepColor, false, "Request deep color (10-bit/channel or more) displ
ay buffer."); | 689 DEFINE_bool(deepColor, false, "Request deep color (10-bit/channel or more) displ
ay buffer."); |
| 679 DEFINE_string(pictureDir, "", "Read pictures from here."); | 690 DEFINE_string(pictureDir, "", "Read pictures from here."); |
| 680 DEFINE_string(picture, "", "Path to single picture."); | 691 DEFINE_string(picture, "", "Path to single picture."); |
| 692 DEFINE_string(svg, "", "Path to single SVG file."); |
| 693 DEFINE_string(svgDir, "", "Read SVGs from here."); |
| 681 DEFINE_string(sequence, "", "Path to file containing the desired samples/gms to
show."); | 694 DEFINE_string(sequence, "", "Path to file containing the desired samples/gms to
show."); |
| 682 DEFINE_bool(sort, false, "Sort samples by title."); | 695 DEFINE_bool(sort, false, "Sort samples by title."); |
| 683 DEFINE_bool(list, false, "List samples?"); | 696 DEFINE_bool(list, false, "List samples?"); |
| 684 DEFINE_bool(gpu, false, "Start up with gpu?"); | 697 DEFINE_bool(gpu, false, "Start up with gpu?"); |
| 685 DEFINE_bool(redraw, false, "Force continuous redrawing, for profiling or debuggi
ng tools."); | 698 DEFINE_bool(redraw, false, "Force continuous redrawing, for profiling or debuggi
ng tools."); |
| 686 DEFINE_string(key, "", ""); // dummy to enable gm tests that have platform-spec
ific names | 699 DEFINE_string(key, "", ""); // dummy to enable gm tests that have platform-spec
ific names |
| 687 #ifdef SAMPLE_PDF_FILE_VIEWER | 700 #ifdef SAMPLE_PDF_FILE_VIEWER |
| 688 DEFINE_string(pdfPath, "", "Path to direcotry of pdf files."); | 701 DEFINE_string(pdfPath, "", "Path to direcotry of pdf files."); |
| 689 #endif | 702 #endif |
| 690 | 703 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 704 while (iter.next(&filename)) { | 717 while (iter.next(&filename)) { |
| 705 *fSamples.append() = new PictFileFactory( | 718 *fSamples.append() = new PictFileFactory( |
| 706 SkOSPath::Join(FLAGS_pictureDir[0], filename.c_str())); | 719 SkOSPath::Join(FLAGS_pictureDir[0], filename.c_str())); |
| 707 } | 720 } |
| 708 } | 721 } |
| 709 if (!FLAGS_picture.isEmpty()) { | 722 if (!FLAGS_picture.isEmpty()) { |
| 710 SkString path(FLAGS_picture[0]); | 723 SkString path(FLAGS_picture[0]); |
| 711 fCurrIndex = fSamples.count(); | 724 fCurrIndex = fSamples.count(); |
| 712 *fSamples.append() = new PictFileFactory(path); | 725 *fSamples.append() = new PictFileFactory(path); |
| 713 } | 726 } |
| 727 if (!FLAGS_svg.isEmpty()) { |
| 728 SkString path(FLAGS_svg[0]); |
| 729 fCurrIndex = fSamples.count(); |
| 730 *fSamples.append() = new SVGFileFactory(path); |
| 731 } |
| 732 if (!FLAGS_svgDir.isEmpty()) { |
| 733 SkOSFile::Iter iter(FLAGS_svgDir[0], "svg"); |
| 734 SkString filename; |
| 735 while (iter.next(&filename)) { |
| 736 *fSamples.append() = new SVGFileFactory( |
| 737 SkOSPath::Join(FLAGS_svgDir[0], filename.c_str())); |
| 738 } |
| 739 } |
| 714 #ifdef SAMPLE_PDF_FILE_VIEWER | 740 #ifdef SAMPLE_PDF_FILE_VIEWER |
| 715 if (!FLAGS_pdfPath.isEmpty()) { | 741 if (!FLAGS_pdfPath.isEmpty()) { |
| 716 SkOSFile::Iter iter(FLAGS_pdfPath[0], "pdf"); | 742 SkOSFile::Iter iter(FLAGS_pdfPath[0], "pdf"); |
| 717 SkString filename; | 743 SkString filename; |
| 718 while (iter.next(&filename)) { | 744 while (iter.next(&filename)) { |
| 719 *fSamples.append() = new PdfFileViewerFactory( | 745 *fSamples.append() = new PdfFileViewerFactory( |
| 720 SkOSPath::Join(FLAGS_pictureDir[0], filename.c_str())); | 746 SkOSPath::Join(FLAGS_pictureDir[0], filename.c_str())); |
| 721 } | 747 } |
| 722 } | 748 } |
| 723 #endif | 749 #endif |
| (...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2253 #ifdef SK_BUILD_FOR_MAC | 2279 #ifdef SK_BUILD_FOR_MAC |
| 2254 setenv("ANDROID_ROOT", "/android/device/data", 0); | 2280 setenv("ANDROID_ROOT", "/android/device/data", 0); |
| 2255 #endif | 2281 #endif |
| 2256 SkGraphics::Init(); | 2282 SkGraphics::Init(); |
| 2257 SkEvent::Init(); | 2283 SkEvent::Init(); |
| 2258 } | 2284 } |
| 2259 | 2285 |
| 2260 void application_term() { | 2286 void application_term() { |
| 2261 SkEvent::Term(); | 2287 SkEvent::Term(); |
| 2262 } | 2288 } |
| OLD | NEW |