mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-24 01:00:18 +01:00
Used fix point arithmetic in scaler.
This commit is contained in:
parent
c67739fd77
commit
48819a42a9
@ -24,25 +24,23 @@ import (
|
||||
|
||||
func blowUp(src image.Image) *image.RGBA {
|
||||
|
||||
// TODO: Use fix point arithmetic, fast path for image.RGBA
|
||||
// TODO: Fast path for image.RGBA
|
||||
|
||||
dst := image.NewRGBA(image.Rect(0, 0, 256, 256))
|
||||
|
||||
sw, sh := src.Bounds().Dx(), src.Bounds().Dy()
|
||||
// fix point numbers x:8
|
||||
dx, dy := src.Bounds().Dx(), src.Bounds().Dy()
|
||||
|
||||
dx := float32(sw) / float32(256)
|
||||
dy := float32(sh) / float32(256)
|
||||
bx, by := src.Bounds().Min.X<<8, src.Bounds().Min.Y<<8
|
||||
|
||||
bx, by := src.Bounds().Min.X, src.Bounds().Min.Y
|
||||
|
||||
py := float32(by)
|
||||
py := by
|
||||
for y := 0; y < 256; y++ {
|
||||
sy := int(py)
|
||||
sy := (py >> 8) & 0xff
|
||||
ox := -1
|
||||
px := float32(bx)
|
||||
px := bx
|
||||
var col color.Color
|
||||
for x := 0; x < 256; x++ {
|
||||
sx := int(px)
|
||||
sx := (px >> 8) & 0xff
|
||||
if sx != ox { // Minimize interface indirection access.
|
||||
ox = sx
|
||||
col = src.At(sx, sy)
|
||||
|
Loading…
Reference in New Issue
Block a user