shareable: Refactoring

This commit is contained in:
Hajime Hoshi 2020-09-21 01:58:00 +09:00
parent 138d9b8e47
commit 8d17ec837a

View File

@ -354,16 +354,14 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderImageNum]*Image, vertices []f
} }
var offsets [graphics.ShaderImageNum - 1][2]float32 var offsets [graphics.ShaderImageNum - 1][2]float32
for i := range offsets { for i, subimageOffset := range subimageOffsets {
src := srcs[i+1] src := srcs[i+1]
if src == nil { if src == nil {
continue continue
} }
ox, oy, _, _ := src.regionWithPadding() ox, oy, _, _ := src.regionWithPadding()
ox += paddingSize offsets[i][0] = float32(ox) + paddingSize - oxf + subimageOffset[0]
oy += paddingSize offsets[i][1] = float32(oy) + paddingSize - oyf + subimageOffset[1]
offsets[i][0] = float32(ox) - oxf + subimageOffsets[i][0]
offsets[i][1] = float32(oy) - oyf + subimageOffsets[i][1]
} }
var s *restorable.Shader var s *restorable.Shader