Skip to content

Commit

Permalink
Fix regression where OriginalFill images would never show
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Jun 27, 2022
1 parent 81b8dc6 commit 4629691
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,7 @@ More detailed release notes can be found on the [releases page](https://github.c
* Emphasis in Markdown gives erroneous output in RichText (#2974)
* When last visible window is closed, hidden window is set visible (#3059)
* Do not close app when last window is closed but systrayMenu exists (#3092)
* Image with ImageFillOriginal not showing (#3102)


## 2.2.1 - 12 June 2022
Expand Down
6 changes: 4 additions & 2 deletions internal/painter/image.go
Expand Up @@ -46,8 +46,8 @@ func PaintImage(img *canvas.Image, c fyne.Canvas, width, height int) image.Image
var wantOrigW, wantOrigH int
wantOrigSize := false
if img.FillMode == canvas.ImageFillOriginal && c != nil {
wantOrigW = internal.ScaleInt(c, img.Size().Width)
wantOrigH = internal.ScaleInt(c, img.Size().Height)
wantOrigW = internal.ScaleInt(c, img.MinSize().Width)
wantOrigH = internal.ScaleInt(c, img.MinSize().Height)
wantOrigSize = true
}

Expand Down Expand Up @@ -124,12 +124,14 @@ func paintImage(img *canvas.Image, width, height int, wantOrigSize bool, wantOri
}

origSize := pixels.Bounds().Size()
origW, origH = origSize.X, origSize.Y
if checkSize(origSize.X, origSize.Y) {
dst = scaleImage(pixels, width, height, img.ScaleMode)
}
}
case img.Image != nil:
origSize := img.Image.Bounds().Size()
origW, origH = origSize.X, origSize.Y
if checkSize(origSize.X, origSize.Y) {
dst = scaleImage(img.Image, width, height, img.ScaleMode)
}
Expand Down

0 comments on commit 4629691

Please sign in to comment.