From 2b681b167c1d307f550a8dc7b56a94d13886827e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 May 2015 22:07:05 +0300 Subject: Add method safeDrawFrame for safe OpenGL renderer. --- src/gui/widgets/playerbox.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/gui/widgets/playerbox.cpp') diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 09ebe610d..e69d3e35b 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -160,6 +160,23 @@ void PlayerBox::drawFrame(Graphics *graphics) BLOCK_END("PlayerBox::drawFrame") } +void PlayerBox::safeDrawFrame(Graphics *graphics) +{ + BLOCK_START("PlayerBox::drawFrame") + if (mDrawBackground) + { + const int bs = mFrameSize * 2; + const int w = mDimension.width + bs; + const int h = mDimension.height + bs; + + if (!mSelected) + graphics->drawImageRect(0, 0, w, h, mBackground); + else + graphics->drawImageRect(0, 0, w, h, mSelectedBackground); + } + BLOCK_END("PlayerBox::drawFrame") +} + void PlayerBox::mouseReleased(MouseEvent& event) { if (event.getButton() == MouseButton::LEFT) -- cgit v1.2.3-60-g2f50