diff options
| author | Lioncash <mathew1800@gmail.com> | 2017-02-03 12:31:20 -0500 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2017-02-03 15:27:53 -0500 |
| commit | c85e0a2586029f1093539c68d84f7c2599d3a75e (patch) | |
| tree | 7091059e46867ba61b80c03d55b8e6d8488b7e9f /Source/Core/VideoBackends/Null/FramebufferManager.h | |
| parent | 28357f16e2b3e767b4b2e489f5e29da4c43a6f4d (diff) | |
FramebufferManagerBase: Return a std::pair from GetTargetSize
Keeps associated data together. It also eliminates the possibility of out
parameters not being initialized properly. For example, consider the
following example:
-- some FramebufferManager implementation --
void FBMgrImpl::GetTargetSize(u32* width, u32* height) override
{
// Do nothing
}
-- somewhere else where the function is used --
u32 width, height;
framebuffer_manager_instance->GetTargetSize(&width, &height);
if (texture_width != width) <-- Uninitialized variable usage
{
...
}
It makes it much more obvious to spot any initialization issues, because
it requires something to be returned, as opposed to allowing an
implementation to just not do anything.
Diffstat (limited to 'Source/Core/VideoBackends/Null/FramebufferManager.h')
| -rw-r--r-- | Source/Core/VideoBackends/Null/FramebufferManager.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/Core/VideoBackends/Null/FramebufferManager.h b/Source/Core/VideoBackends/Null/FramebufferManager.h index b591bf15fd..d68a4a7d1f 100644 --- a/Source/Core/VideoBackends/Null/FramebufferManager.h +++ b/Source/Core/VideoBackends/Null/FramebufferManager.h @@ -4,6 +4,9 @@ #pragma once +#include <utility> + +#include "Common/CommonTypes.h" #include "VideoCommon/FramebufferManagerBase.h" class XFBSource : public XFBSourceBase @@ -23,7 +26,7 @@ public: return std::make_unique<XFBSource>(); } - void GetTargetSize(unsigned int* width, unsigned int* height) override {} + std::pair<u32, u32> GetTargetSize() const override { return std::make_pair(0, 0); } void CopyToRealXFB(u32 xfb_addr, u32 fb_stride, u32 fb_height, const EFBRectangle& source_rc, float gamma = 1.0f) override { |
