From b67a8ef792d3ee40d5b90008a4aa7d4c6be75bf6 Mon Sep 17 00:00:00 2001 From: walbourn_cp Date: Fri, 14 Feb 2014 12:56:11 -0800 Subject: [PATCH] ScreenGrab: Fixed computing for NV11 which requires width multiple of 4, but height can be odd --- ScreenGrab/ScreenGrab.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ScreenGrab/ScreenGrab.cpp b/ScreenGrab/ScreenGrab.cpp index ba2ced1..cc17527 100644 --- a/ScreenGrab/ScreenGrab.cpp +++ b/ScreenGrab/ScreenGrab.cpp @@ -507,9 +507,9 @@ static void GetSurfaceInfo( _In_ size_t width, } else if ( fmt == DXGI_FORMAT_NV11 ) { - rowBytes = ( ( width + 1 ) >> 1 ) * 2; - numBytes = rowBytes * ( ( height + 1 ) >> 1 ) * 4; + rowBytes = ( ( width + 3 ) >> 2 ) * 4; numRows = height * 2; // Direct3D makes this simplifying assumption, although it is larger than the 4:1:1 data + numBytes = rowBytes * numRows; } else if (planar) {