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

Function MakeOverlaySpec

IntelPresentMon/KernelProcess/MakeOverlaySpec.cpp:21–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 using ::pmon::util::str::ToWide;
20
21 std::unique_ptr<p2c::kern::OverlaySpec> MakeOverlaySpec(const kact::push_spec_impl::Params& spec)
22 {
23 // Alias for brevity.
24 auto& pref = spec.preferences;
25
26 // Build the core OverlaySpec with fields converted from the new input.
27 auto pSpec = std::make_unique<kern::OverlaySpec>(kern::OverlaySpec{
28 .pid = *spec.pid, // Assuming pid is set based on behavior of kact::PushSpecification
29 .capturePath = ToWide(pref.capturePath),
30 .graphDataWindowSize = double(pref.timeRange),
31 .averagingWindowSize = double(pref.metricsWindow),
32 .metricsOffset = double(pref.metricsOffset),
33 .etwFlushPeriod = double(pref.etwFlushPeriod),
34 .manualEtwFlush = pref.manualEtwFlush,
35 .overlayPosition = pref.overlayPosition,
36 .overlayWidth = int(pref.overlayWidth),
37 .upscale = pref.upscale,
38 .upscaleFactor = pref.upscaleFactor,
39 .metricPollRate = pref.metricPollRate,
40 .overlayDrawRate = pref.overlayDrawRate,
41 .telemetrySamplingPeriodMs = pref.telemetrySamplingPeriodMs,
42 .hideDuringCapture = pref.hideDuringCapture,
43 .hideAlways = pref.hideAlways,
44 .independentKernelWindow = pref.independentWindow,
45 .generateStats = pref.generateStats,
46 .enableFlashInjection = pref.enableFlashInjection,
47 });
48 if (pref.adapterId && *pref.adapterId > 0) {
49 pSpec->frameQueryAdapterId = uint32_t(*pref.adapterId);
50 }
51
52 // style sheets
53 {
54 using namespace gfx::lay::sty;
55 std::vector<std::shared_ptr<Stylesheet>> sheets{ Stylesheet::MakeDefaultInherit() };
56
57 const auto gutterSize = 30.;
58 const auto gutterPadding = 4.;
59
60 const double graphPadding = pref.graphPadding;
61 const double graphBorder = pref.graphBorder;
62 const double graphMargin = pref.graphMargin;
63
64 const double overlayPadding = pref.overlayPadding;
65 const double overlayBorder = pref.overlayBorder;
66 const double overlayMargin = pref.overlayMargin;
67 const auto overlayBorderColor = at::make::Color(pref.overlayBorderColor);
68 const auto overlayBackgroundColor = at::make::Color(pref.overlayBackgroundColor);
69
70 sheets.push_back(Stylesheet::Make({ {}, {"doc"} }));
71 sheets.back()->InsertRaw<at::backgroundColor>(overlayBackgroundColor);
72 sheets.back()->InsertRaw<at::flexDirection>(at::make::Enum(gfx::lay::FlexDirection::Column));
73 sheets.back()->InsertRaw<at::paddingLeft>(overlayPadding);
74 sheets.back()->InsertRaw<at::paddingTop>(overlayPadding);
75 sheets.back()->InsertRaw<at::paddingRight>(overlayPadding);
76 sheets.back()->InsertRaw<at::paddingBottom>(overlayPadding);
77 sheets.back()->InsertRaw<at::marginLeft>(overlayMargin);
78 sheets.back()->InsertRaw<at::marginTop>(overlayMargin);

Callers 1

Execute_Method · 0.85

Calls 5

ToWideFunction · 0.85
EnumFunction · 0.85
push_backMethod · 0.80
ColorClass · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected