mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-01-27 00:20:18 +01:00
mtseeder: Fixed problem that tiles with missing sub tiles were drawn in white entirely.
This commit is contained in:
parent
2709761255
commit
d39a948bd4
@ -136,6 +136,22 @@ func createParentLevel(oldDir string, jobs chan pyramidJob) (newDir string, err
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func clip8(x int) int {
|
||||||
|
switch {
|
||||||
|
case x < 0:
|
||||||
|
return 0
|
||||||
|
case x > 256:
|
||||||
|
return 256
|
||||||
|
}
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
|
||||||
|
func clipRect(r image.Rectangle) image.Rectangle {
|
||||||
|
return image.Rectangle{
|
||||||
|
Min: image.Point{X: clip8(r.Min.X), Y: clip8(r.Min.Y)},
|
||||||
|
Max: image.Point{X: clip8(r.Max.X), Y: clip8(r.Max.Y)}}
|
||||||
|
}
|
||||||
|
|
||||||
var dps = [4]image.Point{
|
var dps = [4]image.Point{
|
||||||
image.Pt(0, 256),
|
image.Pt(0, 256),
|
||||||
image.Pt(0, 0),
|
image.Pt(0, 0),
|
||||||
@ -148,7 +164,7 @@ func fuseTile(scratch *image.RGBA, job *pyramidJob) (err error) {
|
|||||||
|
|
||||||
img := common.LoadPNG(path)
|
img := common.LoadPNG(path)
|
||||||
|
|
||||||
sr := img.Bounds()
|
sr := clipRect(img.Bounds())
|
||||||
r := sr.Sub(sr.Min).Add(dps[i])
|
r := sr.Sub(sr.Min).Add(dps[i])
|
||||||
|
|
||||||
draw.Draw(scratch, r, img, sr.Min, draw.Src)
|
draw.Draw(scratch, r, img, sr.Min, draw.Src)
|
||||||
|
Loading…
Reference in New Issue
Block a user