| 723 | } |
| 724 | |
| 725 | void 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 | |
| 750 | void BaseTheme::drawStatusBar(GfxRenderer& renderer, const float bookProgress, const int currentPage, |
| 751 | const int pageCount, std::string title, const int paddingBottom, const int textYOffset, |
no test coverage detected