On Sun, Nov 20, 2016 at 03:33:22PM +0900, Akihiro Sagawa wrote:
@@ -53,6 +53,26 @@ HRESULT WINAPI BaseControlVideo_Destroy(BaseControlVideo *pControlVideo) return BaseDispatch_Destroy(&pControlVideo->baseDispatch); }
+static HRESULT BaseControlVideoImpl_CheckSourceRect(BaseControlVideo *This, RECT *pSourceRect) +{ + LONG VideoWidth, VideoHeight; + HRESULT hr; + + if (pSourceRect->top < 0 || pSourceRect->left < 0 || + pSourceRect->top >= pSourceRect->bottom || + pSourceRect->left >= pSourceRect->right) + return E_INVALIDARG;
I'm not opposed to spelling it out, but you could use IsRectEmpty() here instead.
+ + hr = BaseControlVideoImpl_GetVideoSize((IBasicVideo *)This, &VideoWidth, &VideoHeight); + if (FAILED(hr)) + return hr; + + if (pSourceRect->bottom > VideoHeight || pSourceRect->right > VideoWidth) + return E_INVALIDARG; +
Shouldn't these use (bottom - top) and (right - left)? Andrew