Merge pull request #150 from jrassa/render-overflow-fixes

use clip rects to prevent views overflow onto other views
This commit is contained in:
Jools Wills 2017-05-31 16:50:10 +01:00 committed by GitHub
commit e28e679e2d
3 changed files with 12 additions and 0 deletions

View file

@ -455,6 +455,7 @@ void SystemView::renderExtras(const Eigen::Affine3f& trans, float lower, float u
else else
extrasTrans.translate(Eigen::Vector3f(0, (i - mExtrasCamOffset) * mSize.y(), 0)); extrasTrans.translate(Eigen::Vector3f(0, (i - mExtrasCamOffset) * mSize.y(), 0));
Renderer::pushClipRect(Eigen::Vector2i(extrasTrans.translation()[0], extrasTrans.translation()[1]), mSize.cast<int>());
SystemViewData data = mEntries.at(index).data; SystemViewData data = mEntries.at(index).data;
for(unsigned int j = 0; j < data.backgroundExtras.size(); j++) for(unsigned int j = 0; j < data.backgroundExtras.size(); j++)
{ {
@ -463,6 +464,7 @@ void SystemView::renderExtras(const Eigen::Affine3f& trans, float lower, float u
extra->render(extrasTrans); extra->render(extrasTrans);
} }
} }
Renderer::popClipRect();
} }
Renderer::popClipRect(); Renderer::popClipRect();
} }

View file

@ -41,3 +41,11 @@ HelpStyle IGameListView::getHelpStyle()
style.applyTheme(mTheme, getName()); style.applyTheme(mTheme, getName());
return style; return style;
} }
void IGameListView::render(const Eigen::Affine3f& parentTrans)
{
Eigen::Affine3f trans = parentTrans * getTransform();
Renderer::pushClipRect(Eigen::Vector2i(trans.translation()[0],trans.translation()[1]), Eigen::Vector2i(Renderer::getScreenWidth(), Renderer::getScreenHeight()));
renderChildren(trans);
Renderer::popClipRect();
}

View file

@ -37,6 +37,8 @@ public:
virtual const char* getName() const = 0; virtual const char* getName() const = 0;
virtual HelpStyle getHelpStyle() override; virtual HelpStyle getHelpStyle() override;
void render(const Eigen::Affine3f& parentTrans) override;
protected: protected:
FileData* mRoot; FileData* mRoot;
std::shared_ptr<ThemeData> mTheme; std::shared_ptr<ThemeData> mTheme;