From d49adfcf595fa4c99bfe1c486401db2e768107e1 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 8 May 2019 15:35:07 +0200 Subject: [PATCH] Fixed warnings and cleaned up gfx related xfreerdp code. --- client/X11/xf_channels.c | 5 +---- client/X11/xf_gfx.h | 11 ----------- libfreerdp/codec/h264.c | 6 +++++- libfreerdp/gdi/gfx.c | 16 ++++++++-------- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/client/X11/xf_channels.c b/client/X11/xf_channels.c index 228c7c366..b9adf9ace 100644 --- a/client/X11/xf_channels.c +++ b/client/X11/xf_channels.c @@ -73,10 +73,7 @@ void xf_OnChannelConnectedEventHandler(void* context, ChannelConnectedEventArgs* } else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0) { - if (settings->SoftwareGdi) - gdi_video_control_init(xfc->context.gdi, (VideoClientContext*)e->pInterface); - else - xf_video_control_init(xfc, (VideoClientContext*)e->pInterface); + xf_video_control_init(xfc, (VideoClientContext*)e->pInterface); } else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0) { diff --git a/client/X11/xf_gfx.h b/client/X11/xf_gfx.h index 8c6f56a8f..ecca7994e 100644 --- a/client/X11/xf_gfx.h +++ b/client/X11/xf_gfx.h @@ -36,17 +36,6 @@ struct xf_gfx_surface }; typedef struct xf_gfx_surface xfGfxSurface; -struct xf_gfx_cache_entry -{ - UINT64 cacheKey; - UINT32 width; - UINT32 height; - BYTE* data; - UINT32 scanline; - UINT32 format; -}; -typedef struct xf_gfx_cache_entry xfGfxCacheEntry; - UINT xf_OutputExpose(xfContext* xfc, UINT32 x, UINT32 y, UINT32 width, UINT32 height); diff --git a/libfreerdp/codec/h264.c b/libfreerdp/codec/h264.c index 7fb8d81c0..f91a6f3c1 100644 --- a/libfreerdp/codec/h264.c +++ b/libfreerdp/codec/h264.c @@ -298,7 +298,11 @@ static BOOL avc444_ensure_buffer(H264_CONTEXT* h264, UINT32* piDstSize = h264->iYUV444Size; UINT32* piDstStride = h264->iYUV444Stride; BYTE** ppYUVDstData = h264->pYUV444Data; - UINT32 padDstHeight = nDstHeight + 16; /* Need alignment to 16x16 blocks */ + const UINT32 pad = nDstHeight % 16; + UINT32 padDstHeight = nDstHeight; /* Need alignment to 16x16 blocks */ + + if (pad != 0) + padDstHeight += 16 - pad; if ((piMainStride[0] != piDstStride[0]) || (piDstSize[0] != piMainStride[0] * padDstHeight)) diff --git a/libfreerdp/gdi/gfx.c b/libfreerdp/gdi/gfx.c index ef3188880..89d83fce4 100644 --- a/libfreerdp/gdi/gfx.c +++ b/libfreerdp/gdi/gfx.c @@ -133,12 +133,12 @@ static UINT gdi_OutputUpdate(rdpGdi* gdi, gdiGfxSurface* surface) { const UINT32 nXSrc = rects[i].left; const UINT32 nYSrc = rects[i].top; - const UINT32 nXDst = surfaceX + nXSrc * sx; - const UINT32 nYDst = surfaceY + nYSrc * sy; + const UINT32 nXDst = (UINT32)(surfaceX + nXSrc * sx); + const UINT32 nYDst = (UINT32)(surfaceY + nYSrc * sy); const UINT32 swidth = rects[i].right - rects[i].left; const UINT32 sheight = rects[i].bottom - rects[i].top; - const UINT32 dwidth = swidth * sx; - const UINT32 dheight = sheight * sy; + const UINT32 dwidth = (UINT32)(swidth * sx); + const UINT32 dheight = (UINT32)(sheight * sy); if (!freerdp_image_scale(gdi->primary_buffer, gdi->dstFormat, gdi->stride, nXDst, nYDst, dwidth, dheight, @@ -146,7 +146,7 @@ static UINT gdi_OutputUpdate(rdpGdi* gdi, gdiGfxSurface* surface) surface->scanline, nXSrc, nYSrc, swidth, sheight)) return CHANNEL_RC_NULL_DATA; - gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, dwidth, dheight); + gdi_InvalidateRegion(gdi->primary->hdc, (INT32)nXDst, (INT32)nYDst, (INT32)dwidth, (INT32)dheight); } rc = CHANNEL_RC_OK; @@ -189,10 +189,10 @@ static UINT gdi_UpdateSurfaces(RdpgfxClientContext* context) continue; } - status = ERROR_INTERNAL_ERROR; + if (!surface->outputMapped) + continue; - if (surface->outputMapped) - status = gdi_OutputUpdate(gdi, surface); + status = gdi_OutputUpdate(gdi, surface); if (status != CHANNEL_RC_OK) break;