From f3d3020c77e5b54601fe8fda9c61ab3d4e5cf1bd Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 13 Feb 2005 17:49:53 +0000 Subject: Lock the screen surface before modifying pixels directly. --- src/gui/progressbar.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/gui/progressbar.cpp') diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index e3766913..09e05932 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -44,6 +44,9 @@ void ProgressBar::draw(gcn::Graphics *graphics) { int absx, absy; getAbsolutePosition(absx, absy); + + // We're modifying pixels so we have to lock the screen. + SDL_LockSurface(screen); // outer bar DrawLine(screen, absx+X+PROGRESSBAR_HEIGHT, absy+Y, absx+X+Width, absy+Y, abs(Red-70), abs(Green-70), abs(Blue-70)); @@ -70,8 +73,9 @@ void ProgressBar::draw(gcn::Graphics *graphics) Temp = absx+X+int(float(Width)*progress)-2; if ( Temp < (absx+X+PROGRESSBAR_HEIGHT+1) ) Temp = absx+X+PROGRESSBAR_HEIGHT; DrawLine(screen, absx+X+PROGRESSBAR_HEIGHT+1, absy+Y+1, Temp, absy+Y+1, abs(Red-40), abs(Green-40), abs(Blue-40)); - DrawLine(screen, absx+X+PROGRESSBAR_HEIGHT, absy+Y+1, absx+X+2, absy+Y+PROGRESSBAR_HEIGHT-1, abs(Red-40), abs(Green-40), abs(Blue-40)); + DrawLine(screen, absx+X+PROGRESSBAR_HEIGHT, absy+Y+1, absx+X+2, absy+Y+PROGRESSBAR_HEIGHT-1, abs(Red-40), abs(Green-40), abs(Blue-40)); + SDL_UnlockSurface(screen); } void ProgressBar::setProgress(float progress) -- cgit v1.2.3-70-g09d2