MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / m_processResolution

Method m_processResolution

src/osvr/Client/DisplayDescriptorSchema1.cpp:164–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162 }
163
164 void
165 DisplayDescriptor::m_processResolution(Json::Value const &resolution) {
166 // if there is more than 1 input, display descriptor right now
167 // specifies one resolution value for both inputs. that may be
168 // changed in the future
169 Resolution res;
170 res.video_inputs = resolution.get("video_inputs", 1).asInt();
171
172 // Window bounds
173 res.width = resolution["width"].asInt();
174 res.height = resolution["height"].asInt();
175
176 // Display mode - Default to horiz side by side unless we have
177 // multiple video inputs, then default to full screen (? seems
178 // logical but not strictly what the json schema specifies)
179 res.display_mode =
180 (res.video_inputs > 1 ? FULL_SCREEN : HORIZONTAL_SIDE_BY_SIDE);
181
182 auto const &display_mode = resolution["display_mode"];
183 if (display_mode.isString()) {
184 const std::string display_mode_str = display_mode.asString();
185 if ("horz_side_by_side" == display_mode_str) {
186 res.display_mode = HORIZONTAL_SIDE_BY_SIDE;
187 } else if ("vert_side_by_size" == display_mode_str) {
188 res.display_mode = VERTICAL_SIDE_BY_SIDE;
189 } else if ("full_screen" == display_mode_str) {
190 res.display_mode = FULL_SCREEN;
191 } else {
192 OSVR_DEV_VERBOSE("DisplayDescriptor::parse(): WARNING: "
193 "Unknown display mode string: "
194 << display_mode_str << " (using default)");
195 }
196 }
197
198 m_resolutions.push_back(res);
199 }
200
201 void DisplayDescriptor::print() const {
202 std::cout << "Monocular horizontal FOV: "

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected