From 7f3657e5f027011b9ffe990c13b1787f979d59a7 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Fri, 8 Dec 2017 07:54:46 +1100 Subject: [PATCH] [host] reversed the cropping logic, likely not needed anymore --- host/Capture/NvFBC.cpp | 24 ++++++++++++------------ host/Capture/NvFBC.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/host/Capture/NvFBC.cpp b/host/Capture/NvFBC.cpp index 1128bf29..e304e038 100644 --- a/host/Capture/NvFBC.cpp +++ b/host/Capture/NvFBC.cpp @@ -33,7 +33,7 @@ using namespace Capture; NvFBC::NvFBC() : m_options(NULL), - m_optNoCrop(false), + m_optCrop(false), m_optNoWait(false), m_initialized(false), m_hDLL(NULL), @@ -51,10 +51,10 @@ bool NvFBC::Initialize(CaptureOptions * options) DeInitialize(); m_options = options; - m_optNoCrop = false; + m_optCrop = false; for (CaptureOptions::const_iterator it = options->cbegin(); it != options->cend(); ++it) { - if (_strcmpi(*it, "nocrop") == 0) { m_optNoCrop = true; continue; } + if (_strcmpi(*it, "crop" ) == 0) { m_optCrop = true; continue; } if (_strcmpi(*it, "nowait") == 0) { m_optNoWait = true; continue; } } @@ -249,15 +249,7 @@ enum GrabStatus NvFBC::GrabFrame(struct FrameInfo & frame) unsigned int dataWidth; unsigned int dataOffset; - if (m_optNoCrop) - { - dataWidth = m_grabInfo.dwWidth * 4; - dataOffset = 0; - - frame.width = m_grabInfo.dwWidth; - frame.height = m_grabInfo.dwHeight; - } - else + if (m_optCrop) { const unsigned int realHeight = min(m_grabInfo.dwHeight, screenHeight); const unsigned int realWidth = min(m_grabInfo.dwWidth, screenWidth); @@ -269,6 +261,14 @@ enum GrabStatus NvFBC::GrabFrame(struct FrameInfo & frame) frame.width = realWidth; frame.height = realHeight; } + else + { + dataWidth = m_grabInfo.dwWidth * 4; + dataOffset = 0; + + frame.width = m_grabInfo.dwWidth; + frame.height = m_grabInfo.dwHeight; + } frame.stride = frame.width; frame.outSize = frame.width * frame.height * 4; diff --git a/host/Capture/NvFBC.h b/host/Capture/NvFBC.h index e3fecc12..3acec79f 100644 --- a/host/Capture/NvFBC.h +++ b/host/Capture/NvFBC.h @@ -49,7 +49,7 @@ namespace Capture private: CaptureOptions * m_options; - bool m_optNoCrop; + bool m_optCrop; bool m_optNoWait; bool m_initialized;