Browse Source

fix xbrz shadow

Laserlicht 1 year ago
parent
commit
c884566c4f
1 changed files with 7 additions and 5 deletions
  1. 7 5
      client/windows/CWindowObject.cpp

+ 7 - 5
client/windows/CWindowObject.cpp

@@ -20,6 +20,7 @@
 #include "../windows/CMessage.h"
 #include "../renderSDL/SDL_PixelAccess.h"
 #include "../render/IImage.h"
+#include "../render/IScreenHandler.h"
 #include "../render/IRenderHandler.h"
 #include "../render/Canvas.h"
 
@@ -115,7 +116,8 @@ void CWindowObject::updateShadow()
 void CWindowObject::setShadow(bool on)
 {
 	//size of shadow
-	static const int size = 8;
+	int sizeOriginal = 8;
+	int size = sizeOriginal * GH.screenHandler().getScalingFactor();
 
 	if(on == !shadowParts.empty())
 		return;
@@ -180,9 +182,9 @@ void CWindowObject::setShadow(bool on)
 		//FIXME: do something with this points
 		Point shadowStart;
 		if (options & BORDERED)
-			shadowStart = Point(size - 14, size - 14);
+			shadowStart = Point(sizeOriginal - 14, sizeOriginal - 14);
 		else
-			shadowStart = Point(size, size);
+			shadowStart = Point(sizeOriginal, sizeOriginal);
 
 		Point shadowPos;
 		if (options & BORDERED)
@@ -198,8 +200,8 @@ void CWindowObject::setShadow(bool on)
 
 		//create base 8x8 piece of shadow
 		SDL_Surface * shadowCorner = CSDL_Ext::copySurface(shadowCornerTempl);
-		SDL_Surface * shadowBottom = CSDL_Ext::scaleSurface(shadowBottomTempl, fullsize.x - size, size);
-		SDL_Surface * shadowRight  = CSDL_Ext::scaleSurface(shadowRightTempl,  size, fullsize.y - size);
+		SDL_Surface * shadowBottom = CSDL_Ext::scaleSurface(shadowBottomTempl, (fullsize.x - sizeOriginal) * GH.screenHandler().getScalingFactor(), size);
+		SDL_Surface * shadowRight  = CSDL_Ext::scaleSurface(shadowRightTempl,  size, (fullsize.y - sizeOriginal) * GH.screenHandler().getScalingFactor());
 
 		blitAlphaCol(shadowBottom, 0);
 		blitAlphaRow(shadowRight, 0);