internal/graphicscommand: add comments

This commit is contained in:
Hajime Hoshi 2023-08-01 00:18:12 +09:00
parent ce25583438
commit ae9781cd53

View File

@ -29,6 +29,7 @@ func temporaryBytesSize(size int) int {
} }
// alloc allocates the pixels and returns it. // alloc allocates the pixels and returns it.
//
// Be careful that the returned pixels might not be zero-cleared. // Be careful that the returned pixels might not be zero-cleared.
func (t *temporaryBytes) alloc(size int) []byte { func (t *temporaryBytes) alloc(size int) []byte {
if len(t.pixels) < t.pos+size { if len(t.pixels) < t.pos+size {
@ -66,6 +67,9 @@ func (t *temporaryBytes) reset() {
t.pos = 0 t.pos = 0
} }
// AllocBytes allocates bytes from the cache.
//
// Be careful that the returned pixels might not be zero-cleared.
func AllocBytes(size int) []byte { func AllocBytes(size int) []byte {
return currentCommandQueue().temporaryBytes.alloc(size) return currentCommandQueue().temporaryBytes.alloc(size)
} }