MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / UpdateScale

Method UpdateScale

src/gui/fluxviewercontrol.cc:87–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87void FluxViewerControl::UpdateScale()
88{
89 auto size = GetSize();
90 nanoseconds_t thumbSize = size.GetWidth() * _nanosecondsPerPixel;
91 _scrollbar->SetScrollbar(_scrollPosition / 1000,
92 thumbSize / 1000,
93 _totalDuration / 1000,
94 thumbSize / 2000);
95
96 int totalPixels = (_totalDuration / _nanosecondsPerPixel) + 1;
97 if ((totalPixels != _densityMap.size()) &&
98 (_nanosecondsPerPixel > RENDER_LIMIT))
99 {
100 _densityMap.resize(totalPixels);
101 std::fill(_densityMap.begin(), _densityMap.end(), 0.0);
102
103 int i = 0;
104 for (const auto& trackdata : _flux->trackDatas)
105 {
106 FluxmapReader fmr(*trackdata->fluxmap);
107 while (!fmr.eof())
108 {
109 unsigned ticks;
110 if (!fmr.findEvent(F_BIT_PULSE, ticks))
111 break;
112
113 int fx = fmr.tell().ns() / _nanosecondsPerPixel;
114 _densityMap.at(i + fx)++;
115 }
116 i += trackdata->fluxmap->duration() / _nanosecondsPerPixel;
117 }
118
119 double max = *std::max_element(_densityMap.begin(), _densityMap.end());
120 for (auto& d : _densityMap)
121 d /= max;
122 }
123}
124
125static int interpolate(int lo, int hi, float factor)
126{

Callers

nothing calls this directly

Calls 10

SetScrollbarMethod · 0.80
findEventMethod · 0.80
nsMethod · 0.80
durationMethod · 0.80
sizeMethod · 0.45
resizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eofMethod · 0.45
tellMethod · 0.45

Tested by

no test coverage detected