mirror of https://github.com/adamdruppe/arsd.git
omg divide by 0
This commit is contained in:
parent
dc50e93a01
commit
0fd808ed32
2
color.d
2
color.d
|
@ -720,6 +720,8 @@ void premultiplyBgra(ubyte[] bgra) pure @nogc @safe nothrow in { assert(bgra.len
|
||||||
|
|
||||||
void unPremultiplyRgba(ubyte[] rgba) pure @nogc @safe nothrow in { assert(rgba.length == 4); } do {
|
void unPremultiplyRgba(ubyte[] rgba) pure @nogc @safe nothrow in { assert(rgba.length == 4); } do {
|
||||||
auto a = rgba[3];
|
auto a = rgba[3];
|
||||||
|
if(a == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
rgba[0] = cast(ubyte)(rgba[0] * 255 / a);
|
rgba[0] = cast(ubyte)(rgba[0] * 255 / a);
|
||||||
rgba[1] = cast(ubyte)(rgba[1] * 255 / a);
|
rgba[1] = cast(ubyte)(rgba[1] * 255 / a);
|
||||||
|
|
Loading…
Reference in New Issue