| 387 | } |
| 388 | |
| 389 | void resize_window(MainStruct& mS) { |
| 390 | // Having intermediate surface allows for changing options more easily |
| 391 | mS.m->refresh_draw_surfaces(); |
| 392 | |
| 393 | #ifdef USE_BACKEND_VULKAN |
| 394 | mS.vulkanWindowContext->resize(mS.m->window.size.x(), mS.m->window.size.y()); |
| 395 | #elif USE_BACKEND_OPENGL |
| 396 | |
| 397 | GrGLFramebufferInfo info; |
| 398 | info.fFBOID = (GrGLuint)mS.defaultFBO; |
| 399 | info.fFormat = GL_RGBA8; |
| 400 | |
| 401 | SkSurfaceProps props2; |
| 402 | mS.target = GrBackendRenderTargets::MakeGL(mS.m->window.size.x(), mS.m->window.size.y(), 0, mS.kStencilBits, info); |
| 403 | mS.m->window.nativeSurface = SkSurfaces::WrapBackendRenderTarget(mS.ctx.get(), mS.target, kBottomLeft_GrSurfaceOrigin, kRGBA_8888_SkColorType, SkColorSpace::MakeSRGB(), &props2); |
| 404 | |
| 405 | if(!mS.m->window.nativeSurface) |
| 406 | throw std::runtime_error("[resize_window] Could not make surface"); |
| 407 | mS.canvas = mS.m->window.nativeSurface->getCanvas(); |
| 408 | if(!mS.canvas) |
| 409 | throw std::runtime_error("[resize_window] No canvas made"); |
| 410 | |
| 411 | #endif |
| 412 | } |
| 413 | |
| 414 | #ifdef __EMSCRIPTEN__ |
| 415 | const char* emscripten_before_unload(int eventType, const void *reserved, void *userData) { |
no test coverage detected