diff --git a/internal/graphicscommand/command.go b/internal/graphicscommand/command.go index 9df0439fa..b673bc7e2 100644 --- a/internal/graphicscommand/command.go +++ b/internal/graphicscommand/command.go @@ -192,7 +192,8 @@ func (q *commandQueue) Flush() { const dstAdjustmentFactor = 1.0 / 256.0 const texelAdjustmentFactor = 1.0 / 512.0 - for i := 0; i < q.nvertices/graphics.VertexFloatNum; i++ { + n := q.nvertices / graphics.VertexFloatNum + for i := 0; i < n; i++ { s := q.srcSizes[i] // Convert pixels to texels. diff --git a/internal/shareable/image.go b/internal/shareable/image.go index 61d4c4591..bffbe190e 100644 --- a/internal/shareable/image.go +++ b/internal/shareable/image.go @@ -303,7 +303,8 @@ func (i *Image) DrawTriangles(img *Image, vertices []float32, indices []uint16, ox, oy, _, _ := img.region() oxf, oyf := float32(ox), float32(oy) - for i := 0; i < len(vertices)/graphics.VertexFloatNum; i++ { + n := len(vertices) / graphics.VertexFloatNum + for i := 0; i < n; i++ { vertices[i*graphics.VertexFloatNum+2] += oxf vertices[i*graphics.VertexFloatNum+3] += oyf vertices[i*graphics.VertexFloatNum+4] += oxf