MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / Overlay

Method Overlay

IntelPresentMon/Core/source/kernel/Overlay.cpp:109–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107 // Overlay member functions
108
109 Overlay::Overlay(
110 ::pmon::util::win::Process proc_,
111 std::shared_ptr<OverlaySpec> pSpec_,
112 pmon::PresentMon* pm_,
113 std::unique_ptr<MetricPackMapper> pPackMapper_,
114 bool headless_,
115 std::optional<gfx::Vec2I> pos_)
116 :
117 proc{ std::move(proc_) },
118 pm{ pm_ },
119 pSpec{ std::move(pSpec_) },
120 scheduler_{ pSpec->metricPollRate, pSpec->overlayDrawRate, 10 },
121 fetcherFactory{ *pm },
122 pPackMapper{ std::move(pPackMapper_) },
123 hProcess{ OpenProcess(SYNCHRONIZE, TRUE, proc.pid) },
124 moveHandlerToken{ win::EventHookManager::AddHandler(std::make_shared<WindowMoveHandler>(proc, this)) },
125 activateHandlerToken{ win::EventHookManager::AddHandler(std::make_shared<WindowActivateHandler>(proc, this)) },
126 targetRect{ win::GetWindowClientRect(proc.hWnd) },
127 position{ pSpec->overlayPosition },
128 upscaleFactor{ pSpec->upscale ? pSpec->upscaleFactor : 1.f },
129 graphicsDimensions{ pSpec->overlayWidth, 240 },
130 windowDimensions{ Dimensions{ graphicsDimensions } * upscaleFactor },
131 hideDuringCapture{ pSpec->hideDuringCapture },
132 hideAlways{ pSpec->hideAlways },
133 samplingWaiter{ 1.f / pSpec->metricPollRate },
134 headless{ headless_ }
135 {
136 UpdateDataSets_();
137 if (!headless) {
138 pWindow = MakeWindow_(pos_);
139 pGfx = std::make_unique<Graphics>(pWindow->GetHandle(), graphicsDimensions, upscaleFactor,
140 cli::Options::Get().allowTearing, !cli::Options::Get().disableAlpha);
141 pRoot = MakeDocument_(*pGfx, *pSpec, *pPackMapper, fetcherFactory, pCaptureIndicatorText);
142 }
143 UpdateCaptureStatusText_();
144 AdjustOverlaySituation_(position);
145 pm->StartTracking(proc.pid);
146 }
147
148 Overlay::~Overlay()
149 {

Callers

nothing calls this directly

Calls 5

OpenProcessFunction · 0.85
GetWindowClientRectFunction · 0.85
MakeDocument_Function · 0.85
GetHandleMethod · 0.45
StartTrackingMethod · 0.45

Tested by

no test coverage detected