Skip to content

Commit

Permalink
Canvas cleanup fix integration (#292)
Browse files Browse the repository at this point in the history
* Integrate canvas based text resource flush

* Update BabylonNative to take VertexBuffer fix
  • Loading branch information
Alex-MSFT authored Oct 12, 2021
1 parent 869d850 commit a470e78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Modules/@babylonjs/react-native/shared/BabylonNative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace Babylon
{
Dispatcher g_inlineDispatcher{ [](const std::function<void()>& func) { func(); } };
std::unique_ptr<Graphics> g_graphics{};
std::unique_ptr<Babylon::Polyfills::Canvas> g_nativeCanvas{};
}

const uint32_t LEFT_MOUSE_BUTTON_ID{ NativeInput::LEFT_MOUSE_BUTTON_ID };
Expand Down Expand Up @@ -58,7 +59,7 @@ namespace Babylon
Polyfills::XMLHttpRequest::Initialize(m_env);

// Initialize Canvas polyfill for text support
Polyfills::Canvas::Initialize(m_env);
g_nativeCanvas = std::make_unique<Babylon::Polyfills::Canvas>(Babylon::Polyfills::Canvas::Initialize(m_env));
}

~ReactNativeModule() override
Expand Down Expand Up @@ -117,6 +118,7 @@ namespace Babylon
{
if (g_graphics)
{
g_nativeCanvas->FlushGraphicResources();
g_graphics->DisableRendering();

m_jsDispatcher([this]()
Expand Down

0 comments on commit a470e78

Please sign in to comment.