internal/graphicsdriver/directx: refactoring

This commit is contained in:
Hajime Hoshi 2023-03-29 18:26:11 +09:00
parent 0b0526a05b
commit 1017161c36

View File

@ -116,7 +116,7 @@ func (i *image11) ReadPixels(buf []byte, x, y, width, height int) error {
stride := int(mapped.RowPitch) stride := int(mapped.RowPitch)
src := unsafe.Slice((*byte)(mapped.pData), stride*height) src := unsafe.Slice((*byte)(mapped.pData), stride*height)
if mapped.RowPitch == uint32(4*width) { if stride == 4*width {
copy(buf, src) copy(buf, src)
} else { } else {
for j := 0; j < height; j++ { for j := 0; j < height; j++ {