mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-02 16:06:19 +00:00
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
|
||||
}
|
||||
|
||||
// RGBAFromSRGB converts color.Color to RGBA.
|
||||
func RGBAFromSRGB(col color.Color) RGBA {
|
||||
// RGBAFromSRGB converts from SRGBA to RGBA.
|
||||
func RGBAFromSRGB(col color.RGBA) RGBA {
|
||||
r, g, b, a := col.RGBA()
|
||||
return RGBA{
|
||||
R: sRGBToLinear(float32(r) / 0xffff),
|
||||
|
||||
Reference in New Issue
Block a user