浏览代码

Fix transparency checks that were broken for palette images with alpha

Ivan Savenko 2 年之前
父节点
当前提交
b5925995b1
共有 1 个文件被更改,包括 4 次插入7 次删除
  1. 4 7
      client/gui/SDL_Extensions.cpp

+ 4 - 7
client/gui/SDL_Extensions.cpp

@@ -526,13 +526,10 @@ bool CSDL_Ext::isTransparent( SDL_Surface * srf, int x, int y )
 
 	SDL_GetRGBA(SDL_GetPixel(srf, x, y), srf->format, &color.r, &color.g, &color.b, &color.a);
 
-	// color is considered transparent here if
-	// a) image has aplha: less than 50% transparency
-	// b) no alpha: color is cyan
-	if (srf->format->Amask)
-		return color.a < 128; // almost transparent
-	else
-		return (color.r == 0 && color.g == 255 && color.b == 255);
+	bool pixelTransparent = color.a < 128;
+	bool pixelCyan = (color.r == 0 && color.g == 255 && color.b == 255);
+
+	return pixelTransparent || pixelCyan;
 }
 
 void CSDL_Ext::VflipSurf(SDL_Surface * surf)