1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

fix xbrz shadow

This commit is contained in:
Laserlicht 2024-09-17 23:58:56 +02:00
parent 110def5a1e
commit c884566c4f

View File

@ -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);