mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
Enforce DPI scale setup on first render frame.
Not all backends know their DPI before window is available.
This commit is contained in:
parent
04b921e200
commit
44ae59f363
@ -20,7 +20,7 @@ static EGLDisplay s_eglDpy;
|
|||||||
static EGLContext s_eglCtx;
|
static EGLContext s_eglCtx;
|
||||||
static EGLSurface s_eglSurf;
|
static EGLSurface s_eglSurf;
|
||||||
|
|
||||||
static float s_prevScale;
|
static float s_prevScale = -1;
|
||||||
static int s_width, s_height;
|
static int s_width, s_height;
|
||||||
static uint64_t s_time;
|
static uint64_t s_time;
|
||||||
static const char* s_prevCursor = nullptr;
|
static const char* s_prevCursor = nullptr;
|
||||||
|
@ -17,9 +17,11 @@
|
|||||||
|
|
||||||
static GLFWwindow* s_window;
|
static GLFWwindow* s_window;
|
||||||
static std::function<void()> s_redraw;
|
static std::function<void()> s_redraw;
|
||||||
|
static std::function<void(float)> s_scaleChanged;
|
||||||
static RunQueue* s_mainThreadTasks;
|
static RunQueue* s_mainThreadTasks;
|
||||||
static WindowPosition* s_winPos;
|
static WindowPosition* s_winPos;
|
||||||
static bool s_iconified;
|
static bool s_iconified;
|
||||||
|
static float s_prevScale = -1;
|
||||||
|
|
||||||
extern tracy::Config s_config;
|
extern tracy::Config s_config;
|
||||||
|
|
||||||
@ -95,6 +97,7 @@ Backend::Backend( const char* title, const std::function<void()>& redraw, const
|
|||||||
ImGui_ImplOpenGL3_Init( "#version 150" );
|
ImGui_ImplOpenGL3_Init( "#version 150" );
|
||||||
|
|
||||||
s_redraw = redraw;
|
s_redraw = redraw;
|
||||||
|
s_scaleChanged = scaleChanged;
|
||||||
s_mainThreadTasks = mainThreadTasks;
|
s_mainThreadTasks = mainThreadTasks;
|
||||||
s_winPos = &m_winPos;
|
s_winPos = &m_winPos;
|
||||||
s_iconified = false;
|
s_iconified = false;
|
||||||
@ -152,6 +155,13 @@ void Backend::Attention()
|
|||||||
|
|
||||||
void Backend::NewFrame( int& w, int& h )
|
void Backend::NewFrame( int& w, int& h )
|
||||||
{
|
{
|
||||||
|
const auto scale = GetDpiScale();
|
||||||
|
if( scale != s_prevScale )
|
||||||
|
{
|
||||||
|
s_prevScale = scale;
|
||||||
|
s_scaleChanged( scale );
|
||||||
|
}
|
||||||
|
|
||||||
glfwGetFramebufferSize( s_window, &w, &h );
|
glfwGetFramebufferSize( s_window, &w, &h );
|
||||||
m_w = w;
|
m_w = w;
|
||||||
m_h = h;
|
m_h = h;
|
||||||
|
@ -222,7 +222,7 @@ struct Output
|
|||||||
};
|
};
|
||||||
static std::unordered_map<uint32_t, std::unique_ptr<Output>> s_output;
|
static std::unordered_map<uint32_t, std::unique_ptr<Output>> s_output;
|
||||||
static int s_maxScale = 120;
|
static int s_maxScale = 120;
|
||||||
static int s_prevScale = 120;
|
static int s_prevScale = -1;
|
||||||
|
|
||||||
static bool s_running = true;
|
static bool s_running = true;
|
||||||
static int s_width, s_height;
|
static int s_width, s_height;
|
||||||
|
Loading…
Reference in New Issue
Block a user