Sfoglia il codice sorgente

color: fix issues in color to string conversions.

undefined
Sam Hocevar 11 anni fa
parent
commit
10272731ee
1 ha cambiato i file con 4 aggiunte e 4 eliminazioni
  1. +4
    -4
      src/image/color/color.cpp

+ 4
- 4
src/image/color/color.cpp Vedi File

@@ -19,25 +19,25 @@ namespace lol

String Color::HexString4Bpp(vec3 c)
{
uvec3 c2 = (uvec3)(clamp(c, 0.f, 1.f) * 255.0f);
uvec3 c2 = (uvec3)(clamp(c, 0.f, 1.f) * 255.999f);
return String::Printf("%01x%01x%01x", c2.r, c2.g, c2.b);
}

String Color::HexString4Bpp(vec4 c)
{
uvec4 c2 = (uvec4)(clamp(c, 0.f, 1.f) * 255.0f);
uvec4 c2 = (uvec4)(clamp(c, 0.f, 1.f) * 15.999f);
return String::Printf("%01x%1x%01x%01x", c2.r, c2.g, c2.b, c2.a);
}

String Color::HexString8Bpp(vec3 c)
{
uvec3 c2 = (uvec3)(clamp(c, 0.f, 1.f) * 255.0f);
uvec3 c2 = (uvec3)(clamp(c, 0.f, 1.f) * 255.999f);
return String::Printf("%02x%02x%02x", c2.r, c2.g, c2.b);
}

String Color::HexString8Bpp(vec4 c)
{
uvec4 c2 = (uvec4)(clamp(c, 0.f, 1.f) * 255.0f);
uvec4 c2 = (uvec4)(clamp(c, 0.f, 1.f) * 15.999f);
return String::Printf("%02x%2x%02x%02x", c2.r, c2.g, c2.b, c2.a);
}



Caricamento…
Annulla
Salva