Simplify code

This commit is contained in:
Wojtek Figat
2025-01-12 23:57:52 +01:00
parent f36d3a11ab
commit 7ac2376231

View File

@@ -1377,22 +1377,26 @@ void Render2D::DrawText(Font* font, const StringView& text, const TextRange& tex
FORCE_INLINE bool NeedAlphaWithTint(const Color& color) FORCE_INLINE bool NeedAlphaWithTint(const Color& color)
{ {
return (color.A * TintLayersStack.Peek().A) < 1.0f; const float tint = TintLayersStack.Peek().A;
return color.A * tint < 1.0f;
} }
FORCE_INLINE bool NeedAlphaWithTint(const Color& color1, const Color& color2) FORCE_INLINE bool NeedAlphaWithTint(const Color& color1, const Color& color2)
{ {
return (color1.A * TintLayersStack.Peek().A) < 1.0f || (color2.A * TintLayersStack.Peek().A) < 1.0f; const float tint = TintLayersStack.Peek().A;
return color1.A * tint < 1.0f || color2.A * tint < 1.0f;
} }
FORCE_INLINE bool NeedAlphaWithTint(const Color& color1, const Color& color2, const Color& color3) FORCE_INLINE bool NeedAlphaWithTint(const Color& color1, const Color& color2, const Color& color3)
{ {
return (color1.A * TintLayersStack.Peek().A) < 1.0f || (color2.A * TintLayersStack.Peek().A) < 1.0f || (color3.A * TintLayersStack.Peek().A) < 1.0f; const float tint = TintLayersStack.Peek().A;
return color1.A * tint < 1.0f || color2.A * tint < 1.0f || color3.A * tint < 1.0f;
} }
FORCE_INLINE bool NeedAlphaWithTint(const Color& color1, const Color& color2, const Color& color3, const Color& color4) FORCE_INLINE bool NeedAlphaWithTint(const Color& color1, const Color& color2, const Color& color3, const Color& color4)
{ {
return (color1.A * TintLayersStack.Peek().A) < 1.0f || (color2.A * TintLayersStack.Peek().A) < 1.0f || (color3.A * TintLayersStack.Peek().A) < 1.0f || (color4.A * TintLayersStack.Peek().A) < 1.0f; const float tint = TintLayersStack.Peek().A;
return color1.A * tint < 1.0f || color2.A * tint < 1.0f || color3.A * tint < 1.0f || color4.A * tint < 1.0f;
} }
void Render2D::FillRectangle(const Rectangle& rect, const Color& color) void Render2D::FillRectangle(const Rectangle& rect, const Color& color)