feat(theme): add roundedraff theme and fix sleep cover crop grid artifacts (#918)
## Summary - Add new `roundedraff` theme. - Fix sleep screen artifact where book cover showed grid lines in `Cover` mode with `Crop`. ## Additional Context ## Key changes - Added `src/components/themes/roundedraff/` theme implementation. - Updated sleep cover rendering logic in: - `src/activities/boot_sleep/SleepActivity.cpp` - `src/activities/boot_sleep/SleepActivity.h` - Improved cover generation/regeneration paths in: - `lib/Epub/Epub.cpp` - `lib/Epub/Epub.h` - `lib/Txt/Txt.cpp` - `lib/Txt/Txt.h` ## Verification - Sleep screen set to Book cover - Sleep screen cover mode set to Crop - Confirmed grid artifacts no longer appear on cover sleep screen. ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**< YES >**_ --------- Co-authored-by: CaptainFrito <yzq6x5zypy@privaterelay.appleid.com> Co-authored-by: Zach Nelson <zach@zdnelson.com> Co-authored-by: Uri Tauber <142022451+Uri-Tauber@users.noreply.github.com>
This commit is contained in:
co-authored by
CaptainFrito
Zach Nelson
Uri Tauber
parent
33386953d9
commit
b8a51522ca
@@ -493,6 +493,41 @@ void GfxRenderer::fillRectDither(const int x, const int y, const int width, cons
|
||||
}
|
||||
}
|
||||
|
||||
void GfxRenderer::maskRoundedRectOutsideCorners(const int x, const int y, const int width, const int height,
|
||||
const int radius, const Color color) const {
|
||||
if (radius <= 0 || color == Color::Clear) {
|
||||
return;
|
||||
}
|
||||
|
||||
const int rr = radius - 1;
|
||||
const int rr2 = rr * rr;
|
||||
for (int dy = 0; dy < radius; dy++) {
|
||||
for (int dx = 0; dx < radius; dx++) {
|
||||
const int tx = rr - dx;
|
||||
const int ty = rr - dy;
|
||||
if (tx * tx + ty * ty > rr2) {
|
||||
if (color == Color::White || color == Color::Black) {
|
||||
bool state = color == Color::Black;
|
||||
drawPixel(x + dx, y + dy, state); // top-left
|
||||
drawPixel(x + width - 1 - dx, y + dy, state); // top-right
|
||||
drawPixel(x + dx, y + height - 1 - dy, state); // bottom-left
|
||||
drawPixel(x + width - 1 - dx, y + height - 1 - dy, state); // bottom-right
|
||||
} else if (color == Color::LightGray) {
|
||||
drawPixelDither<Color::LightGray>(x + dx, y + dy); // top-left
|
||||
drawPixelDither<Color::LightGray>(x + width - 1 - dx, y + dy); // top-right
|
||||
drawPixelDither<Color::LightGray>(x + dx, y + height - 1 - dy); // bottom-left
|
||||
drawPixelDither<Color::LightGray>(x + width - 1 - dx, y + height - 1 - dy); // bottom-right
|
||||
} else if (color == Color::DarkGray) {
|
||||
drawPixelDither<Color::DarkGray>(x + dx, y + dy); // top-left
|
||||
drawPixelDither<Color::DarkGray>(x + width - 1 - dx, y + dy); // top-right
|
||||
drawPixelDither<Color::DarkGray>(x + dx, y + height - 1 - dy); // bottom-left
|
||||
drawPixelDither<Color::DarkGray>(x + width - 1 - dx, y + height - 1 - dy); // bottom-right
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <Color color>
|
||||
void GfxRenderer::fillArc(const int maxRadius, const int cx, const int cy, const int xDir, const int yDir) const {
|
||||
if (maxRadius <= 0) return;
|
||||
|
||||
@@ -100,6 +100,7 @@ class GfxRenderer {
|
||||
void drawRoundedRect(int x, int y, int width, int height, int lineWidth, int cornerRadius, bool state) const;
|
||||
void drawRoundedRect(int x, int y, int width, int height, int lineWidth, int cornerRadius, bool roundTopLeft,
|
||||
bool roundTopRight, bool roundBottomLeft, bool roundBottomRight, bool state) const;
|
||||
void maskRoundedRectOutsideCorners(int x, int y, int width, int height, int radius, Color color = Color::White) const;
|
||||
void fillRect(int x, int y, int width, int height, bool state = true) const;
|
||||
void fillRectDither(int x, int y, int width, int height, Color color) const;
|
||||
void fillRoundedRect(int x, int y, int width, int height, int cornerRadius, Color color) const;
|
||||
|
||||
@@ -202,6 +202,7 @@ STR_FILTER_CONTRAST: "Kontrast"
|
||||
STR_UI_THEME: "Šablona rozhraní"
|
||||
STR_THEME_CLASSIC: "Klasická"
|
||||
STR_THEME_LYRA: "Lyra"
|
||||
STR_THEME_ROUNDEDRAFF: "RoundedRaff"
|
||||
STR_THEME_LYRA_EXTENDED: "Lyra Extended"
|
||||
STR_SUNLIGHT_FADING_FIX: "Oprava blednutí na slunci"
|
||||
STR_REMAP_FRONT_BUTTONS: "Přemapovat přední tlačítka"
|
||||
|
||||
@@ -228,6 +228,7 @@ STR_BATTERY: "Battery"
|
||||
STR_UI_THEME: "UI Theme"
|
||||
STR_THEME_CLASSIC: "Classic"
|
||||
STR_THEME_LYRA: "Lyra"
|
||||
STR_THEME_ROUNDEDRAFF: "RoundedRaff"
|
||||
STR_THEME_LYRA_EXTENDED: "Lyra Extended"
|
||||
STR_SUNLIGHT_FADING_FIX: "Sunlight Fading Fix"
|
||||
STR_REMAP_FRONT_BUTTONS: "Remap Front Buttons"
|
||||
|
||||
@@ -225,6 +225,7 @@ STR_BATTERY: "Batterie"
|
||||
STR_UI_THEME: "Thème interface"
|
||||
STR_THEME_CLASSIC: "Classique"
|
||||
STR_THEME_LYRA: "Lyra"
|
||||
STR_THEME_ROUNDEDRAFF: "RoundedRaff"
|
||||
STR_THEME_LYRA_EXTENDED: "Lyra Extended"
|
||||
STR_SUNLIGHT_FADING_FIX: "Correction lisibilité au soleil"
|
||||
STR_REMAP_FRONT_BUTTONS: "Configurer boutons façade"
|
||||
|
||||
@@ -225,6 +225,7 @@ STR_BATTERY: "Batterie"
|
||||
STR_UI_THEME: "System-Design"
|
||||
STR_THEME_CLASSIC: "Klassisch"
|
||||
STR_THEME_LYRA: "Lyra"
|
||||
STR_THEME_ROUNDEDRAFF: "RoundedRaff"
|
||||
STR_THEME_LYRA_EXTENDED: "Lyra Extended"
|
||||
STR_SUNLIGHT_FADING_FIX: "Anti-Verblassen"
|
||||
STR_REMAP_FRONT_BUTTONS: "Vordere Tasten belegen"
|
||||
|
||||
@@ -202,6 +202,7 @@ STR_FILTER_CONTRAST: "Contraste"
|
||||
STR_UI_THEME: "Tema da interface"
|
||||
STR_THEME_CLASSIC: "Clássico"
|
||||
STR_THEME_LYRA: "Lyra"
|
||||
STR_THEME_ROUNDEDRAFF: "RoundedRaff"
|
||||
STR_THEME_LYRA_EXTENDED: "Lyra Extended"
|
||||
STR_SUNLIGHT_FADING_FIX: "Ajuste desbotamento ao sol"
|
||||
STR_REMAP_FRONT_BUTTONS: "Remapear botões frontais"
|
||||
|
||||
@@ -225,6 +225,7 @@ STR_BATTERY: "Батарея"
|
||||
STR_UI_THEME: "Тема интерфейса"
|
||||
STR_THEME_CLASSIC: "Классическая"
|
||||
STR_THEME_LYRA: "Lyra"
|
||||
STR_THEME_ROUNDEDRAFF: "RoundedRaff"
|
||||
STR_THEME_LYRA_EXTENDED: "Lyra Extended"
|
||||
STR_SUNLIGHT_FADING_FIX: "Компенсация выцветания"
|
||||
STR_REMAP_FRONT_BUTTONS: "Переназначить передние кнопки"
|
||||
|
||||
@@ -226,6 +226,7 @@ STR_UI_THEME: "Interfaz"
|
||||
STR_THEME_CLASSIC: "Clásico"
|
||||
STR_THEME_LYRA: "Lyra"
|
||||
STR_THEME_LYRA_EXTENDED: "Lyra Extendido"
|
||||
STR_THEME_ROUNDEDRAFF: "RoundedRaff"
|
||||
STR_SUNLIGHT_FADING_FIX: "Corrección de desvanecimiento"
|
||||
STR_REMAP_FRONT_BUTTONS: "Reconfigurar botones frontales"
|
||||
STR_OPDS_BROWSER: "Navegador OPDS"
|
||||
|
||||
@@ -228,6 +228,7 @@ STR_BATTERY: "Batteri"
|
||||
STR_UI_THEME: "Användargränssnittstema"
|
||||
STR_THEME_CLASSIC: "Klassisk"
|
||||
STR_THEME_LYRA: "Lyra"
|
||||
STR_THEME_ROUNDEDRAFF: "RoundedRaff"
|
||||
STR_THEME_LYRA_EXTENDED: "Lyra utökad"
|
||||
STR_SUNLIGHT_FADING_FIX: "Fix för solskensmattning"
|
||||
STR_REMAP_FRONT_BUTTONS: "Ändra frontknappar"
|
||||
|
||||
Reference in New Issue
Block a user