From 3c9a8a2ed86d08da842e11d32065da43b5bfdc77 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 27 Oct 2019 13:05:00 +0100 Subject: Move platform stub configuration code to platform headers This allows backends which use basic software rendering (like Cairo) to share the common basic window format setup code. --- pugl/detail/win.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'pugl/detail/win.h') diff --git a/pugl/detail/win.h b/pugl/detail/win.h index 6d89759..e9056b7 100644 --- a/pugl/detail/win.h +++ b/pugl/detail/win.h @@ -113,3 +113,27 @@ puglWinCreateWindow(const PuglView* const view, return PUGL_SUCCESS; } + +static inline PuglStatus +puglWinStubConfigure(PuglView* view) +{ + PuglInternals* const impl = view->impl; + PuglStatus st = PUGL_SUCCESS; + + if ((st = puglWinCreateWindow(view, "Pugl", &impl->hwnd, &impl->hdc))) { + return st; + } + + impl->pfd = puglWinGetPixelFormatDescriptor(view->hints); + impl->pfId = ChoosePixelFormat(impl->hdc, &impl->pfd); + + if (!SetPixelFormat(impl->hdc, impl->pfId, &impl->pfd)) { + ReleaseDC(impl->hwnd, impl->hdc); + DestroyWindow(impl->hwnd); + impl->hwnd = NULL; + impl->hdc = NULL; + return PUGL_SET_FORMAT_FAILED; + } + + return PUGL_SUCCESS; +} -- cgit v1.2.1