From 42f07ca5388e1f2316d2af658251e799c42ce125 Mon Sep 17 00:00:00 2001 From: Viktor Date: Sat, 20 Jun 2020 23:29:59 +0200 Subject: [PATCH] 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 --- internal/f32color/rgba.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/f32color/rgba.go b/internal/f32color/rgba.go index 03377aca..efaa1fb9 100644 --- a/internal/f32color/rgba.go +++ b/internal/f32color/rgba.go @@ -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),