1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix usage of fillRect.

* proper fix for slider drawing
This commit is contained in:
AlexVinS 2014-07-05 01:46:55 +04:00
parent e70e68a56b
commit 0edd10078f
5 changed files with 9 additions and 15 deletions

View File

@ -4194,7 +4194,7 @@ CPrologEpilogVideo::CPrologEpilogVideo( CCampaignScenario::SScenarioPrologEpilog
void CPrologEpilogVideo::show( SDL_Surface * to )
{
CSDL_Ext::fillRect(to, &pos, 0); // fill screen with black
CSDL_Ext::fillRectBlack(to, &pos);
//BUG: some videos are 800x600 in size while some are 800x400
//VCMI should center them in the middle of the screen. Possible but needs modification
//of video player API which I'd like to avoid until we'll get rid of Windows-specific player

View File

@ -850,22 +850,10 @@ void CSlider::setAmount( int to )
void CSlider::showAll(SDL_Surface * to)
{
CSDL_Ext::fillRect(to, &pos, 0);
CSDL_Ext::fillRectBlack(to, &pos);
CIntObject::showAll(to);
}
void CSlider::show(SDL_Surface * to)
{
//todo: find better solution for background glitches.
#ifdef VCMI_SDL1
CIntObject::show(to);
#else
CSDL_Ext::fillRect(to, &pos, 0);
CIntObject::showAll(to);
#endif // VCMI_SDL1
}
void CSlider::wheelScrolled(bool down, bool in)
{
moveTo(value + 3 * (down ? +scrollStep : -scrollStep));

View File

@ -218,7 +218,6 @@ public:
void clickLeft(tribool down, bool previousState);
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
void showAll(SDL_Surface * to);
void show(SDL_Surface * to) override;
CSlider(int x, int y, int totalw, std::function<void(int)> Moved, int Capacity, int Amount,
int Value=0, bool Horizontal=true, int style = 0); //style 0 - brown, 1 - blue

View File

@ -955,6 +955,12 @@ void CSDL_Ext::fillRect( SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color )
SDL_FillRect(dst, &newRect, color);
}
void CSDL_Ext::fillRectBlack( SDL_Surface *dst, SDL_Rect *dstrect)
{
const Uint32 black = SDL_MapRGB(dst->format,0,0,0);
fillRect(dst,dstrect,black);
}
void CSDL_Ext::fillTexture(SDL_Surface *dst, SDL_Surface * src)
{
SDL_Rect srcRect;

View File

@ -208,6 +208,7 @@ namespace CSDL_Ext
void blitSurface(SDL_Surface * src, SDL_Rect * srcRect, SDL_Surface * dst, SDL_Rect * dstRect);
void fillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
void fillRectBlack(SDL_Surface * dst, SDL_Rect * dstrect);
//fill dest image with source texture.
void fillTexture(SDL_Surface *dst, SDL_Surface * sourceTexture);