graphics: Refactoring: Remove drawImageCommand.quadsNum

This commit is contained in:
Hajime Hoshi 2018-06-03 23:53:12 +09:00
parent c9dd04d471
commit fac639f9b7

View File

@ -114,10 +114,10 @@ func (q *commandQueue) doEnqueueDrawImageCommand(dst, src *Image, nvertices, nel
func (q *commandQueue) EnqueueDrawImageCommand(dst, src *Image, vertices []float32, color *affine.ColorM, mode opengl.CompositeMode, filter Filter) { func (q *commandQueue) EnqueueDrawImageCommand(dst, src *Image, vertices []float32, color *affine.ColorM, mode opengl.CompositeMode, filter Filter) {
// Avoid defer for performance // Avoid defer for performance
q.appendVertices(vertices) q.appendVertices(vertices)
nelements := 6 * len(vertices) * opengl.Float.SizeInBytes() / QuadVertexSizeInBytes() nq := len(vertices) * opengl.Float.SizeInBytes() / QuadVertexSizeInBytes()
nv := 0 nv := 0
ne := 0 ne := 0
for i := 0; i < nelements/6; i++ { for i := 0; i < nq; i++ {
if q.nelements%indicesNum >= (q.nelements+6)%indicesNum { if q.nelements%indicesNum >= (q.nelements+6)%indicesNum {
q.nextIndex = 0 q.nextIndex = 0
// Note that even if ne == 0, that's fine. // Note that even if ne == 0, that's fine.
@ -282,11 +282,6 @@ func (c *drawImageCommand) CanMerge(dst, src *Image, color *affine.ColorM, mode
return true return true
} }
// quadsNum returns the number of quadrangles.
func (c *drawImageCommand) quadsNum() int {
return c.nvertices * opengl.Float.SizeInBytes() / QuadVertexSizeInBytes()
}
// replacePixelsCommand represents a command to replace pixels of an image. // replacePixelsCommand represents a command to replace pixels of an image.
type replacePixelsCommand struct { type replacePixelsCommand struct {
dst *Image dst *Image