mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 01:35:21 +03:00
JPEG also works
This commit is contained in:
parent
03c9b2c4a2
commit
acaa77daab
3 changed files with 5 additions and 4 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue