modtrezorui: loader icon is now 64x64; reorganize icons

pull/25/head
Pavol Rusnak 8 years ago
parent f8bf6d8cff
commit ad6c274e07
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -283,8 +283,8 @@ void display_loader(uint16_t progress, uint16_t fgcolor, uint16_t bgcolor, const
set_color_table(iconcolortable, iconfgcolor, bgcolor);
}
display_set_window(DISPLAY_RESX / 2 - img_loader_size, DISPLAY_RESY / 2 - img_loader_size, img_loader_size * 2, img_loader_size * 2);
if (icon && memcmp(icon, "TOIg\x60\x00\x60\x00", 8) == 0 && iconlen == 12 + *(uint32_t *)(icon + 8)) {
uint8_t icondata[96 * 96 / 2];
if (icon && memcmp(icon, "TOIg", 4) == 0 && LOADER_ICON_SIZE == *(uint16_t *)(icon + 4) && LOADER_ICON_SIZE == *(uint16_t *)(icon + 6) && iconlen == 12 + *(uint32_t *)(icon + 8)) {
uint8_t icondata[LOADER_ICON_SIZE * LOADER_ICON_SIZE / 2];
sinf_inflate(icon + 12, iconlen - 12, inflate_callback_loader, icondata);
icon = icondata;
} else {
@ -310,8 +310,9 @@ void display_loader(uint16_t progress, uint16_t fgcolor, uint16_t bgcolor, const
a = 999 - (img_loader[my][mx] >> 8);
}
// inside of circle - draw glyph
if (icon && mx + my > (48 * 2) && mx >= img_loader_size - 48 && my >= img_loader_size - 48) {
int i = (x - (img_loader_size - 48)) + (y - (img_loader_size - 48)) * 96;
#define LOADER_ICON_CORNER_CUT 2
if (icon && mx + my > (((LOADER_ICON_SIZE / 2) + LOADER_ICON_CORNER_CUT) * 2) && mx >= img_loader_size - (LOADER_ICON_SIZE / 2) && my >= img_loader_size - (LOADER_ICON_SIZE / 2)) {
int i = (x - (img_loader_size - (LOADER_ICON_SIZE / 2))) + (y - (img_loader_size - (LOADER_ICON_SIZE / 2))) * LOADER_ICON_SIZE;
uint8_t c;
if (i % 2) {
c = icon[i / 2] & 0x0F;

@ -17,6 +17,8 @@
#define FONT_NORMAL 1
#define FONT_BOLD 2
#define LOADER_ICON_SIZE 64
void display_init(void);
void display_set_window(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
int display_orientation(int degrees);

@ -262,7 +262,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_qrcode_obj, 5, 5
/// Renders a rotating loader graphic.
/// Progress determines its position (0-1000), fgcolor is used as foreground color, bgcolor as background.
/// When icon and iconfgcolor are provided, an icon is drawn in the middle using the color specified in iconfgcolor.
/// Icon needs to be of exaclty 96x96 pixels size.
/// Icon needs to be of exactly LOADER_ICON_SIZE x LOADER_ICON_SIZE pixels size.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_loader(size_t n_args, const mp_obj_t *args) {
mp_int_t progress = mp_obj_get_int(args[1]);
@ -278,7 +278,7 @@ STATIC mp_obj_t mod_TrezorUi_Display_loader(size_t n_args, const mp_obj_t *args)
mp_int_t w = *(uint16_t *)(data + 4);
mp_int_t h = *(uint16_t *)(data + 6);
mp_int_t datalen = *(uint32_t *)(data + 8);
if (w != 96 || h != 96) {
if (w != LOADER_ICON_SIZE || h != LOADER_ICON_SIZE) {
mp_raise_ValueError("Invalid icon size");
}
if (datalen != icon.len - 12) {

@ -50,9 +50,9 @@ BACKLIGHT_DIM = const(5)
BACKLIGHT_MAX = const(255)
# icons
ICON_RESET = 'trezor/res/reset.toig'
ICON_WIPE = 'trezor/res/wipe.toig'
ICON_RECOVERY = 'trezor/res/recovery.toig'
ICON_RESET = 'trezor/res/header_icons/reset.toig'
ICON_WIPE = 'trezor/res/header_icons/wipe.toig'
ICON_RECOVERY = 'trezor/res/header_icons/recovery.toig'
def in_area(pos: tuple, area: tuple) -> bool:
x, y = pos

@ -25,7 +25,7 @@ class PinMatrix():
self.label = label
self.pin = pin
self.clear_button = Button((240 - 35, 5, 30, 30),
res.load('trezor/res/close-button.toig'),
res.load('trezor/res/pin_close.toig'),
normal_style=CLEAR_BUTTON,
active_style=CLEAR_BUTTON_ACTIVE)
self.pin_buttons = [Button(digit_area(i), str(d))

Loading…
Cancel
Save