diff options
| author | Dr. Dystopia <jonis9898@hotmail.com> | 2026-07-31 23:16:34 +0200 |
|---|---|---|
| committer | Dr. Dystopia <jonis9898@hotmail.com> | 2026-08-16 10:28:21 +0200 |
| commit | eb956a158c76a0b7ebf19423d31ac91a31dc394e (patch) | |
| tree | 2ef18e6c3e558b3bb58c98404789df322e2a3afa /Source/Core/VideoCommon/TextureDecoder_Generic.cpp | |
| parent | 54070da5851e12f2d1a4389daa528e4fb81327ce (diff) | |
Replace manual calculations with std::lerp and std::midpoint
Diffstat (limited to 'Source/Core/VideoCommon/TextureDecoder_Generic.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureDecoder_Generic.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp index 835ddb523e..04dd0456b2 100644 --- a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp @@ -5,6 +5,7 @@ #include <algorithm> #include <cmath> +#include <numeric> #include "Common/CPUDetect.h" #include "Common/CommonTypes.h" @@ -151,8 +152,10 @@ static void DecodeDXTBlock(u32* dst, const DXTBlock* src, int pitch) { // color[3] is the same as color[2] (average of both colors), but transparent. // This differs from DXT1 where color[3] is transparent black. - colors[2] = MakeRGBA((red1 + red2) / 2, (green1 + green2) / 2, (blue1 + blue2) / 2, 255); - colors[3] = MakeRGBA((red1 + red2) / 2, (green1 + green2) / 2, (blue1 + blue2) / 2, 0); + colors[2] = MakeRGBA(std::midpoint(red1, red2), std::midpoint(green1, green2), + std::midpoint(blue1, blue2), 255); + colors[3] = MakeRGBA(std::midpoint(red1, red2), std::midpoint(green1, green2), + std::midpoint(blue1, blue2), 0); } for (int y = 0; y < 4; y++) |
