diff options
| author | 2021-10-12 00:35:01 -0400 | |
|---|---|---|
| committer | 2021-11-16 22:11:31 +0100 | |
| commit | abd07e41582b6d8f7efdedb936cdd7a7fddf9912 (patch) | |
| tree | 4b1b3c2a676abc935517b669566068270029b6d3 /src/common | |
| parent | texture_cache: Fix image resolves when src/dst are not both scaled (diff) | |
| download | yuzu-abd07e41582b6d8f7efdedb936cdd7a7fddf9912.tar.gz yuzu-abd07e41582b6d8f7efdedb936cdd7a7fddf9912.tar.xz yuzu-abd07e41582b6d8f7efdedb936cdd7a7fddf9912.zip | |
video_core: Refactor resolution scale function
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/settings.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index f629c7c56..09f7cdd84 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -72,6 +72,20 @@ struct ResolutionScalingInfo { | |||
| 72 | f32 up_factor{1.0f}; | 72 | f32 up_factor{1.0f}; |
| 73 | f32 down_factor{1.0f}; | 73 | f32 down_factor{1.0f}; |
| 74 | bool active{}; | 74 | bool active{}; |
| 75 | |||
| 76 | s32 ScaleUp(s32 value) const { | ||
| 77 | if (value == 0) { | ||
| 78 | return 0; | ||
| 79 | } | ||
| 80 | return std::max((value * static_cast<s32>(up_scale)) >> static_cast<s32>(down_shift), 1); | ||
| 81 | } | ||
| 82 | |||
| 83 | u32 ScaleUp(u32 value) const { | ||
| 84 | if (value == 0U) { | ||
| 85 | return 0U; | ||
| 86 | } | ||
| 87 | return std::max((value * up_scale) >> down_shift, 1U); | ||
| 88 | } | ||
| 75 | }; | 89 | }; |
| 76 | 90 | ||
| 77 | /** The BasicSetting class is a simple resource manager. It defines a label and default value | 91 | /** The BasicSetting class is a simple resource manager. It defines a label and default value |