OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 | 8 |
9 #include "VisualBench.h" | 9 #include "VisualBench.h" |
10 | 10 |
11 #include "GrContext.h" | 11 #include "GrContext.h" |
12 #include "ProcStats.h" | 12 #include "ProcStats.h" |
13 #include "SkApplication.h" | 13 #include "SkApplication.h" |
14 #include "SkCanvas.h" | 14 #include "SkCanvas.h" |
15 #include "SkCommandLineFlags.h" | 15 #include "SkCommandLineFlags.h" |
16 #include "SkGraphics.h" | 16 #include "SkGraphics.h" |
17 #include "SkGr.h" | 17 #include "SkGr.h" |
18 #include "SkOSFile.h" | 18 #include "SkOSFile.h" |
19 #include "SkStream.h" | 19 #include "SkStream.h" |
20 #include "Stats.h" | 20 #include "Stats.h" |
| 21 #include "VisualDebugModule.h" |
21 #include "VisualLightweightBenchModule.h" | 22 #include "VisualLightweightBenchModule.h" |
22 #include "VisualInteractiveModule.h" | 23 #include "VisualInteractiveModule.h" |
23 #include "gl/GrGLInterface.h" | 24 #include "gl/GrGLInterface.h" |
24 | 25 |
25 #include <stdlib.h> | 26 #include <stdlib.h> |
26 | 27 |
27 DEFINE_bool2(fullscreen, f, true, "Run fullscreen."); | 28 DEFINE_bool2(fullscreen, f, true, "Run fullscreen."); |
28 DEFINE_bool2(interactive, n, false, "Run in interactive mode."); | 29 DEFINE_string(mode, "classic", "one of: classic interactive debugger"); |
29 DEFINE_bool2(dif, d, false, "Use device-independent fonts."); | 30 DEFINE_bool2(dif, d, false, "Use device-independent fonts."); |
30 | 31 |
31 VisualBench::VisualBench(void* hwnd, int argc, char** argv) | 32 VisualBench::VisualBench(void* hwnd, int argc, char** argv) |
32 : INHERITED(hwnd) { | 33 : INHERITED(hwnd) { |
33 SkDebugf("Command line arguments:"); | 34 SkDebugf("Command line arguments: "); |
34 for (int i = 0; i < argc; ++i) { | 35 for (int i = 1; i < argc; ++i) { |
35 SkDebugf("%s\n", argv[i]); | 36 SkDebugf("%s ", argv[i]); |
36 } | 37 } |
| 38 SkDebugf("\n"); |
37 | 39 |
38 SkCommandLineFlags::Parse(argc, argv); | 40 SkCommandLineFlags::Parse(argc, argv); |
39 | 41 |
40 if (FLAGS_nvpr && !FLAGS_msaa) { | 42 if (FLAGS_nvpr && !FLAGS_msaa) { |
41 SkDebugf("Got nvpr without msaa. Exiting.\n"); | 43 SkDebugf("Got nvpr without msaa. Exiting.\n"); |
42 exit(-1); | 44 exit(-1); |
43 } | 45 } |
44 | 46 |
45 // these have to happen after commandline parsing | 47 // these have to happen after commandline parsing |
46 if (FLAGS_dif) { | 48 if (FLAGS_dif) { |
47 const SkSurfaceProps& props(INHERITED::getSurfaceProps()); | 49 const SkSurfaceProps& props(INHERITED::getSurfaceProps()); |
48 uint32_t flags = SkSurfaceProps::kUseDeviceIndependentFonts_Flag | props
.flags(); | 50 uint32_t flags = SkSurfaceProps::kUseDeviceIndependentFonts_Flag | props
.flags(); |
49 INHERITED::setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry()))
; | 51 INHERITED::setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry()))
; |
50 } | 52 } |
51 fModule.reset(new VisualLightweightBenchModule(this)); | 53 fModule.reset(new VisualLightweightBenchModule(this)); |
52 if (FLAGS_interactive) { | 54 |
53 fModule.reset(new VisualInteractiveModule(this)); | 55 if (FLAGS_mode.count()) { |
| 56 SkASSERT(FLAGS_mode.count() == 1); |
| 57 SkString mode(FLAGS_mode[0]); |
| 58 if (mode == SkString("interactive")) { |
| 59 fModule.reset(new VisualInteractiveModule(this)); |
| 60 } else if (mode == SkString("debugger")) { |
| 61 fModule.reset(new VisualDebugModule(this)); |
| 62 } |
54 } | 63 } |
55 | 64 |
56 this->setTitle(); | 65 this->setTitle(); |
57 this->setupBackend(); | 66 this->setupBackend(); |
58 } | 67 } |
59 | 68 |
60 VisualBench::~VisualBench() { | 69 VisualBench::~VisualBench() { |
61 this->tearDownContext(); | 70 this->tearDownContext(); |
62 } | 71 } |
63 | 72 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 187 } |
179 | 188 |
180 void application_term() { | 189 void application_term() { |
181 SkEvent::Term(); | 190 SkEvent::Term(); |
182 } | 191 } |
183 | 192 |
184 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) { | 193 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) { |
185 return new VisualBench(hwnd, argc, argv); | 194 return new VisualBench(hwnd, argc, argv); |
186 } | 195 } |
187 | 196 |
OLD | NEW |