gamma done

This commit is contained in:
Vaxry 2024-07-02 12:41:41 +02:00
parent c66f63b63d
commit 1bbcfa9e47
2 changed files with 19 additions and 1 deletions

View file

@ -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();
}); });

View file

@ -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();