GUI: fix image loading (big endian)
This commit is contained in:
parent
bd730cbeec
commit
2357093bc8
|
@ -6361,11 +6361,7 @@ bool FurnaceGUI::init() {
|
||||||
const FurnaceGUIImage* furIcon=getImage(GUI_IMAGE_ICON);
|
const FurnaceGUIImage* furIcon=getImage(GUI_IMAGE_ICON);
|
||||||
SDL_Surface* icon=NULL;
|
SDL_Surface* icon=NULL;
|
||||||
if (furIcon!=NULL) {
|
if (furIcon!=NULL) {
|
||||||
#ifdef TA_BIG_ENDIAN
|
|
||||||
icon=SDL_CreateRGBSurfaceFrom(furIcon->data,furIcon->width,furIcon->height,32,256*4,0xff000000,0xff0000,0xff00,0xff);
|
|
||||||
#else
|
|
||||||
icon=SDL_CreateRGBSurfaceFrom(furIcon->data,furIcon->width,furIcon->height,32,256*4,0xff,0xff00,0xff0000,0xff000000);
|
icon=SDL_CreateRGBSurfaceFrom(furIcon->data,furIcon->width,furIcon->height,32,256*4,0xff,0xff00,0xff0000,0xff000000);
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
logE("furIcon is NULL!");
|
logE("furIcon is NULL!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,20 @@ FurnaceGUIImage* FurnaceGUI::getImage(FurnaceGUIImages image) {
|
||||||
|
|
||||||
logV("%dx%d",ret->width,ret->height);
|
logV("%dx%d",ret->width,ret->height);
|
||||||
|
|
||||||
|
#ifdef TA_BIG_ENDIAN
|
||||||
|
if (ret->ch==4) {
|
||||||
|
size_t total=ret->width*ret->height*ret->ch;
|
||||||
|
for (size_t i=0; i<total; i+=4) {
|
||||||
|
ret->data[i]^=ret->data[i|3];
|
||||||
|
ret->data[i|3]^=ret->data[i];
|
||||||
|
ret->data[i]^=ret->data[i|3];
|
||||||
|
ret->data[i|1]^=ret->data[i|2];
|
||||||
|
ret->data[i|2]^=ret->data[i|1];
|
||||||
|
ret->data[i|1]^=ret->data[i|2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
images[image]=ret;
|
images[image]=ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue