From 64f9697562f597e23d9cbcb2670e891ec8448ee4 Mon Sep 17 00:00:00 2001 From: vinsentli Date: Sun, 5 Jan 2025 12:30:03 +0800 Subject: [PATCH] NanovgSessoin : implement teardown() --- shell/renderSessions/NanovgSession.cpp | 6 ++++++ shell/renderSessions/NanovgSession.h | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/shell/renderSessions/NanovgSession.cpp b/shell/renderSessions/NanovgSession.cpp index d94619938d..b5d75017d3 100644 --- a/shell/renderSessions/NanovgSession.cpp +++ b/shell/renderSessions/NanovgSession.cpp @@ -183,4 +183,10 @@ void NanovgSession::drawNanovg(float framebuffferWidth, updateGraph(&cpuGraph_, (end - start)); } +void NanovgSession::teardown() noexcept { + if (nvgContext_) { + iglu::nanovg::DestroyContext(nvgContext_); + } +} + } // namespace igl::shell diff --git a/shell/renderSessions/NanovgSession.h b/shell/renderSessions/NanovgSession.h index 023e340954..70db262486 100644 --- a/shell/renderSessions/NanovgSession.h +++ b/shell/renderSessions/NanovgSession.h @@ -52,10 +52,10 @@ class TouchListener : public ITouchListener { class NanovgSession : public RenderSession { public: - explicit NanovgSession(std::shared_ptr platform) : RenderSession(std::move(platform)) { - } + explicit NanovgSession(std::shared_ptr platform) : RenderSession(std::move(platform)) {} void initialize() noexcept override; void update(igl::SurfaceTextures surfaceTextures) noexcept override; + void teardown() noexcept override; private: void drawNanovg(float framebuffferWidth,