quartz: Move the source and destination rectangles to the BaseControlVideo structure.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-05-06 19:28:51 -05:00 committed by Alexandre Julliard
parent 779edf4def
commit 833829cb31
4 changed files with 111 additions and 276 deletions

View File

@ -166,29 +166,23 @@ typedef struct tagBaseControlVideo
{
IBasicVideo IBasicVideo_iface;
RECT src, dst;
struct strmbase_filter *pFilter;
struct strmbase_pin *pPin;
const struct BaseControlVideoFuncTable *pFuncsTable;
} BaseControlVideo;
typedef HRESULT (WINAPI *BaseControlVideo_GetSourceRect)(BaseControlVideo* This, RECT *pSourceRect);
typedef HRESULT (WINAPI *BaseControlVideo_GetStaticImage)(BaseControlVideo* This, LONG *pBufferSize, LONG *pDIBImage);
typedef HRESULT (WINAPI *BaseControlVideo_GetTargetRect)(BaseControlVideo* This, RECT *pTargetRect);
typedef HRESULT (WINAPI *BaseControlVideo_SetDefaultSourceRect)(BaseControlVideo* This);
typedef HRESULT (WINAPI *BaseControlVideo_SetDefaultTargetRect)(BaseControlVideo* This);
typedef HRESULT (WINAPI *BaseControlVideo_SetSourceRect)(BaseControlVideo* This, RECT *pSourceRect);
typedef HRESULT (WINAPI *BaseControlVideo_SetTargetRect)(BaseControlVideo* This, RECT *pTargetRect);
typedef struct BaseControlVideoFuncTable
{
BaseControlVideo_GetSourceRect pfnGetSourceRect;
BaseControlVideo_GetStaticImage pfnGetStaticImage;
BaseControlVideo_GetTargetRect pfnGetTargetRect;
BaseControlVideo_SetDefaultSourceRect pfnSetDefaultSourceRect;
BaseControlVideo_SetDefaultTargetRect pfnSetDefaultTargetRect;
BaseControlVideo_SetSourceRect pfnSetSourceRect;
BaseControlVideo_SetTargetRect pfnSetTargetRect;
} BaseControlVideoFuncTable;
void basic_video_init(BaseControlVideo *video, struct strmbase_filter *filter,

View File

@ -207,271 +207,197 @@ static HRESULT WINAPI basic_video_get_VideoHeight(IBasicVideo *iface, LONG *pVid
return S_OK;
}
static HRESULT WINAPI basic_video_put_SourceLeft(IBasicVideo *iface, LONG SourceLeft)
static HRESULT WINAPI basic_video_put_SourceLeft(IBasicVideo *iface, LONG left)
{
RECT SourceRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, SourceLeft);
hr = This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
if (SUCCEEDED(hr))
{
SourceRect.right = (SourceRect.right - SourceRect.left) + SourceLeft;
SourceRect.left = SourceLeft;
hr = BaseControlVideoImpl_CheckSourceRect(This, &SourceRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
TRACE("iface %p, left %d.\n", iface, left);
return hr;
if (left < 0 || This->src.right + left - This->src.left > get_bitmap_header(This)->biWidth)
return E_INVALIDARG;
OffsetRect(&This->src, left - This->src.left, 0);
return S_OK;
}
static HRESULT WINAPI basic_video_get_SourceLeft(IBasicVideo *iface, LONG *pSourceLeft)
{
RECT SourceRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
if (!pSourceLeft)
return E_POINTER;
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
*pSourceLeft = SourceRect.left;
*pSourceLeft = This->src.left;
return S_OK;
}
static HRESULT WINAPI basic_video_put_SourceWidth(IBasicVideo *iface, LONG SourceWidth)
static HRESULT WINAPI basic_video_put_SourceWidth(IBasicVideo *iface, LONG width)
{
RECT SourceRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, SourceWidth);
hr = This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
if (SUCCEEDED(hr))
{
SourceRect.right = SourceRect.left + SourceWidth;
hr = BaseControlVideoImpl_CheckSourceRect(This, &SourceRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
TRACE("iface %p, width %d.\n", iface, width);
return hr;
if (width <= 0 || This->src.left + width > get_bitmap_header(This)->biWidth)
return E_INVALIDARG;
This->src.right = This->src.left + width;
return S_OK;
}
static HRESULT WINAPI basic_video_get_SourceWidth(IBasicVideo *iface, LONG *pSourceWidth)
{
RECT SourceRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
if (!pSourceWidth)
return E_POINTER;
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
*pSourceWidth = SourceRect.right - SourceRect.left;
*pSourceWidth = This->src.right - This->src.left;
return S_OK;
}
static HRESULT WINAPI basic_video_put_SourceTop(IBasicVideo *iface, LONG SourceTop)
static HRESULT WINAPI basic_video_put_SourceTop(IBasicVideo *iface, LONG top)
{
RECT SourceRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, SourceTop);
hr = This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
if (SUCCEEDED(hr))
{
SourceRect.bottom = (SourceRect.bottom - SourceRect.top) + SourceTop;
SourceRect.top = SourceTop;
hr = BaseControlVideoImpl_CheckSourceRect(This, &SourceRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
TRACE("iface %p, top %d.\n", iface, top);
return hr;
if (top < 0 || This->src.bottom + top - This->src.top > get_bitmap_header(This)->biHeight)
return E_INVALIDARG;
OffsetRect(&This->src, 0, top - This->src.top);
return S_OK;
}
static HRESULT WINAPI basic_video_get_SourceTop(IBasicVideo *iface, LONG *pSourceTop)
{
RECT SourceRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
if (!pSourceTop)
return E_POINTER;
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
*pSourceTop = SourceRect.top;
*pSourceTop = This->src.top;
return S_OK;
}
static HRESULT WINAPI basic_video_put_SourceHeight(IBasicVideo *iface, LONG SourceHeight)
static HRESULT WINAPI basic_video_put_SourceHeight(IBasicVideo *iface, LONG height)
{
RECT SourceRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, SourceHeight);
hr = This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
if (SUCCEEDED(hr))
{
SourceRect.bottom = SourceRect.top + SourceHeight;
hr = BaseControlVideoImpl_CheckSourceRect(This, &SourceRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
TRACE("iface %p, height %d.\n", iface, height);
return hr;
if (height <= 0 || This->src.top + height > get_bitmap_header(This)->biHeight)
return E_INVALIDARG;
This->src.bottom = This->src.top + height;
return S_OK;
}
static HRESULT WINAPI basic_video_get_SourceHeight(IBasicVideo *iface, LONG *pSourceHeight)
{
RECT SourceRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
if (!pSourceHeight)
return E_POINTER;
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
*pSourceHeight = SourceRect.bottom - SourceRect.top;
*pSourceHeight = This->src.bottom - This->src.top;
return S_OK;
}
static HRESULT WINAPI basic_video_put_DestinationLeft(IBasicVideo *iface, LONG DestinationLeft)
static HRESULT WINAPI basic_video_put_DestinationLeft(IBasicVideo *iface, LONG left)
{
RECT DestRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationLeft);
hr = This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
if (SUCCEEDED(hr))
{
DestRect.right = (DestRect.right - DestRect.left) + DestinationLeft;
DestRect.left = DestinationLeft;
hr = BaseControlVideoImpl_CheckTargetRect(This, &DestRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
TRACE("iface %p, left %d.\n", iface, left);
return hr;
OffsetRect(&This->dst, left - This->dst.left, 0);
return S_OK;
}
static HRESULT WINAPI basic_video_get_DestinationLeft(IBasicVideo *iface, LONG *pDestinationLeft)
{
RECT DestRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
if (!pDestinationLeft)
return E_POINTER;
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
*pDestinationLeft = DestRect.left;
*pDestinationLeft = This->dst.left;
return S_OK;
}
static HRESULT WINAPI basic_video_put_DestinationWidth(IBasicVideo *iface, LONG DestinationWidth)
static HRESULT WINAPI basic_video_put_DestinationWidth(IBasicVideo *iface, LONG width)
{
RECT DestRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationWidth);
hr = This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
if (SUCCEEDED(hr))
{
DestRect.right = DestRect.left + DestinationWidth;
hr = BaseControlVideoImpl_CheckTargetRect(This, &DestRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
TRACE("iface %p, width %d.\n", iface, width);
return hr;
if (width <= 0)
return E_INVALIDARG;
This->dst.right = This->dst.left + width;
return S_OK;
}
static HRESULT WINAPI basic_video_get_DestinationWidth(IBasicVideo *iface, LONG *pDestinationWidth)
{
RECT DestRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
if (!pDestinationWidth)
return E_POINTER;
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
*pDestinationWidth = DestRect.right - DestRect.left;
*pDestinationWidth = This->dst.right - This->dst.left;
return S_OK;
}
static HRESULT WINAPI basic_video_put_DestinationTop(IBasicVideo *iface, LONG DestinationTop)
static HRESULT WINAPI basic_video_put_DestinationTop(IBasicVideo *iface, LONG top)
{
RECT DestRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationTop);
hr = This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
if (SUCCEEDED(hr))
{
DestRect.bottom = (DestRect.bottom - DestRect.top) + DestinationTop;
DestRect.top = DestinationTop;
hr = BaseControlVideoImpl_CheckTargetRect(This, &DestRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
TRACE("iface %p, top %d.\n", iface, top);
return hr;
OffsetRect(&This->dst, 0, top - This->dst.top);
return S_OK;
}
static HRESULT WINAPI basic_video_get_DestinationTop(IBasicVideo *iface, LONG *pDestinationTop)
{
RECT DestRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
if (!pDestinationTop)
return E_POINTER;
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
*pDestinationTop = DestRect.top;
*pDestinationTop = This->dst.top;
return S_OK;
}
static HRESULT WINAPI basic_video_put_DestinationHeight(IBasicVideo *iface, LONG DestinationHeight)
static HRESULT WINAPI basic_video_put_DestinationHeight(IBasicVideo *iface, LONG height)
{
RECT DestRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationHeight);
hr = This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
if (SUCCEEDED(hr))
{
DestRect.bottom = DestRect.top + DestinationHeight;
hr = BaseControlVideoImpl_CheckTargetRect(This, &DestRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
TRACE("iface %p, height %d.\n", iface, height);
return hr;
if (height <= 0)
return E_INVALIDARG;
This->dst.bottom = This->dst.top + height;
return S_OK;
}
static HRESULT WINAPI basic_video_get_DestinationHeight(IBasicVideo *iface, LONG *pDestinationHeight)
{
RECT DestRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
if (!pDestinationHeight)
return E_POINTER;
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
*pDestinationHeight = DestRect.bottom - DestRect.top;
*pDestinationHeight = This->dst.bottom - This->dst.top;
return S_OK;
}
@ -486,23 +412,22 @@ static HRESULT WINAPI basic_video_SetSourcePosition(IBasicVideo *iface, LONG Lef
SetRect(&SourceRect, Left, Top, Left + Width, Top + Height);
if (FAILED(BaseControlVideoImpl_CheckSourceRect(This, &SourceRect)))
return E_INVALIDARG;
return This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
This->src = SourceRect;
return S_OK;
}
static HRESULT WINAPI basic_video_GetSourcePosition(IBasicVideo *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight)
{
RECT SourceRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
if (!pLeft || !pTop || !pWidth || !pHeight)
return E_POINTER;
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
*pLeft = SourceRect.left;
*pTop = SourceRect.top;
*pWidth = SourceRect.right - SourceRect.left;
*pHeight = SourceRect.bottom - SourceRect.top;
*pLeft = This->src.left;
*pTop = This->src.top;
*pWidth = This->src.right - This->src.left;
*pHeight = This->src.bottom - This->src.top;
return S_OK;
}
@ -525,23 +450,22 @@ static HRESULT WINAPI basic_video_SetDestinationPosition(IBasicVideo *iface, LON
SetRect(&DestRect, Left, Top, Left + Width, Top + Height);
if (FAILED(BaseControlVideoImpl_CheckTargetRect(This, &DestRect)))
return E_INVALIDARG;
return This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
This->dst = DestRect;
return S_OK;
}
static HRESULT WINAPI basic_video_GetDestinationPosition(IBasicVideo *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight)
{
RECT DestRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
if (!pLeft || !pTop || !pWidth || !pHeight)
return E_POINTER;
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
*pLeft = DestRect.left;
*pTop = DestRect.top;
*pWidth = DestRect.right - DestRect.left;
*pHeight = DestRect.bottom - DestRect.top;
*pLeft = This->dst.left;
*pTop = This->dst.top;
*pWidth = This->dst.right - This->dst.left;
*pHeight = This->dst.bottom - This->dst.top;
return S_OK;
}

View File

@ -44,8 +44,6 @@ struct video_renderer
IOverlay IOverlay_iface;
RECT SourceRect;
RECT DestRect;
LONG VideoWidth;
LONG VideoHeight;
LONG FullScreenMode;
@ -102,6 +100,7 @@ static HRESULT WINAPI VideoRenderer_ShouldDrawSampleNow(struct strmbase_renderer
static HRESULT WINAPI VideoRenderer_DoRenderSample(struct strmbase_renderer *iface, IMediaSample *pSample)
{
struct video_renderer *filter = impl_from_strmbase_renderer(iface);
RECT src = filter->baseControlVideo.src, dst = filter->baseControlVideo.dst;
LPBYTE pbSrcStream = NULL;
HRESULT hr;
HDC dc;
@ -116,13 +115,9 @@ static HRESULT WINAPI VideoRenderer_DoRenderSample(struct strmbase_renderer *ifa
}
dc = GetDC(filter->window.hwnd);
StretchDIBits(dc, filter->DestRect.left, filter->DestRect.top,
filter->DestRect.right - filter->DestRect.left,
filter->DestRect.bottom - filter->DestRect.top,
filter->SourceRect.left, filter->SourceRect.top,
filter->SourceRect.right - filter->SourceRect.left,
filter->SourceRect.bottom - filter->SourceRect.top,
pbSrcStream, (BITMAPINFO *)get_bitmap_header(&filter->renderer.sink.pin.mt), DIB_RGB_COLORS, SRCCOPY);
StretchDIBits(dc, dst.left, dst.top, dst.right - dst.left, dst.bottom - dst.top,
src.left, src.top, src.right - src.left, src.bottom - src.top, pbSrcStream,
(BITMAPINFO *)get_bitmap_header(&filter->renderer.sink.pin.mt), DIB_RGB_COLORS, SRCCOPY);
ReleaseDC(filter->window.hwnd, dc);
if (filter->renderer.filter.state == State_Paused)
@ -236,7 +231,7 @@ static HRESULT video_renderer_connect(struct strmbase_renderer *iface, const AM_
filter->VideoWidth = bitmap_header->biWidth;
filter->VideoHeight = abs(bitmap_header->biHeight);
SetRect(&rect, 0, 0, filter->VideoWidth, filter->VideoHeight);
filter->SourceRect = filter->DestRect = rect;
filter->baseControlVideo.src = filter->baseControlVideo.dst = rect;
AdjustWindowRectEx(&rect, GetWindowLongW(window, GWL_STYLE), FALSE,
GetWindowLongW(window, GWL_EXSTYLE));
@ -258,15 +253,10 @@ static RECT video_renderer_get_default_rect(struct video_window *iface)
static BOOL video_renderer_resize(struct video_window *iface, LONG Width, LONG Height)
{
struct video_renderer *This = impl_from_video_window(iface);
struct video_renderer *filter = impl_from_video_window(iface);
TRACE("WM_SIZE %d %d\n", Width, Height);
GetClientRect(iface->hwnd, &This->DestRect);
TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
This->DestRect.left,
This->DestRect.top,
This->DestRect.right - This->DestRect.left,
This->DestRect.bottom - This->DestRect.top);
GetClientRect(iface->hwnd, &filter->baseControlVideo.dst);
return TRUE;
}
@ -291,13 +281,6 @@ static const struct video_window_ops window_ops =
.resize = video_renderer_resize,
};
static HRESULT WINAPI VideoRenderer_GetSourceRect(BaseControlVideo* iface, RECT *pSourceRect)
{
struct video_renderer *This = impl_from_BaseControlVideo(iface);
CopyRect(pSourceRect,&This->SourceRect);
return S_OK;
}
static HRESULT WINAPI VideoRenderer_GetStaticImage(BaseControlVideo *iface, LONG *size, LONG *image)
{
struct video_renderer *filter = impl_from_BaseControlVideo(iface);
@ -345,18 +328,11 @@ static HRESULT WINAPI VideoRenderer_GetStaticImage(BaseControlVideo *iface, LONG
return S_OK;
}
static HRESULT WINAPI VideoRenderer_GetTargetRect(BaseControlVideo* iface, RECT *pTargetRect)
{
struct video_renderer *This = impl_from_BaseControlVideo(iface);
CopyRect(pTargetRect,&This->DestRect);
return S_OK;
}
static HRESULT WINAPI VideoRenderer_SetDefaultSourceRect(BaseControlVideo* iface)
{
struct video_renderer *This = impl_from_BaseControlVideo(iface);
SetRect(&This->SourceRect, 0, 0, This->VideoWidth, This->VideoHeight);
SetRect(&This->baseControlVideo.src, 0, 0, This->VideoWidth, This->VideoHeight);
return S_OK;
}
@ -369,33 +345,15 @@ static HRESULT WINAPI VideoRenderer_SetDefaultTargetRect(BaseControlVideo* iface
if (!GetClientRect(This->window.hwnd, &rect))
return E_FAIL;
SetRect(&This->DestRect, 0, 0, rect.right, rect.bottom);
SetRect(&This->baseControlVideo.dst, 0, 0, rect.right, rect.bottom);
return S_OK;
}
static HRESULT WINAPI VideoRenderer_SetSourceRect(BaseControlVideo* iface, RECT *pSourceRect)
{
struct video_renderer *This = impl_from_BaseControlVideo(iface);
CopyRect(&This->SourceRect,pSourceRect);
return S_OK;
}
static HRESULT WINAPI VideoRenderer_SetTargetRect(BaseControlVideo* iface, RECT *pTargetRect)
{
struct video_renderer *This = impl_from_BaseControlVideo(iface);
CopyRect(&This->DestRect,pTargetRect);
return S_OK;
}
static const BaseControlVideoFuncTable renderer_BaseControlVideoFuncTable = {
VideoRenderer_GetSourceRect,
VideoRenderer_GetStaticImage,
VideoRenderer_GetTargetRect,
VideoRenderer_SetDefaultSourceRect,
VideoRenderer_SetDefaultTargetRect,
VideoRenderer_SetSourceRect,
VideoRenderer_SetTargetRect
};
static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface,
@ -428,16 +386,16 @@ static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface, LONG f
SetWindowLongW(window, GWL_STYLE, WS_POPUP);
SetWindowPos(window, HWND_TOP, 0, 0,
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_SHOWWINDOW);
GetWindowRect(window, &filter->DestRect);
GetWindowRect(window, &filter->baseControlVideo.dst);
}
else
{
ShowWindow(window, SW_HIDE);
SetParent(window, filter->window.hwndOwner);
SetWindowLongW(window, GWL_STYLE, filter->saved_style);
GetClientRect(window, &filter->DestRect);
SetWindowPos(window, 0, filter->DestRect.left, filter->DestRect.top,
filter->DestRect.right, filter->DestRect.bottom, SWP_NOZORDER | SWP_SHOWWINDOW);
GetClientRect(window, &filter->baseControlVideo.dst);
SetWindowPos(window, 0, filter->baseControlVideo.dst.left, filter->baseControlVideo.dst.top,
filter->baseControlVideo.dst.right, filter->baseControlVideo.dst.bottom, SWP_NOZORDER | SWP_SHOWWINDOW);
}
filter->FullScreenMode = fullscreen;

View File

@ -104,8 +104,6 @@ struct quartz_vmr
/* for Windowless Mode */
HWND hWndClippingWindow;
RECT source_rect;
RECT target_rect;
LONG VideoWidth;
LONG VideoHeight;
@ -229,9 +227,6 @@ static DWORD VMR9_SendSampleData(struct quartz_vmr *This, VMR9PresentationInfo *
width = bmiHeader->biWidth;
height = bmiHeader->biHeight;
TRACE("Src Rect: %s\n", wine_dbgstr_rect(&This->source_rect));
TRACE("Dst Rect: %s\n", wine_dbgstr_rect(&This->target_rect));
hr = IDirect3DSurface9_LockRect(info->lpSurf, &lock, NULL, D3DLOCK_DISCARD);
if (FAILED(hr))
{
@ -420,8 +415,8 @@ static HRESULT allocate_surfaces(struct quartz_vmr *filter, const AM_MEDIA_TYPE
if (filter->mode == VMR9Mode_Windowless && !filter->hWndClippingWindow)
return S_OK;
info.dwWidth = filter->source_rect.right;
info.dwHeight = filter->source_rect.bottom;
info.dwWidth = filter->baseControlVideo.src.right;
info.dwHeight = filter->baseControlVideo.src.bottom;
info.Pool = D3DPOOL_DEFAULT;
info.MinBuffers = 1;
info.szAspectRatio.cx = info.dwWidth;
@ -517,7 +512,7 @@ static HRESULT vmr_connect(struct strmbase_renderer *iface, const AM_MEDIA_TYPE
filter->VideoWidth = bitmap_header->biWidth;
filter->VideoHeight = bitmap_header->biHeight;
SetRect(&rect, 0, 0, filter->VideoWidth, filter->VideoHeight);
filter->source_rect = filter->target_rect = rect;
filter->baseControlVideo.src = filter->baseControlVideo.dst = rect;
AdjustWindowRectEx(&rect, GetWindowLongW(window, GWL_STYLE), FALSE,
GetWindowLongW(window, GWL_EXSTYLE));
@ -679,12 +674,7 @@ static BOOL vmr_resize(struct video_window *This, LONG Width, LONG Height)
struct quartz_vmr *pVMR9 = impl_from_video_window(This);
TRACE("WM_SIZE %d %d\n", Width, Height);
GetClientRect(This->hwnd, &pVMR9->target_rect);
TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
pVMR9->target_rect.left,
pVMR9->target_rect.top,
pVMR9->target_rect.right - pVMR9->target_rect.left,
pVMR9->target_rect.bottom - pVMR9->target_rect.top);
GetClientRect(This->hwnd, &pVMR9->baseControlVideo.dst);
return TRUE;
}
@ -695,13 +685,6 @@ static const struct video_window_ops window_ops =
.resize = vmr_resize,
};
static HRESULT WINAPI VMR9_GetSourceRect(BaseControlVideo* This, RECT *pSourceRect)
{
struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This);
CopyRect(pSourceRect,&pVMR9->source_rect);
return S_OK;
}
static HRESULT WINAPI VMR9_GetStaticImage(BaseControlVideo *iface, LONG *size, LONG *image)
{
struct quartz_vmr *filter = impl_from_BaseControlVideo(iface);
@ -765,18 +748,11 @@ out:
return hr;
}
static HRESULT WINAPI VMR9_GetTargetRect(BaseControlVideo* This, RECT *pTargetRect)
{
struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This);
CopyRect(pTargetRect,&pVMR9->target_rect);
return S_OK;
}
static HRESULT WINAPI VMR9_SetDefaultSourceRect(BaseControlVideo* This)
{
struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This);
SetRect(&pVMR9->source_rect, 0, 0, pVMR9->VideoWidth, pVMR9->VideoHeight);
SetRect(&pVMR9->baseControlVideo.src, 0, 0, pVMR9->VideoWidth, pVMR9->VideoHeight);
return S_OK;
}
@ -789,33 +765,15 @@ static HRESULT WINAPI VMR9_SetDefaultTargetRect(BaseControlVideo* This)
if (!GetClientRect(pVMR9->window.hwnd, &rect))
return E_FAIL;
SetRect(&pVMR9->target_rect, 0, 0, rect.right, rect.bottom);
SetRect(&pVMR9->baseControlVideo.dst, 0, 0, rect.right, rect.bottom);
return S_OK;
}
static HRESULT WINAPI VMR9_SetSourceRect(BaseControlVideo* This, RECT *pSourceRect)
{
struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This);
CopyRect(&pVMR9->source_rect,pSourceRect);
return S_OK;
}
static HRESULT WINAPI VMR9_SetTargetRect(BaseControlVideo* This, RECT *pTargetRect)
{
struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This);
CopyRect(&pVMR9->target_rect,pTargetRect);
return S_OK;
}
static const BaseControlVideoFuncTable renderer_BaseControlVideoFuncTable = {
VMR9_GetSourceRect,
VMR9_GetStaticImage,
VMR9_GetTargetRect,
VMR9_SetDefaultSourceRect,
VMR9_SetDefaultTargetRect,
VMR9_SetSourceRect,
VMR9_SetTargetRect
};
static const IVideoWindowVtbl IVideoWindow_VTable =
@ -1552,10 +1510,10 @@ static HRESULT WINAPI VMR7WindowlessControl_SetVideoPosition(IVMRWindowlessContr
EnterCriticalSection(&This->renderer.filter.csFilter);
if (source)
This->source_rect = *source;
This->baseControlVideo.src = *source;
if (dest)
{
This->target_rect = *dest;
This->baseControlVideo.dst = *dest;
FIXME("Output rectangle: %s.\n", wine_dbgstr_rect(dest));
SetWindowPos(This->window.hwnd, NULL,
dest->left, dest->top, dest->right - dest->left, dest->bottom-dest->top,
@ -1573,10 +1531,10 @@ static HRESULT WINAPI VMR7WindowlessControl_GetVideoPosition(IVMRWindowlessContr
struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface);
if (source)
*source = This->source_rect;
*source = This->baseControlVideo.src;
if (dest)
*dest = This->target_rect;
*dest = This->baseControlVideo.dst;
FIXME("(%p/%p)->(%p/%p) stub\n", iface, This, source, dest);
return S_OK;
@ -1753,10 +1711,10 @@ static HRESULT WINAPI VMR9WindowlessControl_SetVideoPosition(IVMRWindowlessContr
EnterCriticalSection(&This->renderer.filter.csFilter);
if (source)
This->source_rect = *source;
This->baseControlVideo.src = *source;
if (dest)
{
This->target_rect = *dest;
This->baseControlVideo.dst = *dest;
FIXME("Output rectangle: %s.\n", wine_dbgstr_rect(dest));
SetWindowPos(This->window.hwnd, NULL,
dest->left, dest->top, dest->right - dest->left, dest->bottom - dest->top,
@ -1773,10 +1731,10 @@ static HRESULT WINAPI VMR9WindowlessControl_GetVideoPosition(IVMRWindowlessContr
struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface);
if (source)
*source = This->source_rect;
*source = This->baseControlVideo.src;
if (dest)
*dest = This->target_rect;
*dest = This->baseControlVideo.dst;
FIXME("(%p/%p)->(%p/%p) stub\n", iface, This, source, dest);
return S_OK;
@ -2561,10 +2519,11 @@ static HRESULT VMR9_ImagePresenter_PresentOffscreenSurface(struct default_presen
}
/* Move rect to origin and flip it */
SetRect(&target_rect, 0, This->pVMR9->target_rect.bottom - This->pVMR9->target_rect.top,
This->pVMR9->target_rect.right - This->pVMR9->target_rect.left, 0);
SetRect(&target_rect, 0, This->pVMR9->baseControlVideo.dst.bottom - This->pVMR9->baseControlVideo.dst.top,
This->pVMR9->baseControlVideo.dst.right - This->pVMR9->baseControlVideo.dst.left, 0);
hr = IDirect3DDevice9_StretchRect(This->d3d9_dev, surface, &This->pVMR9->source_rect, target, &target_rect, D3DTEXF_LINEAR);
hr = IDirect3DDevice9_StretchRect(This->d3d9_dev, surface,
&This->pVMR9->baseControlVideo.src, target, &target_rect, D3DTEXF_LINEAR);
if (FAILED(hr))
ERR("IDirect3DDevice9_StretchRect -- %08x\n", hr);
IDirect3DSurface9_Release(target);
@ -2736,8 +2695,8 @@ static BOOL CreateRenderingWindow(struct default_presenter *This, VMR9Allocation
d3dpp.Windowed = TRUE;
d3dpp.hDeviceWindow = This->pVMR9->window.hwnd;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferHeight = This->pVMR9->target_rect.bottom - This->pVMR9->target_rect.top;
d3dpp.BackBufferWidth = This->pVMR9->target_rect.right - This->pVMR9->target_rect.left;
d3dpp.BackBufferHeight = This->pVMR9->baseControlVideo.dst.bottom - This->pVMR9->baseControlVideo.dst.top;
d3dpp.BackBufferWidth = This->pVMR9->baseControlVideo.dst.right - This->pVMR9->baseControlVideo.dst.left;
hr = IDirect3D9_CreateDevice(This->d3d9_ptr, d3d9_adapter, D3DDEVTYPE_HAL, NULL, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &This->d3d9_dev);
if (FAILED(hr))
@ -2872,24 +2831,24 @@ static HRESULT VMR9_SurfaceAllocator_UpdateDeviceReset(struct default_presenter
{
if (i % 2)
{
t_vert[i].x = (float)This->pVMR9->target_rect.right - (float)This->pVMR9->target_rect.left - 0.5f;
t_vert[i].u = (float)This->pVMR9->source_rect.right / (float)width;
t_vert[i].x = (float)This->pVMR9->baseControlVideo.dst.right - (float)This->pVMR9->baseControlVideo.dst.left - 0.5f;
t_vert[i].u = (float)This->pVMR9->baseControlVideo.src.right / (float)width;
}
else
{
t_vert[i].x = -0.5f;
t_vert[i].u = (float)This->pVMR9->source_rect.left / (float)width;
t_vert[i].u = (float)This->pVMR9->baseControlVideo.src.left / (float)width;
}
if (i % 4 < 2)
{
t_vert[i].y = -0.5f;
t_vert[i].v = (float)This->pVMR9->source_rect.bottom / (float)height;
t_vert[i].v = (float)This->pVMR9->baseControlVideo.src.bottom / (float)height;
}
else
{
t_vert[i].y = (float)This->pVMR9->target_rect.bottom - (float)This->pVMR9->target_rect.top - 0.5f;
t_vert[i].v = (float)This->pVMR9->source_rect.top / (float)height;
t_vert[i].y = (float)This->pVMR9->baseControlVideo.dst.bottom - (float)This->pVMR9->baseControlVideo.dst.top - 0.5f;
t_vert[i].v = (float)This->pVMR9->baseControlVideo.src.top / (float)height;
}
t_vert[i].z = 0.0f;
t_vert[i].rhw = 1.0f;