From cfb2cc057c32330be0ca0a68cfbd245cb2b8e31b Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 5 Sep 2018 10:55:48 +0300 Subject: Update to latest gomatrix. Things are broken --- vendor/github.com/lucasb-eyer/go-colorful/colors.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'vendor/github.com/lucasb-eyer/go-colorful/colors.go') diff --git a/vendor/github.com/lucasb-eyer/go-colorful/colors.go b/vendor/github.com/lucasb-eyer/go-colorful/colors.go index 7469cf7..febf94c 100644 --- a/vendor/github.com/lucasb-eyer/go-colorful/colors.go +++ b/vendor/github.com/lucasb-eyer/go-colorful/colors.go @@ -22,8 +22,11 @@ func (col Color) RGBA() (r, g, b, a uint32) { } // Constructs a colorful.Color from something implementing color.Color -func MakeColor(col color.Color) Color { +func MakeColor(col color.Color) (Color, bool) { r, g, b, a := col.RGBA() + if a == 0 { + return Color{0, 0, 0}, false + } // Since color.Color is alpha pre-multiplied, we need to divide the // RGB values by alpha again in order to get back the original RGB. @@ -34,7 +37,7 @@ func MakeColor(col color.Color) Color { b *= 0xffff b /= a - return Color{float64(r) / 65535.0, float64(g) / 65535.0, float64(b) / 65535.0} + return Color{float64(r) / 65535.0, float64(g) / 65535.0, float64(b) / 65535.0}, true } // Might come in handy sometimes to reduce boilerplate code. -- cgit v1.2.3