JPEG also works
This commit is contained in:
+2
-1
@@ -426,10 +426,11 @@ const char *writeScreenshot()
|
|||||||
|
|
||||||
#define STB_IMAGE_IMPLEMENTATION
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
#define STBI_ONLY_PNG
|
#define STBI_ONLY_PNG
|
||||||
|
#define STBI_ONLY_JPEG
|
||||||
#include "thirdparty/Stb/stb_image.h"
|
#include "thirdparty/Stb/stb_image.h"
|
||||||
|
|
||||||
|
|
||||||
const char * pngLoad(uint8_t * bmp, const char * filename, uint16_t width, uint16_t height)
|
const char * imgLoad(uint8_t * bmp, const char * filename, uint16_t width, uint16_t height)
|
||||||
{
|
{
|
||||||
int x,y,n;
|
int x,y,n;
|
||||||
unsigned char *data = stbi_load(filename, &x, &y, &n, 3);
|
unsigned char *data = stbi_load(filename, &x, &y, &n, 3);
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ void lcdSetContrast();
|
|||||||
#define lcdOff(...)
|
#define lcdOff(...)
|
||||||
|
|
||||||
const char * bmpLoad(uint8_t * dest, const char * filename, uint16_t width, uint16_t height);
|
const char * bmpLoad(uint8_t * dest, const char * filename, uint16_t width, uint16_t height);
|
||||||
const char * pngLoad(uint8_t * bmp, const char * filename, uint16_t width, uint16_t height);
|
const char * imgLoad(uint8_t * bmp, const char * filename, uint16_t width, uint16_t height);
|
||||||
|
|
||||||
|
|
||||||
#if defined(BOOT)
|
#if defined(BOOT)
|
||||||
|
|||||||
@@ -367,10 +367,10 @@ bool menuGeneralSdManager(evt_t _event)
|
|||||||
lcdDrawBitmap(LCD_W/2, (LCD_H-MODEL_BITMAP_HEIGHT)/2, modelBitmap);
|
lcdDrawBitmap(LCD_W/2, (LCD_H-MODEL_BITMAP_HEIGHT)/2, modelBitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ext && !strcasecmp(ext, ".png")) {
|
if (ext && (!strcasecmp(ext, ".png") || !strcasecmp(ext, ".jpg"))) {
|
||||||
if (lastBitmap != menuVerticalPosition) {
|
if (lastBitmap != menuVerticalPosition) {
|
||||||
lastBitmap = menuVerticalPosition;
|
lastBitmap = menuVerticalPosition;
|
||||||
if (pngLoad(modelBitmap, reusableBuffer.sdmanager.lines[index], MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT)) {
|
if (imgLoad(modelBitmap, reusableBuffer.sdmanager.lines[index], MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT)) {
|
||||||
((uint32_t *)modelBitmap)[0] = 0;
|
((uint32_t *)modelBitmap)[0] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user