FramebufferManagerBase: Compress a loop into a find_if

This commit is contained in:
Lioncash 2015-09-01 16:54:40 -04:00
parent 0ba7a65f08
commit 401f765462

View File

@ -2,7 +2,7 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <algorithm>
#include "VideoCommon/FramebufferManagerBase.h" #include "VideoCommon/FramebufferManagerBase.h"
#include "VideoCommon/RenderBase.h" #include "VideoCommon/RenderBase.h"
#include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoConfig.h"
@ -182,17 +182,12 @@ FramebufferManagerBase::VirtualXFBListType::iterator FramebufferManagerBase::Fin
const u32 srcLower = xfbAddr; const u32 srcLower = xfbAddr;
const u32 srcUpper = xfbAddr + 2 * width * height; const u32 srcUpper = xfbAddr + 2 * width * height;
VirtualXFBListType::iterator it = m_virtualXFBList.begin(); return std::find_if(m_virtualXFBList.begin(), m_virtualXFBList.end(), [srcLower, srcUpper](const VirtualXFB& xfb) {
for (; it != m_virtualXFBList.end(); ++it) const u32 dstLower = xfb.xfbAddr;
{ const u32 dstUpper = xfb.xfbAddr + 2 * xfb.xfbWidth * xfb.xfbHeight;
const u32 dstLower = it->xfbAddr;
const u32 dstUpper = it->xfbAddr + 2 * it->xfbWidth * it->xfbHeight;
if (dstLower >= srcLower && dstUpper <= srcUpper) return dstLower >= srcLower && dstUpper <= srcUpper;
break; });
}
return it;
} }
void FramebufferManagerBase::ReplaceVirtualXFB() void FramebufferManagerBase::ReplaceVirtualXFB()