forked from joejulian/gio
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:
@@ -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),
|
||||||
|
|||||||
Reference in New Issue
Block a user