Mercurial > hg > orthanc-stone
changeset 2338:1bbd7011c2e2 refactoring
fix wasm rendering
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Tue, 06 Oct 2026 09:11:34 +0200 |
| parents | 3b90e00942ee |
| children | c92f0758001e |
| files | Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewer.cpp OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyCairoViewport.cpp OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyViewport.cpp |
| diffstat | 3 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewer.cpp Sun Oct 04 12:06:28 2026 +0200 +++ b/Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewer.cpp Tue Oct 06 09:11:34 2026 +0200 @@ -34,6 +34,9 @@ #include <Compatibility.h> // For std::unique_ptr<> #include <Toolbox.h> +#include <EmbeddedResources.h> // For Orthanc::EmbeddedResources::UBUNTU_FONT + + #include <emscripten.h> #include <emscripten/html5.h> @@ -123,11 +126,19 @@ { if (useOpenGL) { - viewport_ = OrthancStone::WebAssemblyCairoViewport::Create(canvasId); + viewport_ = OrthancStone::WebGLViewport::Create(canvasId); } else { - viewport_ = OrthancStone::WebGLViewport::Create(canvasId); + viewport_ = OrthancStone::WebAssemblyCairoViewport::Create(canvasId); + } + + std::string font; + Orthanc::EmbeddedResources::GetFileResource(font, Orthanc::EmbeddedResources::UBUNTU_FONT); + + { + std::unique_ptr<IViewport::ILock> viewportLock(viewport_->Lock()); + viewportLock->GetCompositor().SetFont(0, font, 16, Orthanc::Encoding_Latin1); } core_->CreateComponents(GetContext(), viewport_);
--- a/OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyCairoViewport.cpp Sun Oct 04 12:06:28 2026 +0200 +++ b/OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyCairoViewport.cpp Tue Oct 06 09:11:34 2026 +0200 @@ -102,7 +102,6 @@ bool enableEmscriptenMouseEvents) : WebAssemblyViewport(canvasId,enableEmscriptenMouseEvents) { - RefreshCanvasSize(); AcquireCompositor(new CairoCompositor(GetCanvasWidth(), GetCanvasHeight())); }
--- a/OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyViewport.cpp Sun Oct 04 12:06:28 2026 +0200 +++ b/OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyViewport.cpp Tue Oct 06 09:11:34 2026 +0200 @@ -442,6 +442,8 @@ emscripten_set_touchmove_callback(canvasCssSelector_.c_str(), reinterpret_cast<void*>(this), false, OnTouch); emscripten_set_touchcancel_callback(canvasCssSelector_.c_str(), reinterpret_cast<void*>(this), false, OnTouch); } + + RefreshCanvasSize(); } WebAssemblyViewport::~WebAssemblyViewport()
