mirror of https://github.com/PCSX2/pcsx2.git
GSdx GSDirtyRect: std::vector instead of std::list, to speedup linear scan. Improved const-ness. Using range loop.
This commit is contained in:
parent
f8e89b694a
commit
b431d172b7
|
@ -37,15 +37,15 @@ GSDirtyRect::GSDirtyRect(const GSVector4i& r, uint32 psm)
|
||||||
bottom = r.bottom;
|
bottom = r.bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
GSVector4i GSDirtyRect::GetDirtyRect(const GIFRegTEX0& TEX0)
|
const GSVector4i GSDirtyRect::GetDirtyRect(const GIFRegTEX0& TEX0) const
|
||||||
{
|
{
|
||||||
GSVector4i r;
|
GSVector4i r;
|
||||||
|
|
||||||
GSVector2i src = GSLocalMemory::m_psm[psm].bs;
|
const GSVector2i src = GSLocalMemory::m_psm[psm].bs;
|
||||||
|
|
||||||
if(psm != TEX0.PSM)
|
if(psm != TEX0.PSM)
|
||||||
{
|
{
|
||||||
GSVector2i dst = GSLocalMemory::m_psm[TEX0.PSM].bs;
|
const GSVector2i dst = GSLocalMemory::m_psm[TEX0.PSM].bs;
|
||||||
|
|
||||||
r.left = left * dst.x / src.x;
|
r.left = left * dst.x / src.x;
|
||||||
r.top = top * dst.y / src.y;
|
r.top = top * dst.y / src.y;
|
||||||
|
@ -62,20 +62,20 @@ GSVector4i GSDirtyRect::GetDirtyRect(const GIFRegTEX0& TEX0)
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
GSVector4i GSDirtyRectList::GetDirtyRectAndClear(const GIFRegTEX0& TEX0, const GSVector2i& size)
|
const GSVector4i GSDirtyRectList::GetDirtyRectAndClear(const GIFRegTEX0& TEX0, const GSVector2i& size)
|
||||||
{
|
{
|
||||||
if(!empty())
|
if(!empty())
|
||||||
{
|
{
|
||||||
GSVector4i r(INT_MAX, INT_MAX, 0, 0);
|
GSVector4i r(INT_MAX, INT_MAX, 0, 0);
|
||||||
|
|
||||||
for(list<GSDirtyRect>::iterator i = begin(); i != end(); ++i)
|
for(const auto& dirty_rect : *this)
|
||||||
{
|
{
|
||||||
r = r.runion(i->GetDirtyRect(TEX0));
|
r = r.runion(dirty_rect.GetDirtyRect(TEX0));
|
||||||
}
|
}
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
GSVector2i bs = GSLocalMemory::m_psm[TEX0.PSM].bs;
|
const GSVector2i bs = GSLocalMemory::m_psm[TEX0.PSM].bs;
|
||||||
|
|
||||||
return r.ralign<Align_Outside>(bs).rintersect(GSVector4i(0, 0, size.x, size.y));
|
return r.ralign<Align_Outside>(bs).rintersect(GSVector4i(0, 0, size.x, size.y));
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,12 +35,12 @@ class GSDirtyRect
|
||||||
public:
|
public:
|
||||||
GSDirtyRect();
|
GSDirtyRect();
|
||||||
GSDirtyRect(const GSVector4i& r, uint32 psm);
|
GSDirtyRect(const GSVector4i& r, uint32 psm);
|
||||||
GSVector4i GetDirtyRect(const GIFRegTEX0& TEX0);
|
const GSVector4i GetDirtyRect(const GIFRegTEX0& TEX0) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GSDirtyRectList : public list<GSDirtyRect>
|
class GSDirtyRectList : public std::vector<GSDirtyRect>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GSDirtyRectList() {}
|
GSDirtyRectList() {}
|
||||||
GSVector4i GetDirtyRectAndClear(const GIFRegTEX0& TEX0, const GSVector2i& size);
|
const GSVector4i GetDirtyRectAndClear(const GIFRegTEX0& TEX0, const GSVector2i& size);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue