handle other texture formats
This commit is contained in:
parent
f51ad1cf1f
commit
a4cba0f05c
|
@ -101,6 +101,44 @@ FurnaceGUIImage* FurnaceGUI::getImage(FurnaceGUIImages image) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (ret->ch==4) {
|
||||||
|
size_t total=ret->width*ret->height*ret->ch;
|
||||||
|
switch (bestTexFormat) {
|
||||||
|
case GUI_TEXFORMAT_ARGB32:
|
||||||
|
for (size_t i=0; i<total; i+=4) {
|
||||||
|
ret->data[i]^=ret->data[i|2];
|
||||||
|
ret->data[i|2]^=ret->data[i];
|
||||||
|
ret->data[i]^=ret->data[i|2];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GUI_TEXFORMAT_BGRA32:
|
||||||
|
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];
|
||||||
|
ret->data[i|1]^=ret->data[i|3];
|
||||||
|
ret->data[i|3]^=ret->data[i|1];
|
||||||
|
ret->data[i|1]^=ret->data[i|3];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GUI_TEXFORMAT_RGBA32:
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
images[image]=ret;
|
images[image]=ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,7 @@ class FurnaceDXTexture: public FurnaceGUITexture {
|
||||||
ID3D11Texture2D* tex;
|
ID3D11Texture2D* tex;
|
||||||
ID3D11ShaderResourceView* view;
|
ID3D11ShaderResourceView* view;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
FurnaceGUITextureFormat format;
|
||||||
unsigned char* lockedData;
|
unsigned char* lockedData;
|
||||||
bool dynamic;
|
bool dynamic;
|
||||||
FurnaceDXTexture():
|
FurnaceDXTexture():
|
||||||
|
@ -82,6 +83,7 @@ class FurnaceDXTexture: public FurnaceGUITexture {
|
||||||
view(NULL),
|
view(NULL),
|
||||||
width(0),
|
width(0),
|
||||||
height(0),
|
height(0),
|
||||||
|
format(GUI_TEXFORMAT_UNKNOWN),
|
||||||
lockedData(NULL),
|
lockedData(NULL),
|
||||||
dynamic(false) {}
|
dynamic(false) {}
|
||||||
};
|
};
|
||||||
|
@ -147,6 +149,11 @@ ImTextureID FurnaceGUIRenderDX11::getTextureID(FurnaceGUITexture* which) {
|
||||||
return (ImTextureID)t->view;
|
return (ImTextureID)t->view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FurnaceGUITextureFormat FurnaceGUIRenderDX11::getTextureFormat(FurnaceGUITexture* which) {
|
||||||
|
FurnaceDXTexture* t=(FurnaceDXTexture*)which;
|
||||||
|
return t->format;
|
||||||
|
}
|
||||||
|
|
||||||
bool FurnaceGUIRenderDX11::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
bool FurnaceGUIRenderDX11::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
||||||
FurnaceDXTexture* t=(FurnaceDXTexture*)which;
|
FurnaceDXTexture* t=(FurnaceDXTexture*)which;
|
||||||
if (t->lockedData!=NULL) return false;
|
if (t->lockedData!=NULL) return false;
|
||||||
|
@ -256,6 +263,7 @@ FurnaceGUITexture* FurnaceGUIRenderDX11::createTexture(bool dynamic, int width,
|
||||||
ret->tex=tex;
|
ret->tex=tex;
|
||||||
ret->view=view;
|
ret->view=view;
|
||||||
ret->dynamic=dynamic;
|
ret->dynamic=dynamic;
|
||||||
|
ret->format=format;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ class FurnaceGUIRenderDX11: public FurnaceGUIRender {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ImTextureID getTextureID(FurnaceGUITexture* which);
|
ImTextureID getTextureID(FurnaceGUITexture* which);
|
||||||
|
FurnaceGUITextureFormat getTextureFormat(FurnaceGUITexture* which);
|
||||||
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
||||||
bool unlockTexture(FurnaceGUITexture* which);
|
bool unlockTexture(FurnaceGUITexture* which);
|
||||||
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
||||||
|
|
|
@ -30,6 +30,7 @@ class FurnaceDX9Texture: public FurnaceGUITexture {
|
||||||
IDirect3DTexture9* tex;
|
IDirect3DTexture9* tex;
|
||||||
IDirect3DTexture9* texPre;
|
IDirect3DTexture9* texPre;
|
||||||
int width, height, widthReal, heightReal;
|
int width, height, widthReal, heightReal;
|
||||||
|
FurnaceGUITextureFormat format;
|
||||||
unsigned char* lockedData;
|
unsigned char* lockedData;
|
||||||
bool dynamic;
|
bool dynamic;
|
||||||
FurnaceDX9Texture():
|
FurnaceDX9Texture():
|
||||||
|
@ -39,6 +40,7 @@ class FurnaceDX9Texture: public FurnaceGUITexture {
|
||||||
height(0),
|
height(0),
|
||||||
widthReal(0),
|
widthReal(0),
|
||||||
heightReal(0),
|
heightReal(0),
|
||||||
|
format(GUI_TEXFORMAT_UNKNOWN),
|
||||||
lockedData(NULL),
|
lockedData(NULL),
|
||||||
dynamic(false) {}
|
dynamic(false) {}
|
||||||
};
|
};
|
||||||
|
@ -62,6 +64,11 @@ float FurnaceGUIRenderDX9::getTextureV(FurnaceGUITexture* which) {
|
||||||
return (float)t->height/(float)t->heightReal;
|
return (float)t->height/(float)t->heightReal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FurnaceGUITextureFormat FurnaceGUIRenderDX9::getTextureFormat(FurnaceGUITexture* which) {
|
||||||
|
FurnaceDX9Texture* t=(FurnaceDX9Texture*)which;
|
||||||
|
return t->format;
|
||||||
|
}
|
||||||
|
|
||||||
bool FurnaceGUIRenderDX9::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
bool FurnaceGUIRenderDX9::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
||||||
FurnaceDX9Texture* t=(FurnaceDX9Texture*)which;
|
FurnaceDX9Texture* t=(FurnaceDX9Texture*)which;
|
||||||
D3DLOCKED_RECT lockedRect;
|
D3DLOCKED_RECT lockedRect;
|
||||||
|
@ -198,6 +205,7 @@ FurnaceGUITexture* FurnaceGUIRenderDX9::createTexture(bool dynamic, int width, i
|
||||||
ret->tex=tex;
|
ret->tex=tex;
|
||||||
ret->texPre=texPre;
|
ret->texPre=texPre;
|
||||||
ret->dynamic=dynamic;
|
ret->dynamic=dynamic;
|
||||||
|
ret->format=format;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ class FurnaceGUIRenderDX9: public FurnaceGUIRender {
|
||||||
ImTextureID getTextureID(FurnaceGUITexture* which);
|
ImTextureID getTextureID(FurnaceGUITexture* which);
|
||||||
float getTextureU(FurnaceGUITexture* which);
|
float getTextureU(FurnaceGUITexture* which);
|
||||||
float getTextureV(FurnaceGUITexture* which);
|
float getTextureV(FurnaceGUITexture* which);
|
||||||
|
FurnaceGUITextureFormat getTextureFormat(FurnaceGUITexture* which);
|
||||||
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
||||||
bool unlockTexture(FurnaceGUITexture* which);
|
bool unlockTexture(FurnaceGUITexture* which);
|
||||||
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
||||||
|
|
|
@ -65,11 +65,13 @@ class FurnaceGLTexture: public FurnaceGUITexture {
|
||||||
public:
|
public:
|
||||||
GLuint id;
|
GLuint id;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
FurnaceGUITextureFormat format;
|
||||||
unsigned char* lockedData;
|
unsigned char* lockedData;
|
||||||
FurnaceGLTexture():
|
FurnaceGLTexture():
|
||||||
id(0),
|
id(0),
|
||||||
width(0),
|
width(0),
|
||||||
height(0),
|
height(0),
|
||||||
|
format(GUI_TEXFORMAT_UNKNOWN),
|
||||||
lockedData(NULL) {}
|
lockedData(NULL) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -281,6 +283,11 @@ ImTextureID FurnaceGUIRenderGL::getTextureID(FurnaceGUITexture* which) {
|
||||||
return (ImTextureID)ret;
|
return (ImTextureID)ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FurnaceGUITextureFormat FurnaceGUIRenderGL::getTextureFormat(FurnaceGUITexture* which) {
|
||||||
|
FurnaceGLTexture* t=(FurnaceGLTexture*)which;
|
||||||
|
return t->format;
|
||||||
|
}
|
||||||
|
|
||||||
bool FurnaceGUIRenderGL::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
bool FurnaceGUIRenderGL::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
||||||
FurnaceGLTexture* t=(FurnaceGLTexture*)which;
|
FurnaceGLTexture* t=(FurnaceGLTexture*)which;
|
||||||
if (t->lockedData!=NULL) return false;
|
if (t->lockedData!=NULL) return false;
|
||||||
|
@ -334,6 +341,7 @@ FurnaceGUITexture* FurnaceGUIRenderGL::createTexture(bool dynamic, int width, in
|
||||||
C(furActiveTexture(GL_TEXTURE0));
|
C(furActiveTexture(GL_TEXTURE0));
|
||||||
t->width=width;
|
t->width=width;
|
||||||
t->height=height;
|
t->height=height;
|
||||||
|
t->format=format;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ class FurnaceGUIRenderGL: public FurnaceGUIRender {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ImTextureID getTextureID(FurnaceGUITexture* which);
|
ImTextureID getTextureID(FurnaceGUITexture* which);
|
||||||
|
FurnaceGUITextureFormat getTextureFormat(FurnaceGUITexture* which);
|
||||||
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
||||||
bool unlockTexture(FurnaceGUITexture* which);
|
bool unlockTexture(FurnaceGUITexture* which);
|
||||||
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
||||||
|
|
|
@ -29,6 +29,7 @@ class FurnaceGL1Texture: public FurnaceGUITexture {
|
||||||
public:
|
public:
|
||||||
GLuint id;
|
GLuint id;
|
||||||
int width, height, widthReal, heightReal;
|
int width, height, widthReal, heightReal;
|
||||||
|
FurnaceGUITextureFormat format;
|
||||||
unsigned char* lockedData;
|
unsigned char* lockedData;
|
||||||
FurnaceGL1Texture():
|
FurnaceGL1Texture():
|
||||||
id(0),
|
id(0),
|
||||||
|
@ -36,6 +37,7 @@ class FurnaceGL1Texture: public FurnaceGUITexture {
|
||||||
height(0),
|
height(0),
|
||||||
widthReal(0),
|
widthReal(0),
|
||||||
heightReal(0),
|
heightReal(0),
|
||||||
|
format(GUI_TEXFORMAT_UNKNOWN),
|
||||||
lockedData(NULL) {}
|
lockedData(NULL) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,6 +58,11 @@ float FurnaceGUIRenderGL1::getTextureV(FurnaceGUITexture* which) {
|
||||||
return (float)t->height/(float)t->heightReal;
|
return (float)t->height/(float)t->heightReal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FurnaceGUITextureFormat FurnaceGUIRenderGL1::getTextureFormat(FurnaceGUITexture* which) {
|
||||||
|
FurnaceGL1Texture* t=(FurnaceGL1Texture*)which;
|
||||||
|
return t->format;
|
||||||
|
}
|
||||||
|
|
||||||
bool FurnaceGUIRenderGL1::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
bool FurnaceGUIRenderGL1::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
||||||
FurnaceGL1Texture* t=(FurnaceGL1Texture*)which;
|
FurnaceGL1Texture* t=(FurnaceGL1Texture*)which;
|
||||||
if (t->lockedData!=NULL) return false;
|
if (t->lockedData!=NULL) return false;
|
||||||
|
@ -125,6 +132,7 @@ FurnaceGUITexture* FurnaceGUIRenderGL1::createTexture(bool dynamic, int width, i
|
||||||
t->height=height;
|
t->height=height;
|
||||||
t->widthReal=widthReal;
|
t->widthReal=widthReal;
|
||||||
t->heightReal=heightReal;
|
t->heightReal=heightReal;
|
||||||
|
t->format=format;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ class FurnaceGUIRenderGL1: public FurnaceGUIRender {
|
||||||
ImTextureID getTextureID(FurnaceGUITexture* which);
|
ImTextureID getTextureID(FurnaceGUITexture* which);
|
||||||
float getTextureU(FurnaceGUITexture* which);
|
float getTextureU(FurnaceGUITexture* which);
|
||||||
float getTextureV(FurnaceGUITexture* which);
|
float getTextureV(FurnaceGUITexture* which);
|
||||||
|
FurnaceGUITextureFormat getTextureFormat(FurnaceGUITexture* which);
|
||||||
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
||||||
bool unlockTexture(FurnaceGUITexture* which);
|
bool unlockTexture(FurnaceGUITexture* which);
|
||||||
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
||||||
|
|
|
@ -28,6 +28,7 @@ class FurnaceGUIRenderMetal: public FurnaceGUIRender {
|
||||||
String vendorName, deviceName, apiVersion;
|
String vendorName, deviceName, apiVersion;
|
||||||
public:
|
public:
|
||||||
ImTextureID getTextureID(FurnaceGUITexture* which);
|
ImTextureID getTextureID(FurnaceGUITexture* which);
|
||||||
|
FurnaceGUITextureFormat getTextureFormat(FurnaceGUITexture* which);
|
||||||
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
||||||
bool unlockTexture(FurnaceGUITexture* which);
|
bool unlockTexture(FurnaceGUITexture* which);
|
||||||
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
||||||
|
|
|
@ -44,11 +44,13 @@ class FurnaceMetalTexture: public FurnaceGUITexture {
|
||||||
public:
|
public:
|
||||||
id<MTLTexture> tex;
|
id<MTLTexture> tex;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
FurnaceGUITextureFormat format;
|
||||||
unsigned char* lockedData;
|
unsigned char* lockedData;
|
||||||
FurnaceMetalTexture():
|
FurnaceMetalTexture():
|
||||||
tex(NULL),
|
tex(NULL),
|
||||||
width(0),
|
width(0),
|
||||||
height(0),
|
height(0),
|
||||||
|
format(GUI_TEXFORMAT_UNKNOWN),
|
||||||
lockedData(NULL) {}
|
lockedData(NULL) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,6 +59,11 @@ ImTextureID FurnaceGUIRenderMetal::getTextureID(FurnaceGUITexture* which) {
|
||||||
return t->tex;
|
return t->tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FurnaceGUITextureFormat FurnaceGUIRenderMetal::getTextureFormat(FurnaceGUITexture* which) {
|
||||||
|
FurnaceMetalTexture* t=(FurnaceMetalTexture*)which;
|
||||||
|
return t->format;
|
||||||
|
}
|
||||||
|
|
||||||
bool FurnaceGUIRenderMetal::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
bool FurnaceGUIRenderMetal::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
||||||
FurnaceMetalTexture* t=(FurnaceMetalTexture*)which;
|
FurnaceMetalTexture* t=(FurnaceMetalTexture*)which;
|
||||||
if (t->lockedData!=NULL) return false;
|
if (t->lockedData!=NULL) return false;
|
||||||
|
|
|
@ -24,8 +24,10 @@
|
||||||
class FurnaceSDLTexture: public FurnaceGUITexture {
|
class FurnaceSDLTexture: public FurnaceGUITexture {
|
||||||
public:
|
public:
|
||||||
SDL_Texture* tex;
|
SDL_Texture* tex;
|
||||||
|
FurnaceGUITextureFormat format;
|
||||||
FurnaceSDLTexture():
|
FurnaceSDLTexture():
|
||||||
tex(NULL) {}
|
tex(NULL),
|
||||||
|
format(GUI_TEXFORMAT_UNKNOWN) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
ImTextureID FurnaceGUIRenderSDL::getTextureID(FurnaceGUITexture* which) {
|
ImTextureID FurnaceGUIRenderSDL::getTextureID(FurnaceGUITexture* which) {
|
||||||
|
@ -33,6 +35,11 @@ ImTextureID FurnaceGUIRenderSDL::getTextureID(FurnaceGUITexture* which) {
|
||||||
return t->tex;
|
return t->tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FurnaceGUITextureFormat FurnaceGUIRenderSDL::getTextureFormat(FurnaceGUITexture* which) {
|
||||||
|
FurnaceSDLTexture* t=(FurnaceSDLTexture*)which;
|
||||||
|
return t->format;
|
||||||
|
}
|
||||||
|
|
||||||
bool FurnaceGUIRenderSDL::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
bool FurnaceGUIRenderSDL::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
||||||
FurnaceSDLTexture* t=(FurnaceSDLTexture*)which;
|
FurnaceSDLTexture* t=(FurnaceSDLTexture*)which;
|
||||||
return SDL_LockTexture(t->tex,NULL,data,pitch)==0;
|
return SDL_LockTexture(t->tex,NULL,data,pitch)==0;
|
||||||
|
@ -61,6 +68,7 @@ FurnaceGUITexture* FurnaceGUIRenderSDL::createTexture(bool dynamic, int width, i
|
||||||
if (t==NULL) return NULL;
|
if (t==NULL) return NULL;
|
||||||
FurnaceSDLTexture* ret=new FurnaceSDLTexture;
|
FurnaceSDLTexture* ret=new FurnaceSDLTexture;
|
||||||
ret->tex=t;
|
ret->tex=t;
|
||||||
|
ret->format=format;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ class FurnaceGUIRenderSDL: public FurnaceGUIRender {
|
||||||
bool swapIntervalSet;
|
bool swapIntervalSet;
|
||||||
public:
|
public:
|
||||||
ImTextureID getTextureID(FurnaceGUITexture* which);
|
ImTextureID getTextureID(FurnaceGUITexture* which);
|
||||||
|
FurnaceGUITextureFormat getTextureFormat(FurnaceGUITexture* which);
|
||||||
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
||||||
bool unlockTexture(FurnaceGUITexture* which);
|
bool unlockTexture(FurnaceGUITexture* which);
|
||||||
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
||||||
|
|
|
@ -24,8 +24,10 @@
|
||||||
class FurnaceSoftwareTexture: public FurnaceGUITexture {
|
class FurnaceSoftwareTexture: public FurnaceGUITexture {
|
||||||
public:
|
public:
|
||||||
SWTexture* tex;
|
SWTexture* tex;
|
||||||
|
FurnaceGUITextureFormat format;
|
||||||
FurnaceSoftwareTexture():
|
FurnaceSoftwareTexture():
|
||||||
tex(NULL) {}
|
tex(NULL),
|
||||||
|
format(GUI_TEXFORMAT_UNKNOWN) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
ImTextureID FurnaceGUIRenderSoftware::getTextureID(FurnaceGUITexture* which) {
|
ImTextureID FurnaceGUIRenderSoftware::getTextureID(FurnaceGUITexture* which) {
|
||||||
|
@ -33,6 +35,11 @@ ImTextureID FurnaceGUIRenderSoftware::getTextureID(FurnaceGUITexture* which) {
|
||||||
return t->tex;
|
return t->tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FurnaceGUITextureFormat FurnaceGUIRenderSoftware::getTextureFormat(FurnaceGUITexture* which) {
|
||||||
|
FurnaceSoftwareTexture* t=(FurnaceSoftwareTexture*)which;
|
||||||
|
return t->format;
|
||||||
|
}
|
||||||
|
|
||||||
bool FurnaceGUIRenderSoftware::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
bool FurnaceGUIRenderSoftware::lockTexture(FurnaceGUITexture* which, void** data, int* pitch) {
|
||||||
FurnaceSoftwareTexture* t=(FurnaceSoftwareTexture*)which;
|
FurnaceSoftwareTexture* t=(FurnaceSoftwareTexture*)which;
|
||||||
if (!t->tex->managed) return false;
|
if (!t->tex->managed) return false;
|
||||||
|
@ -59,6 +66,7 @@ FurnaceGUITexture* FurnaceGUIRenderSoftware::createTexture(bool dynamic, int wid
|
||||||
}
|
}
|
||||||
FurnaceSoftwareTexture* ret=new FurnaceSoftwareTexture;
|
FurnaceSoftwareTexture* ret=new FurnaceSoftwareTexture;
|
||||||
ret->tex=new SWTexture(width,height);
|
ret->tex=new SWTexture(width,height);
|
||||||
|
ret->format=format;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ class FurnaceGUIRenderSoftware: public FurnaceGUIRender {
|
||||||
SDL_Window* sdlWin;
|
SDL_Window* sdlWin;
|
||||||
public:
|
public:
|
||||||
ImTextureID getTextureID(FurnaceGUITexture* which);
|
ImTextureID getTextureID(FurnaceGUITexture* which);
|
||||||
|
FurnaceGUITextureFormat getTextureFormat(FurnaceGUITexture* which);
|
||||||
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
|
||||||
bool unlockTexture(FurnaceGUITexture* which);
|
bool unlockTexture(FurnaceGUITexture* which);
|
||||||
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
|
||||||
|
|
|
@ -31,6 +31,15 @@
|
||||||
#include "sampleUtil.h"
|
#include "sampleUtil.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
#define SWAP_COLOR_ARGB(x) \
|
||||||
|
x=(x&0xff00ff00)|((x&0xff)<<16)|((x&0xff0000)>>16);
|
||||||
|
|
||||||
|
#define SWAP_COLOR_BGRA(x) \
|
||||||
|
x=((x&0xff0000000)>>24)|((x&0xffffff)<<8);
|
||||||
|
|
||||||
|
#define SWAP_COLOR_RGBA(x) \
|
||||||
|
x=((x&0xff)<<24)|((x&0xff00)<<8)|((x&0xff0000)>>8)|((x&0xff000000)>>24);
|
||||||
|
|
||||||
const double timeDivisors[10]={
|
const double timeDivisors[10]={
|
||||||
1000.0, 500.0, 200.0, 100.0, 50.0, 20.0, 10.0, 5.0, 2.0, 1.0
|
1000.0, 500.0, 200.0, 100.0, 50.0, 20.0, 10.0, 5.0, 2.0, 1.0
|
||||||
};
|
};
|
||||||
|
@ -1501,6 +1510,30 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
ImU32 bgColorLoop=ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_LOOP]);
|
ImU32 bgColorLoop=ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_LOOP]);
|
||||||
ImU32 lineColor=ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_FG]);
|
ImU32 lineColor=ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_FG]);
|
||||||
ImU32 centerLineColor=ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_CENTER]);
|
ImU32 centerLineColor=ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_CENTER]);
|
||||||
|
|
||||||
|
switch (rend->getTextureFormat(sampleTex)) {
|
||||||
|
case GUI_TEXFORMAT_ARGB32:
|
||||||
|
SWAP_COLOR_ARGB(bgColor);
|
||||||
|
SWAP_COLOR_ARGB(bgColorLoop);
|
||||||
|
SWAP_COLOR_ARGB(lineColor);
|
||||||
|
SWAP_COLOR_ARGB(centerLineColor);
|
||||||
|
break;
|
||||||
|
case GUI_TEXFORMAT_BGRA32:
|
||||||
|
SWAP_COLOR_BGRA(bgColor);
|
||||||
|
SWAP_COLOR_BGRA(bgColorLoop);
|
||||||
|
SWAP_COLOR_BGRA(lineColor);
|
||||||
|
SWAP_COLOR_BGRA(centerLineColor);
|
||||||
|
break;
|
||||||
|
case GUI_TEXFORMAT_RGBA32:
|
||||||
|
SWAP_COLOR_RGBA(bgColor);
|
||||||
|
SWAP_COLOR_RGBA(bgColorLoop);
|
||||||
|
SWAP_COLOR_RGBA(lineColor);
|
||||||
|
SWAP_COLOR_RGBA(centerLineColor);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int ij=0;
|
int ij=0;
|
||||||
for (int i=0; i<availY; i++) {
|
for (int i=0; i<availY; i++) {
|
||||||
for (int j=0; j<availX; j++) {
|
for (int j=0; j<availX; j++) {
|
||||||
|
|
Loading…
Reference in a new issue