Make sRGB the default colour space for deco tools, see 51e5f2b

This commit is contained in:
Tamás Bálint Misius 2019-09-22 23:10:57 +02:00
parent 742e030a13
commit 1cea59e521
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
2 changed files with 12 additions and 12 deletions

View File

@ -430,8 +430,8 @@ OptionsView::OptionsView():
decoSpace = new ui::DropDown(ui::Point(8, currentY), ui::Point(60, 16));
decoSpace->SetActionCallback(new DecoSpaceAction(this));
scrollPanel->AddChild(decoSpace);
decoSpace->AddOption(std::pair<String, int>("Linear", 0));
decoSpace->AddOption(std::pair<String, int>("sRGB", 1));
decoSpace->AddOption(std::pair<String, int>("sRGB", 0));
decoSpace->AddOption(std::pair<String, int>("Linear", 1));
decoSpace->AddOption(std::pair<String, int>("Gamma 2.2", 2));
decoSpace->AddOption(std::pair<String, int>("Gamma 1.8", 3));

View File

@ -917,12 +917,12 @@ void Simulation::SetDecoSpace(int newDecoSpace)
{
switch (newDecoSpace)
{
case 0: // linear
case 0: // sRGB
default: // anything stupid
deco_space = 0;
break;
case 1: // sRGB
case 1: // linear
deco_space = 1;
break;
@ -1049,16 +1049,16 @@ void Simulation::ApplyDecoration(int x, int y, int colR_, int colG_, int colB_,
float pb = ((float)((part.dcolour )&0xFF)) / 255.f;
switch (deco_space)
{
case 0: // linear
break;
case 1: // sRGB
case 0: // sRGB
pa = (pa <= 0.04045f) ? (pa / 12.92f) : pow((pa + 0.055f) / 1.055f, 2.4f);
pr = (pr <= 0.04045f) ? (pr / 12.92f) : pow((pr + 0.055f) / 1.055f, 2.4f);
pg = (pg <= 0.04045f) ? (pg / 12.92f) : pow((pg + 0.055f) / 1.055f, 2.4f);
pb = (pb <= 0.04045f) ? (pb / 12.92f) : pow((pb + 0.055f) / 1.055f, 2.4f);
break;
case 1: // linear
break;
case 2: // Gamma = 2.2
pa = pow(pa, 2.2f);
pr = pow(pr, 2.2f);
@ -1087,16 +1087,16 @@ void Simulation::ApplyDecoration(int x, int y, int colR_, int colG_, int colB_,
tb = tbs / num;
switch (deco_space)
{
case 0: // linear
break;
case 1: // sRGB
case 0: // sRGB
ta = (ta <= 0.0031308f) ? (ta * 12.92f) : (1.055f * pow(ta, 1.f / 2.4f) - 0.055f);
tr = (tr <= 0.0031308f) ? (tr * 12.92f) : (1.055f * pow(tr, 1.f / 2.4f) - 0.055f);
tg = (tg <= 0.0031308f) ? (tg * 12.92f) : (1.055f * pow(tg, 1.f / 2.4f) - 0.055f);
tb = (tb <= 0.0031308f) ? (tb * 12.92f) : (1.055f * pow(tb, 1.f / 2.4f) - 0.055f);
break;
case 1: // linear
break;
case 2: // Gamma = 2.2
ta = pow(ta, 1.f / 2.2f);
tr = pow(tr, 1.f / 2.2f);