Compare commits

...

2 Commits

Author SHA1 Message Date
Arthur Tazhitdinov
2b6927f083 clang format fix 2026-02-03 12:20:35 +03:00
Arthur Tazhitdinov
2a94648828 cppcheck fix 2026-02-03 12:13:39 +03:00
2 changed files with 4 additions and 5 deletions

View File

@ -255,9 +255,8 @@ void EpubReaderActivity::jumpToPercent(int percent) {
// Convert percent into a byte-like absolute position across the spine sizes.
// Use an overflow-safe computation: (bookSize / 100) * percent + (bookSize % 100) * percent / 100
size_t targetSize =
(bookSize / 100) * static_cast<size_t>(percent) +
(bookSize % 100) * static_cast<size_t>(percent) / 100;
if (percent >= 100 && bookSize > 0) {
(bookSize / 100) * static_cast<size_t>(percent) + (bookSize % 100) * static_cast<size_t>(percent) / 100;
if (percent >= 100) {
// Ensure the final percent lands inside the last spine item.
targetSize = bookSize - 1;
}

View File

@ -106,14 +106,14 @@ void EpubReaderPercentSelectionActivity::renderScreen() {
renderer.drawCenteredText(UI_12_FONT_ID, 15, "Go to Position", true, EpdFontFamily::BOLD);
const std::string percentText = std::to_string(percent) + "%";
renderer.drawCenteredText(UI_12_FONT_ID, 70, percentText.c_str(), true, EpdFontFamily::BOLD);
renderer.drawCenteredText(UI_12_FONT_ID, 90, percentText.c_str(), true, EpdFontFamily::BOLD);
// Draw slider track.
const int screenWidth = renderer.getScreenWidth();
constexpr int barWidth = 360;
constexpr int barHeight = 16;
const int barX = (screenWidth - barWidth) / 2;
const int barY = 120;
const int barY = 140;
renderer.drawRect(barX, barY, barWidth, barHeight);