From 0a73cbfce46a8f57455d1101cccee6a3cad4a656 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 22 Oct 2024 14:29:46 +0900 Subject: [PATCH] internal/builtinshader: refactoring --- internal/builtinshader/shader.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/builtinshader/shader.go b/internal/builtinshader/shader.go index b543070d8..2c41f24c2 100644 --- a/internal/builtinshader/shader.go +++ b/internal/builtinshader/shader.go @@ -173,9 +173,8 @@ package main func Fragment(dstPos vec4, srcPos vec2) vec4 { // Blend source colors in a square region, which size is 1/scale. scale := imageDstSize()/imageSrc0Size() - pos := srcPos - p0 := pos - 1/2.0/scale - p1 := pos + 1/2.0/scale + p0 := srcPos - 1/2.0/scale + p1 := srcPos + 1/2.0/scale // Texels must be in the source rect, so it is not necessary to check. c0 := imageSrc0UnsafeAt(p0) @@ -183,7 +182,6 @@ func Fragment(dstPos vec4, srcPos vec2) vec4 { c2 := imageSrc0UnsafeAt(vec2(p0.x, p1.y)) c3 := imageSrc0UnsafeAt(p1) - // p is the p1 value in one pixel assuming that the pixel's upper-left is (0, 0) and the lower-right is (1, 1). rate := clamp(fract(p1)*scale, 0, 1) return mix(mix(c0, c1, rate.x), mix(c2, c3, rate.x), rate.y) }