mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-02-02 11:10:20 +01:00
Use blake2b instead of sha1 to check for identical tiles to not regenerate the tiles pyramid.
This commit is contained in:
parent
540836b174
commit
12cfd32ad5
@ -172,7 +172,7 @@ func (btc *BaseTileCreator) CreateTile(x, z int16, i, j int) (bool, error) {
|
||||
return true, SaveAsPNG(path, image)
|
||||
}
|
||||
|
||||
if btc.update(i, j, SHA1Image(image)) {
|
||||
if btc.update(i, j, HashImage(image)) {
|
||||
log.Printf("Writing (%d, %d) to file %s.\n", x, z, path)
|
||||
return true, SaveAsPNGAtomic(path, image)
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ package common
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"crypto/sha1"
|
||||
"errors"
|
||||
"image"
|
||||
"image/color"
|
||||
@ -18,6 +17,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"golang.org/x/crypto/blake2b"
|
||||
|
||||
"github.com/bamiaux/rez"
|
||||
)
|
||||
|
||||
@ -112,9 +113,9 @@ func LoadPNG(path string, bg color.RGBA) image.Image {
|
||||
return img
|
||||
}
|
||||
|
||||
func SHA1Image(img *image.RGBA) []byte {
|
||||
func HashImage(img *image.RGBA) []byte {
|
||||
|
||||
hash := sha1.New()
|
||||
hash, _ := blake2b.New256(nil)
|
||||
w, h := img.Rect.Dx()*4, img.Rect.Dy()
|
||||
|
||||
pos := img.PixOffset(img.Rect.Min.X, img.Rect.Min.Y)
|
||||
|
Loading…
Reference in New Issue
Block a user