| 320 | } |
| 321 | |
| 322 | sk_sp<SkSurface> MainProgram::create_native_surface(Vector2i resolution, bool isMSAA) { |
| 323 | if(window.canCreateSurfaces) { |
| 324 | SkImageInfo imgInfo = SkImageInfo::MakeN32Premul(resolution.x(), resolution.y()); |
| 325 | SkSurfaceProps defaultProps; |
| 326 | #ifdef USE_SKIA_BACKEND_GRAPHITE |
| 327 | auto surfaceToRet = SkSurfaces::RenderTarget(window.recorder(), imgInfo, skgpu::Mipmapped::kNo, isMSAA ? &window.defaultMSAASurfaceProps : &defaultProps); |
| 328 | #elif USE_SKIA_BACKEND_GANESH |
| 329 | auto surfaceToRet = SkSurfaces::RenderTarget(window.ctx.get(), skgpu::Budgeted::kNo, imgInfo, isMSAA ? window.defaultMSAASampleCount : 0, isMSAA ? &window.defaultMSAASurfaceProps : &defaultProps); |
| 330 | #endif |
| 331 | |
| 332 | if(!surfaceToRet) |
| 333 | throw std::runtime_error("[MainProgram::create_native_surface] Could not make native surface"); |
| 334 | |
| 335 | return surfaceToRet; |
| 336 | } |
| 337 | return nullptr; |
| 338 | } |
| 339 | |
| 340 | void MainProgram::create_new_tab(const CustomEvents::OpenInfiniPaintFileEvent& openFile) { |
| 341 | std::shared_ptr<World> newWorld; |
no test coverage detected