[DEV] remove etk_min and etk_max
This commit is contained in:
parent
04556d63d1
commit
f2a9ffcdb2
@ -423,27 +423,27 @@ void draw::parseColor(const char* _input, struct agg::rgba8& color)
|
|||||||
int32_t _red=0, _green=0, _blue=0, _alpha=0;
|
int32_t _red=0, _green=0, _blue=0, _alpha=0;
|
||||||
float fred=0, fgreen=0, fblue=0, falpha=0;
|
float fred=0, fgreen=0, fblue=0, falpha=0;
|
||||||
if (sscanf(inputData + 4, "%u,%u,%u,%u", &_red, &_green, &_blue, &_alpha) == 4) {
|
if (sscanf(inputData + 4, "%u,%u,%u,%u", &_red, &_green, &_blue, &_alpha) == 4) {
|
||||||
color.r = etk_min(0xFF, _red);
|
color.r = std::min(0xFF, _red);
|
||||||
color.g = etk_min(0xFF, _green);
|
color.g = std::min(0xFF, _green);
|
||||||
color.b = etk_min(0xFF, _blue);
|
color.b = std::min(0xFF, _blue);
|
||||||
color.a = etk_min(0xFF, _alpha);
|
color.a = std::min(0xFF, _alpha);
|
||||||
} else if (sscanf(inputData + 4, "%u,%u,%u", &_red, &_green, &_blue) == 3) {
|
} else if (sscanf(inputData + 4, "%u,%u,%u", &_red, &_green, &_blue) == 3) {
|
||||||
color.r = etk_min(0xFF, _red);
|
color.r = std::min(0xFF, _red);
|
||||||
color.g = etk_min(0xFF, _green);
|
color.g = std::min(0xFF, _green);
|
||||||
color.b = etk_min(0xFF, _blue);
|
color.b = std::min(0xFF, _blue);
|
||||||
} else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%,%f%%", &fred, &fgreen, &fblue, &falpha) == 4) {
|
} else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%,%f%%", &fred, &fgreen, &fblue, &falpha) == 4) {
|
||||||
fred = etk_avg(0.0, fred, 1.0);
|
fred = std::avg(0.0f, fred, 1.0f);
|
||||||
fgreen = etk_avg(0.0, fgreen, 1.0);
|
fgreen = std::avg(0.0f, fgreen, 1.0f);
|
||||||
fblue = etk_avg(0.0, fblue, 1.0);
|
fblue = std::avg(0.0f, fblue, 1.0f);
|
||||||
falpha = etk_avg(0.0, falpha, 1.0);
|
falpha = std::avg(0.0f, falpha, 1.0f);
|
||||||
color.r = (uint8_t)(fred * 255.);
|
color.r = (uint8_t)(fred * 255.);
|
||||||
color.g = (uint8_t)(fgreen * 255.);
|
color.g = (uint8_t)(fgreen * 255.);
|
||||||
color.b = (uint8_t)(fblue * 255.);
|
color.b = (uint8_t)(fblue * 255.);
|
||||||
color.a = (uint8_t)(falpha * 255.);
|
color.a = (uint8_t)(falpha * 255.);
|
||||||
} else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%", &fred, &fgreen, &fblue) == 3) {
|
} else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%", &fred, &fgreen, &fblue) == 3) {
|
||||||
fred = etk_avg(0.0, fred, 1.0);
|
fred = std::avg(0.0f, fred, 1.0f);
|
||||||
fgreen= etk_avg(0.0, fgreen, 1.0);
|
fgreen= std::avg(0.0f, fgreen, 1.0f);
|
||||||
fblue = etk_avg(0.0, fblue, 1.0);
|
fblue = std::avg(0.0f, fblue, 1.0f);
|
||||||
color.r = (uint8_t)(fred * 255.);
|
color.r = (uint8_t)(fred * 255.);
|
||||||
color.g = (uint8_t)(fgreen * 255.);
|
color.g = (uint8_t)(fgreen * 255.);
|
||||||
color.b = (uint8_t)(fblue * 255.);
|
color.b = (uint8_t)(fblue * 255.);
|
||||||
|
@ -369,9 +369,9 @@ void draw::Image::distanceField(ivec2 pos, ivec2 size, int32_t upscaler, int32_t
|
|||||||
draw::Color tmpColor = get(pos+tmpPos);
|
draw::Color tmpColor = get(pos+tmpPos);
|
||||||
float tmpValue = ((1.0-((float)newDist * maxVal)) * 0.5) * 128.0;
|
float tmpValue = ((1.0-((float)newDist * maxVal)) * 0.5) * 128.0;
|
||||||
if (tmpColor.a<=0x7F) {
|
if (tmpColor.a<=0x7F) {
|
||||||
tmpColor.a = etk_avg(0, tmpValue, 255);
|
tmpColor.a = std::avg(0, tmpValue, 255);
|
||||||
} else {
|
} else {
|
||||||
tmpColor.a = etk_avg(0, 255-tmpValue, 255);
|
tmpColor.a = std::avg(0, 255-tmpValue, 255);
|
||||||
}
|
}
|
||||||
set(pos+tmpPos, tmpColor);
|
set(pos+tmpPos, tmpColor);
|
||||||
}
|
}
|
||||||
@ -422,7 +422,7 @@ void draw::Image::distanceField(ivec2 pos, ivec2 size, int32_t upscaler, int32_t
|
|||||||
*/
|
*/
|
||||||
draw::Color tmpColor = get(pos+tmpPos);
|
draw::Color tmpColor = get(pos+tmpPos);
|
||||||
// Clamp and scale it, just for display purposes.
|
// Clamp and scale it, just for display purposes.
|
||||||
tmpColor.a = etk_avg(0, (dist*3 + 128), 255);
|
tmpColor.a = std::avg(0.0f, (dist*3 + 128), 255.0f);
|
||||||
set(pos+tmpPos, tmpColor);
|
set(pos+tmpPos, tmpColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user