Removed hbmenuLogoImage from theme_t and just determine which AssetId to use for logo during rendering, imageSize from the asset is now used instead of from the layoutobj. Removed drawImageFromLayout since it's no longer used, and removed imageSize from the layout objects which don't need it anymore.
This commit is contained in:
parent
981749cfb7
commit
6ee5d36084
@ -180,12 +180,6 @@ static void drawImage(int x, int y, int width, int height, const uint8_t *image,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawImageFromLayout(ThemeLayoutId id, const uint8_t *image, ImageMode mode) {
|
|
||||||
ThemeLayoutObject *obj = &themeCurrent.layoutObjects[id];
|
|
||||||
if (!obj->visible) return;
|
|
||||||
drawImage(obj->posStart[0], obj->posStart[1], obj->imageSize[0], obj->imageSize[1], image, mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Draws an RGBA8888 image masked by the passed color.
|
//Draws an RGBA8888 image masked by the passed color.
|
||||||
static void drawIcon(int x, int y, int width, int height, const uint8_t *image, color_t color) {
|
static void drawIcon(int x, int y, int width, int height, const uint8_t *image, color_t color) {
|
||||||
int tmpx, tmpy;
|
int tmpx, tmpy;
|
||||||
@ -674,12 +668,17 @@ void menuLoop(void) {
|
|||||||
if (layoutobj->visible) drawWave(2, menuTimer, themeCurrent.frontWaveColor, layoutobj->size[1], 4.0, -2.5);
|
if (layoutobj->visible) drawWave(2, menuTimer, themeCurrent.frontWaveColor, layoutobj->size[1], 4.0, -2.5);
|
||||||
menuTimer += 0.05;
|
menuTimer += 0.05;
|
||||||
|
|
||||||
if (!themeCurrent.logoColor_set)
|
layoutobj = &themeCurrent.layoutObjects[ThemeLayoutId_Logo];
|
||||||
drawImageFromLayout(ThemeLayoutId_Logo, themeCurrent.hbmenuLogoImage, IMAGE_MODE_RGBA32);
|
if(themeGlobalPreset == THEME_PRESET_DARK)
|
||||||
else {
|
assetsGetData(AssetId_hbmenu_logo_dark, &data);
|
||||||
layoutobj = &themeCurrent.layoutObjects[ThemeLayoutId_Logo];
|
else assetsGetData(AssetId_hbmenu_logo_light, &data);
|
||||||
assetsGetData(AssetId_hbmenu_logo_light, &data);
|
|
||||||
if (layoutobj->visible) drawIcon(layoutobj->posStart[0], layoutobj->posStart[1], data->imageSize[0], data->imageSize[1], data->buffer, themeCurrent.logoColor);
|
if (layoutobj->visible) {
|
||||||
|
if (!themeCurrent.logoColor_set)
|
||||||
|
drawImage(layoutobj->posStart[0], layoutobj->posStart[1], data->imageSize[0], data->imageSize[1], data->buffer, data->imageMode);
|
||||||
|
else {
|
||||||
|
drawIcon(layoutobj->posStart[0], layoutobj->posStart[1], data->imageSize[0], data->imageSize[1], data->buffer, themeCurrent.logoColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawTextFromLayout(ThemeLayoutId_HbmenuVersion, themeCurrent.textColor, VERSION);
|
DrawTextFromLayout(ThemeLayoutId_HbmenuVersion, themeCurrent.textColor, VERSION);
|
||||||
|
@ -111,7 +111,6 @@ void themeStartup(ThemePreset preset) {
|
|||||||
.buttonMText = "\uE0F0",
|
.buttonMText = "\uE0F0",
|
||||||
.labelStarOnText = "\u2605",
|
.labelStarOnText = "\u2605",
|
||||||
.labelStarOffText = "\u2606",
|
.labelStarOffText = "\u2606",
|
||||||
.hbmenuLogoImage = assetsGetDataBuffer(AssetId_hbmenu_logo_light),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
theme_t themeDark = (theme_t) {
|
theme_t themeDark = (theme_t) {
|
||||||
@ -136,7 +135,6 @@ void themeStartup(ThemePreset preset) {
|
|||||||
.buttonMText = "\uE0B4",
|
.buttonMText = "\uE0B4",
|
||||||
.labelStarOnText = "\u2605",
|
.labelStarOnText = "\u2605",
|
||||||
.labelStarOffText = "\u2606",
|
.labelStarOffText = "\u2606",
|
||||||
.hbmenuLogoImage = assetsGetDataBuffer(AssetId_hbmenu_logo_dark),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
theme_t themeCommon = {
|
theme_t themeCommon = {
|
||||||
@ -145,7 +143,6 @@ void themeStartup(ThemePreset preset) {
|
|||||||
.visible = true,
|
.visible = true,
|
||||||
.posType = false,
|
.posType = false,
|
||||||
.posStart = {40, 20},
|
.posStart = {40, 20},
|
||||||
.imageSize = {140, 60},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
[ThemeLayoutId_HbmenuVersion] = {
|
[ThemeLayoutId_HbmenuVersion] = {
|
||||||
@ -312,7 +309,6 @@ void themeStartup(ThemePreset preset) {
|
|||||||
.visible = true,
|
.visible = true,
|
||||||
.posType = true,
|
.posType = true,
|
||||||
.posStart = {0, 0 + 47 + 10 + 3},
|
.posStart = {0, 0 + 47 + 10 + 3},
|
||||||
.imageSize = {24, 24},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
[ThemeLayoutId_BatteryCharge] = {
|
[ThemeLayoutId_BatteryCharge] = {
|
||||||
@ -326,14 +322,12 @@ void themeStartup(ThemePreset preset) {
|
|||||||
.visible = true,
|
.visible = true,
|
||||||
.posType = false,
|
.posType = false,
|
||||||
.posStart = {1180 - 8 - 24 - 8, 0 + 47 + 10 + 6},
|
.posStart = {1180 - 8 - 24 - 8, 0 + 47 + 10 + 6},
|
||||||
.imageSize = {24, 24},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
[ThemeLayoutId_ChargingIcon] = {
|
[ThemeLayoutId_ChargingIcon] = {
|
||||||
.visible = true,
|
.visible = true,
|
||||||
.posType = false,
|
.posType = false,
|
||||||
.posStart = {1180 - 20, 0 + 47 + 10 + 6},
|
.posStart = {1180 - 20, 0 + 47 + 10 + 6},
|
||||||
.imageSize = {24, 24},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
[ThemeLayoutId_Status] = {
|
[ThemeLayoutId_Status] = {
|
||||||
@ -521,7 +515,6 @@ void themeStartup(ThemePreset preset) {
|
|||||||
.progressBarColor = progressBarColor,
|
.progressBarColor = progressBarColor,
|
||||||
.logoColor_set = logoColor_set,
|
.logoColor_set = logoColor_set,
|
||||||
.enableWaveBlending = waveBlending,
|
.enableWaveBlending = waveBlending,
|
||||||
.hbmenuLogoImage = themeDefault->hbmenuLogoImage
|
|
||||||
};
|
};
|
||||||
strncpy(themeCurrent.buttonAText, AText, sizeof(themeCurrent.buttonAText));
|
strncpy(themeCurrent.buttonAText, AText, sizeof(themeCurrent.buttonAText));
|
||||||
themeCurrent.buttonAText[sizeof(themeCurrent.buttonAText)-1] = 0;
|
themeCurrent.buttonAText[sizeof(themeCurrent.buttonAText)-1] = 0;
|
||||||
|
@ -48,7 +48,6 @@ typedef struct
|
|||||||
char buttonMText[32];
|
char buttonMText[32];
|
||||||
char labelStarOnText[32];
|
char labelStarOnText[32];
|
||||||
char labelStarOffText[32];
|
char labelStarOffText[32];
|
||||||
const uint8_t *hbmenuLogoImage;
|
|
||||||
|
|
||||||
ThemeLayoutObject layoutObjects[ThemeLayoutId_Total];
|
ThemeLayoutObject layoutObjects[ThemeLayoutId_Total];
|
||||||
} theme_t;
|
} theme_t;
|
||||||
|
Loading…
Reference in New Issue
Block a user