20 #include <winpr/assert.h>
21 #include <freerdp/client/geometry.h>
22 #include <freerdp/client/video.h>
23 #include <freerdp/gdi/video.h>
27 #include <freerdp/log.h>
28 #define TAG CLIENT_TAG("video")
36 static VideoSurface* xfVideoCreateSurface(VideoClientContext* video, UINT32 x, UINT32 y,
37 UINT32 width, UINT32 height)
39 xfContext* xfc = NULL;
40 xfVideoSurface* ret = NULL;
43 ret = (xfVideoSurface*)VideoClient_CreateCommonContext(
sizeof(xfContext), x, y, width, height);
47 xfc = (xfContext*)video->custom;
50 ret->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
51 (
char*)ret->base.data, width, height, 8, ret->base.scanline);
55 WLog_ERR(TAG,
"unable to create surface image");
56 VideoClient_DestroyCommonContext(&ret->base);
63 static BOOL xfVideoShowSurface(VideoClientContext* video,
const VideoSurface* surface,
64 UINT32 destinationWidth, UINT32 destinationHeight)
66 const xfVideoSurface* xfSurface = (
const xfVideoSurface*)surface;
67 xfContext* xfc = NULL;
68 const rdpSettings* settings = NULL;
71 WINPR_ASSERT(xfSurface);
76 settings = xfc->common.context.settings;
77 WINPR_ASSERT(settings);
84 XPutImage(xfc->display, xfc->primary, xfc->gc, xfSurface->image, 0, 0, surface->x,
85 surface->y, surface->w, surface->h);
86 xf_draw_screen(xfc, surface->x, surface->y, surface->w, surface->h);
91 XPutImage(xfc->display, xfc->drawable, xfc->gc, xfSurface->image, 0, 0, surface->x,
92 surface->y, surface->w, surface->h);
98 static BOOL xfVideoDeleteSurface(VideoClientContext* video,
VideoSurface* surface)
100 xfVideoSurface* xfSurface = (xfVideoSurface*)surface;
105 XFree(xfSurface->image);
107 VideoClient_DestroyCommonContext(surface);
111 void xf_video_control_init(xfContext* xfc, VideoClientContext* video)
116 gdi_video_control_init(xfc->common.context.gdi, video);
119 if (xfc->depth >= 24)
122 video->createSurface = xfVideoCreateSurface;
123 video->showSurface = xfVideoShowSurface;
124 video->deleteSurface = xfVideoDeleteSurface;
128 void xf_video_control_uninit(xfContext* xfc, VideoClientContext* video)
131 gdi_video_control_uninit(xfc->common.context.gdi, video);
FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.
an implementation of surface used by the video channel