From 0feec0664524f62666d0ad19f7c608ebd3d6a51e Mon Sep 17 00:00:00 2001 From: disintegration Date: Thu, 19 Mar 2015 22:52:55 +0300 Subject: [PATCH] Dst pixel coordinate fix --- filters.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/filters.go b/filters.go index ad56031..4ce04e3 100644 --- a/filters.go +++ b/filters.go @@ -87,7 +87,7 @@ func createWeights8(dy, filterLength int, blur, scale float64, kernel func(float coeffs := make([]int16, dy*filterLength) start := make([]int, dy) for y := 0; y < dy; y++ { - interpX := scale * (float64(y) + 0.5) + interpX := scale*(float64(y)+0.5) - 0.5 start[y] = int(interpX) - filterLength/2 + 1 interpX -= float64(start[y]) for i := 0; i < filterLength; i++ { @@ -107,7 +107,7 @@ func createWeights16(dy, filterLength int, blur, scale float64, kernel func(floa coeffs := make([]int32, dy*filterLength) start := make([]int, dy) for y := 0; y < dy; y++ { - interpX := scale * (float64(y) + 0.5) + interpX := scale*(float64(y)+0.5) - 0.5 start[y] = int(interpX) - filterLength/2 + 1 interpX -= float64(start[y]) for i := 0; i < filterLength; i++ { @@ -126,7 +126,7 @@ func createWeightsNearest(dy, filterLength int, blur, scale float64) ([]bool, [] coeffs := make([]bool, dy*filterLength) start := make([]int, dy) for y := 0; y < dy; y++ { - interpX := scale * (float64(y) + 0.5) + interpX := scale*(float64(y)+0.5) - 0.5 start[y] = int(interpX) - filterLength/2 + 1 interpX -= float64(start[y]) for i := 0; i < filterLength; i++ {