OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "Viewer.h" | 8 #include "Viewer.h" |
9 | 9 |
10 #include "GMSlide.h" | 10 #include "GMSlide.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 DEFINE_string(jpgs, "/data/local/tmp/skia", "Directory to read jpgs from."); | 62 DEFINE_string(jpgs, "/data/local/tmp/skia", "Directory to read jpgs from."); |
63 DEFINE_bool(vulkan, false, "Run with Vulkan."); | 63 DEFINE_bool(vulkan, false, "Run with Vulkan."); |
64 #else | 64 #else |
65 DEFINE_string(skps, "skps", "Directory to read skps from."); | 65 DEFINE_string(skps, "skps", "Directory to read skps from."); |
66 DEFINE_string(jpgs, "jpgs", "Directory to read jpgs from."); | 66 DEFINE_string(jpgs, "jpgs", "Directory to read jpgs from."); |
67 DEFINE_bool(vulkan, true, "Run with Vulkan."); | 67 DEFINE_bool(vulkan, true, "Run with Vulkan."); |
68 #endif | 68 #endif |
69 | 69 |
70 const char *kBackendTypeStrings[sk_app::Window::kBackendTypeCount] = { | 70 const char *kBackendTypeStrings[sk_app::Window::kBackendTypeCount] = { |
71 " [OpenGL]", | 71 " [OpenGL]", |
| 72 #ifdef SK_VULKAN |
72 " [Vulkan]", | 73 " [Vulkan]", |
| 74 #endif |
73 " [Raster]" | 75 " [Raster]" |
74 }; | 76 }; |
75 | 77 |
76 const char* kName = "name"; | 78 const char* kName = "name"; |
77 const char* kValue = "value"; | 79 const char* kValue = "value"; |
78 const char* kOptions = "options"; | 80 const char* kOptions = "options"; |
79 const char* kSlideStateName = "Slide"; | 81 const char* kSlideStateName = "Slide"; |
80 const char* kBackendStateName = "Backend"; | 82 const char* kBackendStateName = "Backend"; |
81 const char* kSoftkeyStateName = "Softkey"; | 83 const char* kSoftkeyStateName = "Softkey"; |
82 const char* kSoftkeyHint = "Please select a softkey"; | 84 const char* kSoftkeyHint = "Please select a softkey"; |
83 const char* kFpsStateName = "FPS"; | 85 const char* kFpsStateName = "FPS"; |
84 const char* kSplitScreenStateName = "Split screen"; | 86 const char* kSplitScreenStateName = "Split screen"; |
85 const char* kON = "ON"; | 87 const char* kON = "ON"; |
86 const char* kOFF = "OFF"; | 88 const char* kOFF = "OFF"; |
87 | 89 |
88 Viewer::Viewer(int argc, char** argv, void* platformData) | 90 Viewer::Viewer(int argc, char** argv, void* platformData) |
89 : fCurrentMeasurement(0) | 91 : fCurrentMeasurement(0) |
90 , fDisplayStats(false) | 92 , fDisplayStats(false) |
91 , fSplitScreen(false) | 93 , fSplitScreen(false) |
92 , fBackendType(sk_app::Window::kVulkan_BackendType) | 94 , fBackendType(sk_app::Window::kNativeGL_BackendType) |
93 , fZoomCenterX(0.0f) | 95 , fZoomCenterX(0.0f) |
94 , fZoomCenterY(0.0f) | 96 , fZoomCenterY(0.0f) |
95 , fZoomLevel(0.0f) | 97 , fZoomLevel(0.0f) |
96 , fZoomScale(SK_Scalar1) | 98 , fZoomScale(SK_Scalar1) |
97 { | 99 { |
98 memset(fMeasurements, 0, sizeof(fMeasurements)); | 100 memset(fMeasurements, 0, sizeof(fMeasurements)); |
99 | 101 |
100 SkDebugf("Command line arguments: "); | 102 SkDebugf("Command line arguments: "); |
101 for (int i = 1; i < argc; ++i) { | 103 for (int i = 1; i < argc; ++i) { |
102 SkDebugf("%s ", argv[i]); | 104 SkDebugf("%s ", argv[i]); |
103 } | 105 } |
104 SkDebugf("\n"); | 106 SkDebugf("\n"); |
105 | 107 |
106 SkCommandLineFlags::Parse(argc, argv); | 108 SkCommandLineFlags::Parse(argc, argv); |
107 | 109 |
| 110 #ifdef SK_VULKAN |
108 fBackendType = FLAGS_vulkan ? sk_app::Window::kVulkan_BackendType | 111 fBackendType = FLAGS_vulkan ? sk_app::Window::kVulkan_BackendType |
109 : sk_app::Window::kNativeGL_BackendType; | 112 : sk_app::Window::kNativeGL_BackendType; |
110 | 113 #endif |
111 fWindow = Window::CreateNativeWindow(platformData); | 114 fWindow = Window::CreateNativeWindow(platformData); |
112 fWindow->attach(fBackendType, DisplayParams()); | 115 fWindow->attach(fBackendType, DisplayParams()); |
113 | 116 |
114 // register callbacks | 117 // register callbacks |
115 fCommands.attach(fWindow); | 118 fCommands.attach(fWindow); |
116 fWindow->registerPaintFunc(on_paint_handler, this); | 119 fWindow->registerPaintFunc(on_paint_handler, this); |
117 fWindow->registerTouchFunc(on_touch_handler, this); | 120 fWindow->registerTouchFunc(on_touch_handler, this); |
118 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, this); | 121 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, this); |
119 | 122 |
120 // add key-bindings | 123 // add key-bindings |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 bool newSplitScreen = stateValue.equals(kON); | 593 bool newSplitScreen = stateValue.equals(kON); |
591 if (newSplitScreen != fSplitScreen) { | 594 if (newSplitScreen != fSplitScreen) { |
592 fSplitScreen = newSplitScreen; | 595 fSplitScreen = newSplitScreen; |
593 fWindow->inval(); | 596 fWindow->inval(); |
594 updateUIState(); | 597 updateUIState(); |
595 } | 598 } |
596 } else { | 599 } else { |
597 SkDebugf("Unknown stateName: %s", stateName.c_str()); | 600 SkDebugf("Unknown stateName: %s", stateName.c_str()); |
598 } | 601 } |
599 } | 602 } |
OLD | NEW |