[Horus] Model bitmaps can now be either BMP or JPG or BMP

This commit is contained in:
Bertrand Songis
2016-06-07 20:35:17 +02:00
parent 5822cfded1
commit 06bef98a05
9 changed files with 44 additions and 15 deletions
+1 -1
View File
@@ -480,7 +480,7 @@ void BitmapBuffer::drawBitmapPatternPie(coord_t x0, coord_t y0, const uint8_t *
BitmapBuffer * BitmapBuffer::load(const char * filename)
{
const char * ext = getFileExtension(filename);
if (!strcmp(ext, ".bmp"))
if (ext && !strcmp(ext, ".bmp"))
return load_bmp(filename);
else
return load_stb(filename);
@@ -362,7 +362,7 @@ bool menuGeneralSdManager(evt_t _event)
}
char * ext = getFileExtension(reusableBuffer.sdmanager.lines[index], SD_SCREEN_FILE_LENGTH+1);
if (ext && (!strcasecmp(ext, BITMAPS_EXT) || !strcasecmp(ext, PNG_EXT) || !strcasecmp(ext, JPG_EXT))) {
if (ext && (!strcasecmp(ext, BMP_EXT) || !strcasecmp(ext, PNG_EXT) || !strcasecmp(ext, JPG_EXT))) {
if (currentBitmapIndex != menuVerticalPosition) {
currentBitmapIndex = menuVerticalPosition;
delete currentBitmap;
+1 -1
View File
@@ -258,7 +258,7 @@ bool menuModelSetup(evt_t event)
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VCSWFUNC, 0, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
s_editMode = 0;
if (sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), g_model.header.bitmap, LIST_NONE_SD_FILE)) {
if (sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), g_model.header.bitmap, LIST_NONE_SD_FILE | LIST_SD_FILE_EXT)) {
POPUP_MENU_START(onModelSetupBitmapMenu);
}
else {
+1 -1
View File
@@ -42,7 +42,7 @@ class ModelBitmapWidget: public Widget
if (buffer) {
buffer->drawBitmap(0, 0, lcd, zone.x, zone.y, zone.w, zone.h);
GET_FILENAME(filename, BITMAPS_PATH, g_model.header.bitmap, BITMAPS_EXT);
GET_FILENAME(filename, BITMAPS_PATH, g_model.header.bitmap, "");
BitmapBuffer * bitmap = BitmapBuffer::load(filename);
if (zone.h >= 96 && zone.w >= 120) {
buffer->drawFilledRect(0, 0, zone.w, zone.h, SOLID, MAINVIEW_PANES_COLOR | OPACITY(5));
+1 -1
View File
@@ -222,7 +222,7 @@ const char * writeScreenshot()
char * tmp = strAppend(&filename[sizeof(SCREENSHOTS_PATH)-1], "/screen");
tmp = strAppendDate(tmp, true);
strcpy(tmp, BITMAPS_EXT);
strcpy(tmp, BMP_EXT);
FRESULT result = f_open(&bmpFile, filename, FA_CREATE_ALWAYS | FA_WRITE);
if (result != FR_OK) {