From f58d7e1ab52c4992c5de2372f78c7bba43a2eb44 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 25 Feb 2023 02:06:03 +0900 Subject: [PATCH] internal/graphicsdriver/directx: bug fix: getting pixels with non-zero position might not work --- internal/graphicsdriver/directx/graphics_windows.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/graphicsdriver/directx/graphics_windows.go b/internal/graphicsdriver/directx/graphics_windows.go index 55855449b..9cb73317a 100644 --- a/internal/graphicsdriver/directx/graphics_windows.go +++ b/internal/graphicsdriver/directx/graphics_windows.go @@ -1438,12 +1438,12 @@ func (i *Image) ReadPixels(buf []byte, x, y, width, height int) error { } i.graphics.needFlushCopyCommandList = true i.graphics.copyCommandList.CopyTextureRegion_PlacedFootPrint_SubresourceIndex( - &dst, uint32(x), uint32(y), 0, &src, &_D3D12_BOX{ - left: 0, - top: 0, + &dst, 0, 0, 0, &src, &_D3D12_BOX{ + left: uint32(x), + top: uint32(y), front: 0, - right: uint32(width), - bottom: uint32(height), + right: uint32(x + width), + bottom: uint32(y + height), back: 1, })