mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-09 15:26:00 +01:00
normalize gradients and denormalize in groupbar
This commit is contained in:
parent
228e630f40
commit
ddcae74e09
2 changed files with 5 additions and 5 deletions
|
@ -2,8 +2,7 @@
|
|||
#include "../defines.hpp"
|
||||
#include <vector>
|
||||
|
||||
enum eConfigValueDataTypes
|
||||
{
|
||||
enum eConfigValueDataTypes {
|
||||
CVD_TYPE_INVALID = -1,
|
||||
CVD_TYPE_GRADIENT = 0
|
||||
};
|
||||
|
@ -18,7 +17,7 @@ interface ICustomConfigValueData {
|
|||
class CGradientValueData : public ICustomConfigValueData {
|
||||
public:
|
||||
CGradientValueData(CColor col) {
|
||||
m_vColors.push_back(col);
|
||||
m_vColors.push_back(col * (1.f / 255.f));
|
||||
};
|
||||
virtual ~CGradientValueData(){};
|
||||
|
||||
|
@ -28,7 +27,7 @@ class CGradientValueData : public ICustomConfigValueData {
|
|||
|
||||
void reset(CColor col) {
|
||||
m_vColors.clear();
|
||||
m_vColors.emplace_back(col);
|
||||
m_vColors.emplace_back(col * (1.f / 255.f));
|
||||
m_fAngle = 0;
|
||||
}
|
||||
|
||||
|
@ -39,7 +38,7 @@ class CGradientValueData : public ICustomConfigValueData {
|
|||
float m_fAngle = 0;
|
||||
|
||||
bool operator==(const CGradientValueData& other) {
|
||||
if (other.m_vColors.size() != m_vColors.size() || m_fAngle != other.m_fAngle)
|
||||
if (other.m_vColors.size() != m_vColors.size() || m_fAngle != other.m_fAngle)
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < m_vColors.size(); ++i)
|
||||
|
|
|
@ -92,6 +92,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
|
|||
CColor color = m_dwGroupMembers[i] == g_pCompositor->m_pLastWindow ? ((CGradientValueData*)PGROUPCOLACTIVE->get())->m_vColors[0] :
|
||||
((CGradientValueData*)PGROUPCOLINACTIVE->get())->m_vColors[0];
|
||||
color.a *= a;
|
||||
color = color * 255.f; // gradient has 0 - 1
|
||||
g_pHyprOpenGL->renderRect(&rect, color);
|
||||
|
||||
xoff += PAD + BARW;
|
||||
|
|
Loading…
Reference in a new issue