Add view start and end to TimelineContext.

This commit is contained in:
Bartosz Taudul 2023-03-18 17:02:23 +01:00
parent 0a32929b0b
commit 5b3427395e
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,7 @@
#include "TracyImGui.hpp" #include "TracyImGui.hpp"
#include "TracyTimelineController.hpp" #include "TracyTimelineController.hpp"
#include "TracyView.hpp"
namespace tracy namespace tracy
{ {
@ -106,6 +107,8 @@ void TimelineController::End( double pxns, const ImVec2& wpos, bool hover, bool
UpdateCenterItem(); UpdateCenterItem();
} }
const auto& viewData = m_view.GetViewData();
TimelineContext ctx; TimelineContext ctx;
ctx.w = ImGui::GetContentRegionAvail().x - 1; ctx.w = ImGui::GetContentRegionAvail().x - 1;
ctx.ty = ImGui::GetTextLineHeight(); ctx.ty = ImGui::GetTextLineHeight();
@ -114,6 +117,8 @@ void TimelineController::End( double pxns, const ImVec2& wpos, bool hover, bool
ctx.yMax = yMax; ctx.yMax = yMax;
ctx.pxns = pxns; ctx.pxns = pxns;
ctx.nspx = 1.0 / pxns; ctx.nspx = 1.0 / pxns;
ctx.vStart = viewData.zvStart;
ctx.vEnd = viewData.zvEnd;
ctx.wpos = wpos; ctx.wpos = wpos;
ctx.hover = hover; ctx.hover = hover;

View File

@ -17,6 +17,7 @@ struct TimelineContext
float w, ty, scale; float w, ty, scale;
float yMin, yMax; float yMin, yMax;
double pxns, nspx; double pxns, nspx;
int64_t vStart, vEnd;
ImVec2 wpos; ImVec2 wpos;
bool hover; bool hover;
}; };