Skip to content

Commit

Permalink
Texture Utilities: use updated sRGB<->Linear conversion functions
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Sep 18, 2023
1 parent 81a05f1 commit 9c43425
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions TextureLoader/src/TextureUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ void PremultiplyAlphaImpl(const PremultiplyAlphaAttribs& Attribs)
[](auto& C, auto A) {
constexpr auto MaxValue = static_cast<float>(std::numeric_limits<Type>::max());

float Linear = FastSRGBToLinear(static_cast<float>(C) / MaxValue);
float Linear = FastGammaToLinear(static_cast<float>(C) / MaxValue);
Linear *= static_cast<float>(A) / MaxValue;
float Gamma = FastLinearToSRGB(Linear);
float Gamma = FastLinearToGamma(Linear);

C = static_cast<Type>(Gamma * MaxValue + 0.5f);
});
Expand Down Expand Up @@ -274,9 +274,9 @@ void PremultiplyAlphaImpl<float>(const PremultiplyAlphaAttribs& Attribs)
PremultiplyComponents<Type>(
Attribs,
[](auto& C, auto A) {
float Linear = FastSRGBToLinear(C);
float Linear = FastGammaToLinear(C);
Linear *= A;
C = FastLinearToSRGB(Linear);
C = FastLinearToGamma(Linear);
});
}
else
Expand Down

0 comments on commit 9c43425

Please sign in to comment.