mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 15:34:36 +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 EGLSurface s_eglSurf;
|
||||
|
||||
static float s_prevScale;
|
||||
static float s_prevScale = -1;
|
||||
static int s_width, s_height;
|
||||
static uint64_t s_time;
|
||||
static const char* s_prevCursor = nullptr;
|
||||
|
@ -17,9 +17,11 @@
|
||||
|
||||
static GLFWwindow* s_window;
|
||||
static std::function<void()> s_redraw;
|
||||
static std::function<void(float)> s_scaleChanged;
|
||||
static RunQueue* s_mainThreadTasks;
|
||||
static WindowPosition* s_winPos;
|
||||
static bool s_iconified;
|
||||
static float s_prevScale = -1;
|
||||
|
||||
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" );
|
||||
|
||||
s_redraw = redraw;
|
||||
s_scaleChanged = scaleChanged;
|
||||
s_mainThreadTasks = mainThreadTasks;
|
||||
s_winPos = &m_winPos;
|
||||
s_iconified = false;
|
||||
@ -152,6 +155,13 @@ void Backend::Attention()
|
||||
|
||||
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 );
|
||||
m_w = w;
|
||||
m_h = h;
|
||||
|
@ -222,7 +222,7 @@ struct Output
|
||||
};
|
||||
static std::unordered_map<uint32_t, std::unique_ptr<Output>> s_output;
|
||||
static int s_maxScale = 120;
|
||||
static int s_prevScale = 120;
|
||||
static int s_prevScale = -1;
|
||||
|
||||
static bool s_running = true;
|
||||
static int s_width, s_height;
|
||||
|
Loading…
Reference in New Issue
Block a user