MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / drawProgressBar

Method drawProgressBar

src/components/themes/BaseTheme.cpp:133–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133void BaseTheme::drawProgressBar(const GfxRenderer& renderer, Rect rect, const size_t current,
134 const size_t total) const {
135 if (total == 0) {
136 return;
137 }
138
139 // Use 64-bit arithmetic to avoid overflow for large files
140 const int percent = static_cast<int>((static_cast<uint64_t>(current) * 100) / total);
141
142 LOG_DBG("UI", "Drawing progress bar: current=%u, total=%u, percent=%d", current, total, percent);
143 // Draw outline
144 renderer.drawRect(rect.x, rect.y, rect.width, rect.height);
145
146 // Draw filled portion
147 const int fillWidth = (rect.width - 4) * percent / 100;
148 if (fillWidth > 0) {
149 renderer.fillRect(rect.x + 2, rect.y + 2, fillWidth, rect.height - 4);
150 }
151
152 // Draw percentage text centered below bar
153 const std::string percentText = std::to_string(percent) + "%";
154 renderer.drawCenteredText(UI_10_FONT_ID, rect.y + rect.height + 15, percentText.c_str());
155}
156
157void BaseTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1, const char* btn2, const char* btn3,
158 const char* btn4) const {

Callers 5

renderMethod · 0.80
renderMethod · 0.80
renderMethod · 0.80
renderMethod · 0.80
renderMethod · 0.80

Calls 3

drawRectMethod · 0.80
fillRectMethod · 0.80
drawCenteredTextMethod · 0.45

Tested by

no test coverage detected