summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorConnor McLaughlin <stenzek@gmail.com>2019-04-28 20:37:25 +1000
committerGitHub <noreply@github.com>2019-04-28 20:37:25 +1000
commitd2d8d7ce90f92bb45e2d8b645ec72f104fee5e6b (patch)
tree5ea75bfb66302aa45876b4be1e4b1e3712506900 /Source
parente17bb8cfdf9d802ff3fff455f88508700d1a87cc (diff)
parentced2306fc5afdde8c3551ac3257c6298d39d2e37 (diff)
Merge pull request #8051 from JosJuice/efb-constexpr
Turn EFB_WIDTH/EFB_HEIGHT into constexpr
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/VideoBackends/Software/EfbInterface.cpp5
-rw-r--r--Source/Core/VideoCommon/VideoCommon.h11
2 files changed, 7 insertions, 9 deletions
diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/EfbInterface.cpp
index 8eebb375d3..9548dece5a 100644
--- a/Source/Core/VideoBackends/Software/EfbInterface.cpp
+++ b/Source/Core/VideoBackends/Software/EfbInterface.cpp
@@ -588,8 +588,9 @@ void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const MathUtil::Rectangle<int>
//
// In our implementation, the garbage just so happens to be the top or bottom row.
// Statistically, that could happen.
- u16 y_prev = static_cast<u16>(std::max(clamp_top ? source_rect.top : 0, y - 1));
- u16 y_next = static_cast<u16>(std::min(clamp_bottom ? source_rect.bottom : EFB_HEIGHT, y + 1));
+ const u16 y_prev = static_cast<u16>(std::max(clamp_top ? source_rect.top : 0, y - 1));
+ const u16 y_next =
+ static_cast<u16>(std::min<int>(clamp_bottom ? source_rect.bottom : EFB_HEIGHT, y + 1));
// Get a scanline of YUV pixels in 4:4:4 format
for (int i = 1, x = left; x < right; i++, x++)
diff --git a/Source/Core/VideoCommon/VideoCommon.h b/Source/Core/VideoCommon/VideoCommon.h
index e727edd0b0..21aa5236a9 100644
--- a/Source/Core/VideoCommon/VideoCommon.h
+++ b/Source/Core/VideoCommon/VideoCommon.h
@@ -10,21 +10,18 @@
extern bool g_bRecordFifoData;
// These are accurate (disregarding AA modes).
-enum
-{
- EFB_WIDTH = 640,
- EFB_HEIGHT = 528,
-};
+constexpr u32 EFB_WIDTH = 640;
+constexpr u32 EFB_HEIGHT = 528;
// Max XFB width is 720. You can only copy out 640 wide areas of efb to XFB
// so you need multiple copies to do the full width.
// The VI can do horizontal scaling (TODO: emulate).
-const u32 MAX_XFB_WIDTH = 720;
+constexpr u32 MAX_XFB_WIDTH = 720;
// Although EFB height is 528, 576-line XFB's can be created either with
// vertical scaling by the EFB copy operation or copying to multiple XFB's
// that are next to each other in memory (TODO: handle that situation).
-const u32 MAX_XFB_HEIGHT = 576;
+constexpr u32 MAX_XFB_HEIGHT = 576;
#ifdef _WIN32
#define PRIM_LOG(...) DEBUG_LOG(VIDEO, __VA_ARGS__)