From 212f1eaecc51ca4a112d0e1e22b4a02faec838f3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 1 Dec 2012 18:41:00 +0300 Subject: Add batch drawing to tab. --- src/gui/widgets/tab.cpp | 28 ++++++++++++++++++---------- src/gui/widgets/tab.h | 4 ++-- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 6747b19e0..fdcace308 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -68,7 +68,7 @@ Tab::Tab(const Widget2 *const widget) : mTabSelectedColor(&getThemeColor(Theme::TAB_SELECTED)), mFlashColor(&getThemeColor(Theme::TAB_FLASH)), mPlayerFlashColor(&getThemeColor(Theme::TAB_PLAYER_FLASH)), - mVertexes(new GraphicsVertexes()), + mVertexes(new ImageCollection), mRedraw(true), mMode(0) { @@ -192,18 +192,26 @@ void Tab::draw(gcn::Graphics *graphics) updateAlpha(); - ImageRect &rect = skin->getBorder(); // draw tab - if (mRedraw || mode != mMode - || static_cast(graphics)->getRedraw()) + if (openGLMode != 2) { - mMode = mode; - mRedraw = false; - static_cast(graphics)->calcWindow(mVertexes, 0, 0, - getWidth(), getHeight(), rect); - } + ImageRect &rect = skin->getBorder(); + if (mRedraw || mode != mMode + || static_cast(graphics)->getRedraw()) + { + mMode = mode; + mRedraw = false; + static_cast(graphics)->calcWindow(mVertexes, 0, 0, + getWidth(), getHeight(), rect); + } - static_cast(graphics)->drawImageRect2(mVertexes, rect); + static_cast(graphics)->drawTile(mVertexes); + } + else + { + static_cast(graphics)-> + drawImageRect(0, 0, getWidth(), getHeight(), skin->getBorder()); + } // static_cast(graphics)-> // drawImageRect(0, 0, getWidth(), getHeight(), tabImg[mode]); diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h index 3589b2905..17237edd7 100644 --- a/src/gui/widgets/tab.h +++ b/src/gui/widgets/tab.h @@ -31,7 +31,7 @@ #include "localconsts.h" -class GraphicsVertexes; +class ImageCollection; class ImageRect; class Label; class Skin; @@ -151,7 +151,7 @@ class Tab : public gcn::BasicContainer, const gcn::Color *mFlashColor; const gcn::Color *mPlayerFlashColor; int mFlash; - GraphicsVertexes *mVertexes; + ImageCollection *mVertexes; bool mRedraw; int mMode; }; -- cgit v1.2.3-60-g2f50