From 8d17ec837aac73c665df894db4f47c3443b16ca5 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 21 Sep 2020 01:58:00 +0900 Subject: [PATCH] shareable: Refactoring --- internal/shareable/image.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/shareable/image.go b/internal/shareable/image.go index efdb6a01e..97dcbd96a 100644 --- a/internal/shareable/image.go +++ b/internal/shareable/image.go @@ -354,16 +354,14 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderImageNum]*Image, vertices []f } var offsets [graphics.ShaderImageNum - 1][2]float32 - for i := range offsets { + for i, subimageOffset := range subimageOffsets { src := srcs[i+1] if src == nil { continue } ox, oy, _, _ := src.regionWithPadding() - ox += paddingSize - oy += paddingSize - offsets[i][0] = float32(ox) - oxf + subimageOffsets[i][0] - offsets[i][1] = float32(oy) - oyf + subimageOffsets[i][1] + offsets[i][0] = float32(ox) + paddingSize - oxf + subimageOffset[0] + offsets[i][1] = float32(oy) + paddingSize - oyf + subimageOffset[1] } var s *restorable.Shader