From c85e0a2586029f1093539c68d84f7c2599d3a75e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 3 Feb 2017 12:31:20 -0500 Subject: 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. --- Source/Core/VideoBackends/OGL/FramebufferManager.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoBackends/OGL/FramebufferManager.cpp') diff --git a/Source/Core/VideoBackends/OGL/FramebufferManager.cpp b/Source/Core/VideoBackends/OGL/FramebufferManager.cpp index ef85560875..45a4b196a0 100644 --- a/Source/Core/VideoBackends/OGL/FramebufferManager.cpp +++ b/Source/Core/VideoBackends/OGL/FramebufferManager.cpp @@ -668,10 +668,9 @@ std::unique_ptr FramebufferManager::CreateXFBSource(unsigned int return std::make_unique(texture, layers); } -void FramebufferManager::GetTargetSize(unsigned int* width, unsigned int* height) +std::pair FramebufferManager::GetTargetSize() const { - *width = m_targetWidth; - *height = m_targetHeight; + return std::make_pair(m_targetWidth, m_targetHeight); } void FramebufferManager::PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points) -- cgit v1.2.3