summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/RenderBase.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2017-02-03 12:31:20 -0500
committerLioncash <mathew1800@gmail.com>2017-02-03 15:27:53 -0500
commitc85e0a2586029f1093539c68d84f7c2599d3a75e (patch)
tree7091059e46867ba61b80c03d55b8e6d8488b7e9f /Source/Core/VideoCommon/RenderBase.cpp
parent28357f16e2b3e767b4b2e489f5e29da4c43a6f4d (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/VideoCommon/RenderBase.cpp')
-rw-r--r--Source/Core/VideoCommon/RenderBase.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp
index 77b57c2f48..f47288ea4e 100644
--- a/Source/Core/VideoCommon/RenderBase.cpp
+++ b/Source/Core/VideoCommon/RenderBase.cpp
@@ -12,11 +12,14 @@
// Next frame, that one is scanned out and the other one gets the copy. = double buffering.
// ---------------------------------------------------------------------------------------------
+#include "VideoCommon/RenderBase.h"
+
#include <cinttypes>
#include <cmath>
#include <memory>
#include <mutex>
#include <string>
+#include <tuple>
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
@@ -48,7 +51,6 @@
#include "VideoCommon/ImageWrite.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/PostProcessing.h"
-#include "VideoCommon/RenderBase.h"
#include "VideoCommon/Statistics.h"
#include "VideoCommon/TextureCacheBase.h"
#include "VideoCommon/TextureDecoder.h"
@@ -509,8 +511,8 @@ TargetRectangle Renderer::CalculateFrameDumpDrawRectangle()
}
// Grab the dimensions of the EFB textures, we scale either of these depending on the ratio.
- unsigned int efb_width, efb_height;
- g_framebuffer_manager->GetTargetSize(&efb_width, &efb_height);
+ u32 efb_width, efb_height;
+ std::tie(efb_width, efb_height) = g_framebuffer_manager->GetTargetSize();
float draw_width, draw_height;
std::tie(draw_width, draw_height) = ScaleToDisplayAspectRatio(efb_width, efb_height);