From 8d2306bcbf72dd6c47af4e6d15f7b8dfc89e396a Mon Sep 17 00:00:00 2001 From: faiface Date: Fri, 6 Jan 2017 02:50:03 +0100 Subject: [PATCH] fix passing nil color to Window --- window.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/window.go b/window.go index 1428568..a2bf8bb 100644 --- a/window.go +++ b/window.go @@ -401,7 +401,7 @@ func (wt *windowTriangles) flush() { wt.attrData[i] = make(map[pixelgl.Attr]interface{}) } p := v.Position - c := NRGBAModel.Convert(v.Color).(NRGBA) + c := v.Color t := v.Texture wt.attrData[i][positionVec2] = mgl32.Vec2{float32(p.X()), float32(p.Y())} wt.attrData[i][colorVec4] = mgl32.Vec4{float32(c.R), float32(c.G), float32(c.B), float32(c.A)} @@ -448,9 +448,6 @@ func (wt *windowTriangles) Update(t Triangles) { } wt.data = append(wt.data, newData...) } - if t.Len() < wt.Len() { - wt.data = wt.data[:t.Len()] - } wt.data.Update(t) } @@ -497,6 +494,9 @@ func (w *Window) SetTransform(t ...Transform) { // SetMaskColor sets a global mask color for the Window. func (w *Window) SetMaskColor(c color.Color) { + if c == nil { + c = NRGBA{1, 1, 1, 1} + } nrgba := NRGBAModel.Convert(c).(NRGBA) r := float32(nrgba.R) g := float32(nrgba.G)