1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Refactoring of CPicture class to improve encapsulation

This commit is contained in:
Ivan Savenko
2023-01-30 13:58:13 +02:00
parent 42df5626d9
commit e35a669eeb
14 changed files with 84 additions and 109 deletions

View File

@ -415,7 +415,7 @@ CGStatusBar::CGStatusBar(int x, int y, std::string name, int maxw)
{
//execution of this block when maxw is incorrect breaks text centralization (issue #3151)
vstd::amin(pos.w, maxw);
background->srcRect = new Rect(0, 0, maxw, pos.h);
background->srcRect = Rect(0, 0, maxw, pos.h);
}
autoRedraw = false;
}
@ -502,12 +502,7 @@ CTextInput::CTextInput(const Rect & Pos, SDL_Surface * srf)
pos += Pos.topLeft();
captureAllKeys = true;
OBJ_CONSTRUCTION;
background = std::make_shared<CPicture>(Pos, 0, true);
Rect hlp = Pos;
if(srf)
CSDL_Ext::blitSurface(srf, hlp, background->getSurface(), Point(0,0));
else
SDL_FillRect(background->getSurface(), nullptr, 0);
background = std::make_shared<CPicture>(srf, Pos);
pos.w = background->pos.w;
pos.h = background->pos.h;
background->pos = pos;