From f96aab3f2281b230e72c8346d40a1b35c3cb7873 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Wed, 13 Apr 2016 13:45:54 +0200 Subject: [PATCH] quartz: Use SetRect instead of open coding it. Signed-off-by: Michael Stefaniuc Signed-off-by: Alexandre Julliard --- dlls/quartz/videorenderer.c | 14 +++----------- dlls/quartz/vmr9.c | 30 ++++++++++-------------------- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index 7bc26201ff2..3026c0732ef 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -430,9 +430,7 @@ static RECT WINAPI VideoRenderer_GetDefaultRect(BaseWindow *iface) VideoRendererImpl *This = impl_from_BaseWindow(iface); static RECT defRect; - defRect.left = defRect.top = 0; - defRect.right = This->VideoWidth; - defRect.bottom = This->VideoHeight; + SetRect(&defRect, 0, 0, This->VideoWidth, This->VideoHeight); return defRect; } @@ -596,10 +594,7 @@ static HRESULT WINAPI VideoRenderer_SetDefaultSourceRect(BaseControlVideo* iface { VideoRendererImpl *This = impl_from_BaseControlVideo(iface); - This->SourceRect.left = 0; - This->SourceRect.top = 0; - This->SourceRect.right = This->VideoWidth; - This->SourceRect.bottom = This->VideoHeight; + SetRect(&This->SourceRect, 0, 0, This->VideoWidth, This->VideoHeight); return S_OK; } @@ -612,10 +607,7 @@ static HRESULT WINAPI VideoRenderer_SetDefaultTargetRect(BaseControlVideo* iface if (!GetClientRect(This->baseControlWindow.baseWindow.hWnd, &rect)) return E_FAIL; - This->DestRect.left = 0; - This->DestRect.top = 0; - This->DestRect.right = rect.right; - This->DestRect.bottom = rect.bottom; + SetRect(&This->DestRect, 0, 0, rect.right, rect.bottom); return S_OK; } diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 3538ddb1fe8..03b411508ed 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -353,9 +353,9 @@ static HRESULT WINAPI VMR9_CheckMediaType(BaseRenderer *iface, const AM_MEDIA_TY This->bmiheader = format->bmiHeader; TRACE("Resolution: %dx%d\n", format->bmiHeader.biWidth, format->bmiHeader.biHeight); - This->source_rect.right = This->VideoWidth = format->bmiHeader.biWidth; - This->source_rect.bottom = This->VideoHeight = format->bmiHeader.biHeight; - This->source_rect.top = This->source_rect.left = 0; + This->VideoWidth = format->bmiHeader.biWidth; + This->VideoHeight = format->bmiHeader.biHeight; + SetRect(&This->source_rect, 0, 0, This->VideoWidth, This->VideoHeight); } else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) { @@ -364,9 +364,9 @@ static HRESULT WINAPI VMR9_CheckMediaType(BaseRenderer *iface, const AM_MEDIA_TY This->bmiheader = format->bmiHeader; TRACE("Resolution: %dx%d\n", format->bmiHeader.biWidth, format->bmiHeader.biHeight); - This->source_rect.right = This->VideoWidth = format->bmiHeader.biWidth; - This->source_rect.bottom = This->VideoHeight = format->bmiHeader.biHeight; - This->source_rect.top = This->source_rect.left = 0; + This->VideoWidth = format->bmiHeader.biWidth; + This->VideoHeight = format->bmiHeader.biHeight; + SetRect(&This->source_rect, 0, 0, This->VideoWidth, This->VideoHeight); } else { @@ -426,9 +426,7 @@ static HRESULT VMR9_maybe_init(struct quartz_vmr *This, BOOL force) hr = IVMRSurfaceAllocatorEx9_InitializeDevice(This->allocator, This->cookie, &info, &buffers); if (SUCCEEDED(hr)) { - This->source_rect.left = This->source_rect.top = 0; - This->source_rect.right = This->bmiheader.biWidth; - This->source_rect.bottom = This->bmiheader.biHeight; + SetRect(&This->source_rect, 0, 0, This->bmiheader.biWidth, This->bmiheader.biHeight); This->num_surfaces = buffers; } @@ -544,9 +542,7 @@ static RECT WINAPI VMR9_GetDefaultRect(BaseWindow *This) struct quartz_vmr* pVMR9 = impl_from_BaseWindow(This); static RECT defRect; - defRect.left = defRect.top = 0; - defRect.right = pVMR9->VideoWidth; - defRect.bottom = pVMR9->VideoHeight; + SetRect(&defRect, 0, 0, pVMR9->VideoWidth, pVMR9->VideoHeight); return defRect; } @@ -688,10 +684,7 @@ static HRESULT WINAPI VMR9_SetDefaultSourceRect(BaseControlVideo* This) { struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This); - pVMR9->source_rect.left = 0; - pVMR9->source_rect.top = 0; - pVMR9->source_rect.right = pVMR9->VideoWidth; - pVMR9->source_rect.bottom = pVMR9->VideoHeight; + SetRect(&pVMR9->source_rect, 0, 0, pVMR9->VideoWidth, pVMR9->VideoHeight); return S_OK; } @@ -704,10 +697,7 @@ static HRESULT WINAPI VMR9_SetDefaultTargetRect(BaseControlVideo* This) if (!GetClientRect(pVMR9->baseControlWindow.baseWindow.hWnd, &rect)) return E_FAIL; - pVMR9->target_rect.left = 0; - pVMR9->target_rect.top = 0; - pVMR9->target_rect.right = rect.right; - pVMR9->target_rect.bottom = rect.bottom; + SetRect(&pVMR9->target_rect, 0, 0, rect.right, rect.bottom); return S_OK; } -- 2.11.4.GIT