summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-21 06:09:30 +0300
committerAndrei Karas <akaras@inbox.ru>2011-04-21 06:09:30 +0300
commit005d429599088b523e4f62326824c7fb51ba9c63 (patch)
treedccce15cf132bae28c85be897d5f7cc33299ea17 /src
parent8037d33c9f429d4c0322da383cdda46776c3c14e (diff)
downloadManaVerse-005d429599088b523e4f62326824c7fb51ba9c63.tar.gz
ManaVerse-005d429599088b523e4f62326824c7fb51ba9c63.tar.bz2
ManaVerse-005d429599088b523e4f62326824c7fb51ba9c63.tar.xz
ManaVerse-005d429599088b523e4f62326824c7fb51ba9c63.zip
Fix draw issue in SDL after vertex precalculation.
Diffstat (limited to 'src')
-rw-r--r--src/graphics.h7
-rw-r--r--src/gui/widgets/button.cpp4
-rw-r--r--src/gui/widgets/progressbar.cpp2
-rw-r--r--src/gui/widgets/scrollarea.cpp4
-rw-r--r--src/gui/widgets/tab.cpp3
-rw-r--r--src/gui/widgets/window.cpp13
6 files changed, 30 insertions, 3 deletions
diff --git a/src/graphics.h b/src/graphics.h
index a331c21ba..423279fb0 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -255,6 +255,12 @@ class Graphics : public gcn::SDLGraphics
gcn::ClipRectangle &getTopClip()
{ return mClipStack.top(); }
+ void setRedraw(bool n)
+ { mRedraw = n; }
+
+ bool getRedraw()
+ { return mRedraw; }
+
protected:
int SDL_FakeUpperBlit (SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect);
@@ -265,6 +271,7 @@ class Graphics : public gcn::SDLGraphics
bool mFullscreen;
bool mHWAccel;
BlitMode mBlitMode;
+ bool mRedraw;
};
extern Graphics *graphics;
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 91d297846..c0f174b2c 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -210,6 +210,10 @@ void Button::draw(gcn::Graphics *graphics)
recalc = true;
mMode = mode;
}
+ else if (static_cast<Graphics*>(graphics)->getRedraw())
+ {
+ recalc = true;
+ }
}
if (recalc)
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 0916d9976..bbde65207 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -204,7 +204,7 @@ void ProgressBar::render(Graphics *graphics, const gcn::Rectangle &area,
gcn::Font *oldFont = graphics->getFont();
gcn::Color oldColor = graphics->getColor();
- if (*redraw)
+ if (*redraw || graphics->getRedraw())
{
*redraw = false;
static_cast<Graphics*>(graphics)->calcWindow(vert,
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 0be492ee6..59e323e94 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -350,6 +350,10 @@ void ScrollArea::drawFrame(gcn::Graphics *graphics)
mDrawWidth = rect.width;
mDrawHeight = rect.height;
}
+ else if (static_cast<Graphics*>(graphics)->getRedraw())
+ {
+ recalc = true;
+ }
}
if (recalc)
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index 73ffff30e..5e4a147c0 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -190,7 +190,8 @@ void Tab::draw(gcn::Graphics *graphics)
updateAlpha();
// draw tab
- if (mRedraw || mode != mMode)
+ if (mRedraw || mode != mMode
+ || static_cast<Graphics*>(graphics)->getRedraw())
{
mMode = mode;
mRedraw = false;
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 72530db8f..df8599b95 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -131,10 +131,12 @@ void Window::draw(gcn::Graphics *graphics)
return;
Graphics *g = static_cast<Graphics*>(graphics);
+ bool update = false;
if (mRedraw)
{
mRedraw = false;
+ update = true;
g->calcWindow(mVertexes, 0, 0, getWidth(),
getHeight(), mSkin->getBorder());
}
@@ -176,7 +178,16 @@ void Window::draw(gcn::Graphics *graphics)
}
}
- drawChildren(graphics);
+ if (update)
+ {
+ g->setRedraw(update);
+ drawChildren(graphics);
+ g->setRedraw(false);
+ }
+ else
+ {
+ drawChildren(graphics);
+ }
}
void Window::setContentSize(int width, int height)