fix possible crash when texture size is 0
This commit is contained in:
parent
8cfd37b6f5
commit
4247faa97c
|
@ -27,6 +27,8 @@ void FurnaceGUI::drawImage(ImDrawList* dl, FurnaceGUIImages image, const ImVec2&
|
|||
FurnaceGUIImage* imgI=getImage(image);
|
||||
FurnaceGUITexture* img=getTexture(image);
|
||||
|
||||
if (img==NULL) return;
|
||||
|
||||
float squareSize=MAX(introMax.x-introMin.x,introMax.y-introMin.y);
|
||||
float uDiff=uvMax.x-uvMin.x;
|
||||
float vDiff=uvMax.y-uvMin.y;
|
||||
|
|
|
@ -50,11 +50,15 @@ ImTextureID FurnaceGUIRenderDX9::getTextureID(FurnaceGUITexture* which) {
|
|||
|
||||
float FurnaceGUIRenderDX9::getTextureU(FurnaceGUITexture* which) {
|
||||
FurnaceDX9Texture* t=(FurnaceDX9Texture*)which;
|
||||
if (which==NULL) return 0.0;
|
||||
if (t->widthReal<1) return 0.0f;
|
||||
return (float)t->width/(float)t->widthReal;
|
||||
}
|
||||
|
||||
float FurnaceGUIRenderDX9::getTextureV(FurnaceGUITexture* which) {
|
||||
FurnaceDX9Texture* t=(FurnaceDX9Texture*)which;
|
||||
if (which==NULL) return 0.0;
|
||||
if (t->heightReal<1) return 0.0f;
|
||||
return (float)t->height/(float)t->heightReal;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,11 +46,13 @@ ImTextureID FurnaceGUIRenderGL1::getTextureID(FurnaceGUITexture* which) {
|
|||
|
||||
float FurnaceGUIRenderGL1::getTextureU(FurnaceGUITexture* which) {
|
||||
FurnaceGL1Texture* t=(FurnaceGL1Texture*)which;
|
||||
if (t->widthReal<1) return 0.0f;
|
||||
return (float)t->width/(float)t->widthReal;
|
||||
}
|
||||
|
||||
float FurnaceGUIRenderGL1::getTextureV(FurnaceGUITexture* which) {
|
||||
FurnaceGL1Texture* t=(FurnaceGL1Texture*)which;
|
||||
if (t->heightReal<1) return 0.0f;
|
||||
return (float)t->height/(float)t->heightReal;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue