mirror of
https://github.com/Dadido3/noita-mapcap.git
synced 2024-11-22 21:17:33 +00:00
Correct image.Rectangle downscaling
This commit is contained in:
parent
a0168df91f
commit
cbdd925c30
@ -36,6 +36,7 @@ type ImageTile struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewImageTile returns an image tile object that represents the image at the given path.
|
// NewImageTile returns an image tile object that represents the image at the given path.
|
||||||
|
// The filename will be used to determine the top left x and y coordinate of the tile.
|
||||||
// This will not load the image into RAM.
|
// This will not load the image into RAM.
|
||||||
func NewImageTile(path string, scaleDivider int) (ImageTile, error) {
|
func NewImageTile(path string, scaleDivider int) (ImageTile, error) {
|
||||||
if scaleDivider < 1 {
|
if scaleDivider < 1 {
|
||||||
@ -71,7 +72,7 @@ func NewImageTile(path string, scaleDivider int) (ImageTile, error) {
|
|||||||
fileName: path,
|
fileName: path,
|
||||||
modTime: modTime,
|
modTime: modTime,
|
||||||
scaleDivider: scaleDivider,
|
scaleDivider: scaleDivider,
|
||||||
image: image.Rect(x/scaleDivider, y/scaleDivider, (x+width)/scaleDivider, (y+height)/scaleDivider),
|
image: image.Rect(DivideFloor(x, scaleDivider), DivideFloor(y, scaleDivider), DivideCeil(x+width, scaleDivider), DivideCeil(y+height, scaleDivider)),
|
||||||
imageMutex: &sync.RWMutex{},
|
imageMutex: &sync.RWMutex{},
|
||||||
invalidationChan: make(chan struct{}, 1),
|
invalidationChan: make(chan struct{}, 1),
|
||||||
timeoutChan: make(chan struct{}, 1),
|
timeoutChan: make(chan struct{}, 1),
|
||||||
|
Loading…
Reference in New Issue
Block a user