Skip to content

Commit 533064e

Browse files
committed
Improve emscripten
1 parent 3609179 commit 533064e

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

modules/yup_graphics/native/yup_GraphicsContext_gl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ class LowLevelRenderContextGL : public GraphicsContext
116116
{
117117
#if RIVE_DESKTOP_GL && __APPLE__
118118
return 2;
119+
#elif RIVE_WEBGL && YUP_EMSCRIPTEN
120+
return (float) emscripten_get_device_pixel_ratio();
119121
#else
120122
return 1;
121123
#endif
@@ -140,6 +142,7 @@ class LowLevelRenderContextGL : public GraphicsContext
140142
void begin (const rive::gpu::RenderContext::FrameDescriptor& frameDescriptor) override
141143
{
142144
m_plsContext->static_impl_cast<rive::gpu::RenderContextGLImpl>()->invalidateGLState();
145+
143146
m_plsContext->beginFrame (frameDescriptor);
144147
}
145148

modules/yup_gui/native/yup_Windowing_sdl2.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,9 @@ void SDL2ComponentNative::setBounds (const Rectangle<int>& newBounds)
252252
int leftMargin = 0, topMargin = 0, rightMargin = 0, bottomMargin = 0;
253253

254254
#if YUP_EMSCRIPTEN && RIVE_WEBGL
255-
const double devicePixelRatio = emscripten_get_device_pixel_ratio();
256255
SDL_SetWindowSize (window,
257-
static_cast<int> (newBounds.getWidth() * devicePixelRatio),
258-
static_cast<int> (newBounds.getHeight() * devicePixelRatio));
256+
jmax (0, newBounds.getWidth()),
257+
jmax (0, newBounds.getHeight()));
259258

260259
emscripten_set_element_css_size ("#canvas",
261260
jmax (0, newBounds.getWidth()),

modules/yup_gui/native/yup_Windowing_sdl2.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,6 @@
2222
namespace yup
2323
{
2424

25-
//==============================================================================
26-
#ifndef YUP_WINDOWING_LOGGING
27-
#define YUP_WINDOWING_LOGGING 1
28-
#endif
29-
30-
#if YUP_WINDOWING_LOGGING
31-
#define YUP_WINDOWING_LOG(textToWrite) JUCE_DBG (textToWrite)
32-
#else
33-
#define YUP_WINDOWING_LOG(textToWrite) \
34-
{ \
35-
}
36-
#endif
37-
3825
//==============================================================================
3926
class SDL2ComponentNative final
4027
: public ComponentNative

0 commit comments

Comments
 (0)