From be74509b31b26e714c6b380e17ed3935ec0b6cf0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 12 Jun 2014 23:23:00 +0300 Subject: In modernopengl add support for buffered draw tile collection. This is first cached function implemented in modernopengl. Also add support for bind buffer attributes. Add finalize method to convert any cached data into data for GPU. --- src/gui/widgets/avatarlistbox.cpp | 1 + src/gui/widgets/button.cpp | 1 + src/gui/widgets/emotepage.cpp | 1 + src/gui/widgets/popup.cpp | 3 ++- src/gui/widgets/progressbar.cpp | 1 + src/gui/widgets/scrollarea.cpp | 3 +++ src/gui/widgets/shortcutcontainer.cpp | 1 + src/gui/widgets/slider.cpp | 1 + src/gui/widgets/tabs/tab.cpp | 1 + src/gui/widgets/window.cpp | 1 + 10 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 9a7ed36dc..07115640b 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -139,6 +139,7 @@ void AvatarListBox::draw(Graphics *graphics) { graphics->calcTileCollection(&vertexes, icon, mImagePadding, y + mPadding); + graphics->finalize(&vertexes); } else { diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 54d15391b..de2bd0c8b 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -586,6 +586,7 @@ void Button::draw(Graphics *graphics) imageX, imageY); } } + graphics->finalize(mVertexes2); } graphics->drawTileCollection(mVertexes2); } diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index 68d508a5a..2c20cf438 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -92,6 +92,7 @@ void EmotePage::draw(Graphics *graphics) } } } + graphics->finalize(mVertexes); } graphics->drawTileCollection(mVertexes); } diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index ff6296d75..506b0f050 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -106,7 +106,8 @@ void Popup::draw(Graphics *graphics) mDimension.width, mDimension.height, mSkin->getBorder()); } - + // need cache or remove calc call. + graphics->finalize(mVertexes); graphics->drawTileCollection(mVertexes); } else diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 9a10eedb7..8368ce71b 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -226,6 +226,7 @@ void ProgressBar::render(Graphics *graphics) width, mDimension.height - pad, mFillRect); } } + graphics->finalize(mVertexes); } graphics->drawTileCollection(mVertexes); diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index fc7ae91d5..028c2e7b1 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -320,6 +320,7 @@ void ScrollArea::draw(Graphics *graphics) { if (!mOpaque) updateCalcFlag(graphics); + // need add caching or remove calc calls. // if (mRedraw) { mVertexes->clear(); @@ -344,6 +345,7 @@ void ScrollArea::draw(Graphics *graphics) calcHBar(graphics); calcHMarker(graphics); } + graphics->finalize(mVertexes); } graphics->drawTileCollection(mVertexes); } @@ -436,6 +438,7 @@ void ScrollArea::drawFrame(Graphics *graphics) 0, 0, w, h, background); + graphics->finalize(mVertexes2); } graphics->drawTileCollection(mVertexes2); } diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index 313e37262..eeca4dacd 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -134,6 +134,7 @@ void ShortcutContainer::drawBackground(Graphics *g) (i % mGridWidth) * mBoxWidth, (i / mGridWidth) * mBoxHeight); } + g->finalize(mVertexes); } g->drawTileCollection(mVertexes); } diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 6c2224150..e36c24b2c 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -282,6 +282,7 @@ void Slider::draw(Graphics *graphics) (mDimension.height - img->getHeight()) / 2); } } + graphics->finalize(mVertexes); } graphics->drawTileCollection(mVertexes); } diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index 16018e5c3..465a901c9 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -278,6 +278,7 @@ void Tab::draw(Graphics *graphics) padding); } } + graphics->finalize(mVertexes); } graphics->drawTileCollection(mVertexes); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 74c6d1cfc..caf7dae91 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -313,6 +313,7 @@ void Window::draw(Graphics *graphics) mGripRect.x, mGripRect.y); } + graphics->finalize(mVertexes); } else { -- cgit v1.2.3-70-g09d2