mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-25 07:09:48 +01:00
gamma done
This commit is contained in:
parent
d7855b0349
commit
2efac3eb38
2 changed files with 19 additions and 1 deletions
|
@ -81,6 +81,24 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
|
||||||
|
|
||||||
gammaTableSet = true;
|
gammaTableSet = true;
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
|
// translate the table to AQ format
|
||||||
|
std::vector<uint16_t> red, green, blue;
|
||||||
|
red.resize(gammaTable.size() / 3);
|
||||||
|
green.resize(gammaTable.size() / 3);
|
||||||
|
blue.resize(gammaTable.size() / 3);
|
||||||
|
for (size_t i = 0; i < gammaTable.size() / 3; ++i) {
|
||||||
|
red.at(i) = gammaTable.at(i);
|
||||||
|
green.at(i) = gammaTable.at(gammaTable.size() / 3 + i);
|
||||||
|
blue.at(i) = gammaTable.at((gammaTable.size() / 3) * 2 + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < gammaTable.size() / 3; ++i) {
|
||||||
|
gammaTable.at(i * 3) = red.at(i);
|
||||||
|
gammaTable.at(i * 3 + 1) = green.at(i);
|
||||||
|
gammaTable.at(i * 3 + 2) = blue.at(i);
|
||||||
|
}
|
||||||
|
|
||||||
applyToMonitor();
|
applyToMonitor();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ class CGammaControl {
|
||||||
CMonitor* pMonitor = nullptr;
|
CMonitor* pMonitor = nullptr;
|
||||||
size_t gammaSize = 0;
|
size_t gammaSize = 0;
|
||||||
bool gammaTableSet = false;
|
bool gammaTableSet = false;
|
||||||
std::vector<uint16_t> gammaTable;
|
std::vector<uint16_t> gammaTable; // [r,g,b]+
|
||||||
|
|
||||||
void onMonitorDestroy();
|
void onMonitorDestroy();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue