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

Method fillPopupProgress

src/components/themes/BaseTheme.cpp:725–748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

723}
724
725void BaseTheme::fillPopupProgress(const GfxRenderer& renderer, const Rect& layout, const int progress) const {
726 const auto& metrics = UITheme::getInstance().getMetrics();
727 const int barHeight = metrics.popupProgressBarHeight;
728 const int barWidth =
729 std::max(0, layout.width - metrics.popupMarginX * 2); // twice the margin in drawPopup to match text width
730 const int barX = layout.x + (layout.width - barWidth) / 2;
731 const int barY = layout.y + layout.height - metrics.popupMarginY / 2 - barHeight / 2 - 1;
732 if (barWidth <= 0 || barHeight <= 0) {
733 renderer.displayBuffer(HalDisplay::FAST_REFRESH);
734 return;
735 }
736
737 const int scaledProgress = metrics.popupProgressClampPercent ? std::clamp(progress, 0, 100) : progress;
738 const int fillWidth = barWidth * scaledProgress / 100;
739
740 if (metrics.popupProgressDrawOutline) {
741 renderer.drawRect(barX, barY, barWidth, barHeight, 1, metrics.popupProgressOutlineInverted);
742 }
743 if (fillWidth > 0) {
744 renderer.fillRect(barX, barY, fillWidth, barHeight, metrics.popupProgressFillInverted);
745 }
746
747 renderer.displayBuffer(HalDisplay::FAST_REFRESH);
748}
749
750void BaseTheme::drawStatusBar(GfxRenderer& renderer, const float bookProgress, const int currentPage,
751 const int pageCount, std::string title, const int paddingBottom, const int textYOffset,

Callers 2

loadRecentCoversMethod · 0.80
onEnterMethod · 0.80

Calls 3

drawRectMethod · 0.80
fillRectMethod · 0.80
displayBufferMethod · 0.45

Tested by

no test coverage detected