MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / Window

Method Window

src/override/Window.cpp:206–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204
205
206Window::Window() {
207 internal = new Internal;
208
209 // Set up NanoVG
210 const int nvgFlags = NVG_ANTIALIAS;
211
212#if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
213 const DGL_NAMESPACE::Window::ScopedGraphicsContext sgc(internal->hiddenWindow);
214 vg = nvgCreateGL(nvgFlags);
215#else
216 vg = static_cast<CardinalPluginContext*>(APP)->tlw->getContext();
217#endif
218 DISTRHO_SAFE_ASSERT_RETURN(vg != nullptr,);
219
220#ifdef NANOVG_GLES2
221 fbVg = nvgCreateSharedGLES2(vg, nvgFlags);
222#else
223 fbVg = nvgCreateSharedGL2(vg, nvgFlags);
224#endif
225
226 // Load default Blendish font
227#ifndef DGL_NO_SHARED_RESOURCES
228 uiFont = std::make_shared<Font>();
229 uiFont->vg = vg;
230 uiFont->handle = loadFallbackFont(vg);
231
232 std::shared_ptr<FontWithOriginalContext> uiFont2;
233 uiFont2 = std::make_shared<FontWithOriginalContext>();
234 uiFont2->vg = vg;
235 uiFont2->handle = loadFallbackFont(vg);
236 uiFont2->ofilename = asset::system("res/fonts/DejaVuSans.ttf");
237 internal->fontCache[uiFont2->ofilename] = uiFont2;
238#else
239 uiFont = loadFont(asset::system("res/fonts/DejaVuSans.ttf"));
240#endif
241
242 if (uiFont != nullptr)
243 bndSetFont(uiFont->handle);
244
245#ifdef DISTRHO_OS_WASM
246 emscripten_lock_orientation(EMSCRIPTEN_ORIENTATION_LANDSCAPE_PRIMARY);
247#endif
248}
249
250void WindowSetPluginRemote(Window* const window, NanoTopLevelWidget* const tlw)
251{

Callers

nothing calls this directly

Calls 3

bndSetFontFunction · 0.85
loadFallbackFontFunction · 0.70
systemFunction · 0.50

Tested by

no test coverage detected