Removed selection glow code, and moved surface creation code to function

This commit is contained in:
Yousef Khadadeh 2026-02-16 21:27:42 +03:00
parent 9216be3b7c
commit 462443ed0a
7 changed files with 26 additions and 84 deletions

View file

@ -289,6 +289,25 @@ void MainProgram::draw(SkCanvas* canvas) {
toolbar.draw(canvas);
}
sk_sp<SkSurface> MainProgram::create_native_surface(Vector2i resolution, bool isMSAA) {
#ifdef USE_BACKEND_OPENGLES_3_0
SkImageInfo imgInfo = SkImageInfo::Make(resolution.x(), resolution.y(), kRGBA_8888_SkColorType, kPremul_SkAlphaType);
#else
SkImageInfo imgInfo = SkImageInfo::MakeN32Premul(resolution.x(), resolution.y());
#endif
SkSurfaceProps defaultProps;
#ifdef USE_SKIA_BACKEND_GRAPHITE
auto surfaceToRet = SkSurfaces::RenderTarget(window.recorder(), imgInfo, skgpu::Mipmapped::kNo, isMSAA ? &window.defaultMSAASurfaceProps : &defaultProps);
#elif USE_SKIA_BACKEND_GANESH
auto surfaceToRet = SkSurfaces::RenderTarget(window.ctx.get(), skgpu::Budgeted::kNo, imgInfo, isMSAA ? window.defaultMSAASampleCount : 0, isMSAA ? &window.defaultMSAASurfaceProps : &defaultProps);
#endif
if(!surfaceToRet)
throw std::runtime_error("[MainProgram::create_native_surface] Could not make native surface");
return surfaceToRet;
}
bool MainProgram::network_being_used() {
for(auto& w : worlds) {
if(w->netObjMan.is_connected())