From b86e04704ffd2aaca087eb1c6a7cdee769091393 Mon Sep 17 00:00:00 2001 From: faiface Date: Fri, 6 Jan 2017 02:49:23 +0100 Subject: [PATCH] fix Picture creation optimization --- picture.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/picture.go b/picture.go index 4ac181c..1d731b9 100644 --- a/picture.go +++ b/picture.go @@ -22,8 +22,8 @@ type Picture struct { func NewPicture(img image.Image, smooth bool) *Picture { // convert the image to RGBA format var rgba *image.RGBA - if img, ok := img.(*image.RGBA); ok { - rgba = img + if rgbaImg, ok := img.(*image.RGBA); ok { + rgba = rgbaImg } else { rgba = image.NewRGBA(image.Rect(0, 0, img.Bounds().Dx(), img.Bounds().Dy())) draw.Draw(rgba, rgba.Bounds(), img, img.Bounds().Min, draw.Src)