fix newly introduced bug in PictureDataFromImage
This commit is contained in:
parent
b1311c29b6
commit
767a5a8b13
4
data.go
4
data.go
|
@ -161,8 +161,8 @@ func verticalFlip(nrgba *image.NRGBA) {
|
|||
// The resulting PictureData's Bounds will be the equivalent of the supplied image.Image's Bounds.
|
||||
func PictureDataFromImage(img image.Image) PictureData {
|
||||
var nrgba *image.NRGBA
|
||||
if img, ok := img.(*image.NRGBA); ok {
|
||||
nrgba = img
|
||||
if nrgbaImg, ok := img.(*image.NRGBA); ok {
|
||||
nrgba = nrgbaImg
|
||||
} else {
|
||||
nrgba = image.NewNRGBA(img.Bounds())
|
||||
draw.Draw(nrgba, nrgba.Bounds(), img, img.Bounds().Min, draw.Src)
|
||||
|
|
Loading…
Reference in New Issue