From ca77e0ed33845eebc9dcd9d68a1be3b2bf4afaf1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 1 Dec 2012 18:31:21 +0300 Subject: Add batch drawing to progressbar. --- src/gui/widgets/progressbar.cpp | 22 +++++++++++++++------- src/gui/widgets/progressbar.h | 4 ++-- 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index ef3aa19a0..babf3f0e2 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -50,7 +50,7 @@ ProgressBar::ProgressBar(const Widget2 *const widget, float progress, mSmoothProgress(true), mProgressPalette(color), mSmoothColorChange(true), - mVertexes(new GraphicsVertexes()), + mVertexes(new ImageCollection), mRedraw(true), mPadding(2), mFillPadding(3) @@ -185,14 +185,22 @@ void ProgressBar::render(Graphics *graphics) gcn::Font *const oldFont = graphics->getFont(); const gcn::Color oldColor = graphics->getColor(); - if (mRedraw || graphics->getRedraw()) + if (openGLMode != 2) { - mRedraw = false; - graphics->calcWindow(mVertexes, 0, 0, - mDimension.width, mDimension.height, mSkin->getBorder()); - } + if (mRedraw || graphics->getRedraw()) + { + mRedraw = false; + graphics->calcWindow(mVertexes, 0, 0, + mDimension.width, mDimension.height, mSkin->getBorder()); + } - graphics->drawImageRect2(mVertexes, mSkin->getBorder()); + graphics->drawTile(mVertexes); + } + else + { + graphics->drawImageRect(0, 0, mDimension.width, mDimension.height, + mSkin->getBorder()); + } // The bar if (mProgress > 0) diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index 599292da5..fe03ac7e1 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -33,7 +33,7 @@ #include "localconsts.h" class Graphics; -class GraphicsVertexes; +class ImageCollection; class ImageRect; class Skin; @@ -149,7 +149,7 @@ class ProgressBar final : public gcn::Widget, bool mSmoothColorChange; std::string mText; - GraphicsVertexes *mVertexes; + ImageCollection *mVertexes; bool mRedraw; unsigned int mPadding; unsigned int mFillPadding; -- cgit v1.2.3-60-g2f50