MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / create_native_surface

Method create_native_surface

src/MainProgram.cpp:322–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322sk_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
340void MainProgram::create_new_tab(const CustomEvents::OpenInfiniPaintFileEvent& openFile) {
341 std::shared_ptr<World> newWorld;

Callers 4

drawMethod · 0.80
world_take_screenshotFunction · 0.80
refresh_draw_cacheMethod · 0.80

Calls 3

xMethod · 0.45
yMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected