Skip to content

Commit a470e78

Browse files
authored
Canvas cleanup fix integration (#292)
* Integrate canvas based text resource flush * Update BabylonNative to take VertexBuffer fix
1 parent 869d850 commit a470e78

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Modules/@babylonjs/react-native/shared/BabylonNative.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace Babylon
2222
{
2323
Dispatcher g_inlineDispatcher{ [](const std::function<void()>& func) { func(); } };
2424
std::unique_ptr<Graphics> g_graphics{};
25+
std::unique_ptr<Babylon::Polyfills::Canvas> g_nativeCanvas{};
2526
}
2627

2728
const uint32_t LEFT_MOUSE_BUTTON_ID{ NativeInput::LEFT_MOUSE_BUTTON_ID };
@@ -58,7 +59,7 @@ namespace Babylon
5859
Polyfills::XMLHttpRequest::Initialize(m_env);
5960

6061
// Initialize Canvas polyfill for text support
61-
Polyfills::Canvas::Initialize(m_env);
62+
g_nativeCanvas = std::make_unique<Babylon::Polyfills::Canvas>(Babylon::Polyfills::Canvas::Initialize(m_env));
6263
}
6364

6465
~ReactNativeModule() override
@@ -117,6 +118,7 @@ namespace Babylon
117118
{
118119
if (g_graphics)
119120
{
121+
g_nativeCanvas->FlushGraphicResources();
120122
g_graphics->DisableRendering();
121123

122124
m_jsDispatcher([this]()

0 commit comments

Comments
 (0)