internal/f32color: use explicit type to avoid allocation

f32color.RGBAFromSRGB is used extensively in package gpu, avoid an
interface type to save allocations.

Signed-off-by: Viktor <viktor.ogeman@gmail.com>
This commit is contained in:
Viktor
2020-06-20 23:29:59 +02:00
committed by Elias Naur
parent 818d0c4af1
commit 42f07ca538
+2 -2
View File
@@ -38,8 +38,8 @@ func (col RGBA) Opaque() RGBA {
return col return col
} }
// RGBAFromSRGB converts color.Color to RGBA. // RGBAFromSRGB converts from SRGBA to RGBA.
func RGBAFromSRGB(col color.Color) RGBA { func RGBAFromSRGB(col color.RGBA) RGBA {
r, g, b, a := col.RGBA() r, g, b, a := col.RGBA()
return RGBA{ return RGBA{
R: sRGBToLinear(float32(r) / 0xffff), R: sRGBToLinear(float32(r) / 0xffff),