From f16eb8271e9103ca31354fbb1b0eaccd843e0cf1 Mon Sep 17 00:00:00 2001 From: faiface <faiface@ksp.sk> Date: Sun, 22 Jan 2017 14:16:19 +0100 Subject: [PATCH] fix Picture.Image --- picture.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/picture.go b/picture.go index bf0334d..1bafafb 100644 --- a/picture.go +++ b/picture.go @@ -54,20 +54,17 @@ func NewPicture(img image.Image, smooth bool) *Picture { // Image returns the content of the Picture as an image.NRGBA. func (p *Picture) Image() *image.NRGBA { bounds := p.Bounds() - nrgba := image.NewNRGBA(image.Rect( - int(bounds.X()), - int(bounds.Y()), - int(bounds.X()+bounds.W()), - int(bounds.Y()+bounds.H()), - )) + nrgba := image.NewNRGBA(image.Rect(0, 0, int(bounds.W()), int(bounds.H()))) mainthread.Call(func() { + p.texture.Begin() nrgba.Pix = p.texture.Pixels( int(bounds.X()), int(bounds.Y()), int(bounds.W()), int(bounds.H()), ) + p.texture.End() }) // flip the image vertically -- GitLab