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(
51 xfc->display, xfc->visual, WINPR_ASSERTING_INT_CAST(uint32_t, xfc->depth), ZPixmap, 0,
52 (
char*)ret->base.data, width, height, 8, WINPR_ASSERTING_INT_CAST(
int, ret->base.scanline));
56 WLog_ERR(TAG,
"unable to create surface image");
57 VideoClient_DestroyCommonContext(&ret->base);
64 static BOOL xfVideoShowSurface(VideoClientContext* video,
const VideoSurface* surface,
65 UINT32 destinationWidth, UINT32 destinationHeight)
67 const xfVideoSurface* xfSurface = (
const xfVideoSurface*)surface;
68 xfContext* xfc = NULL;
69 const rdpSettings* settings = NULL;
72 WINPR_ASSERT(xfSurface);
77 settings = xfc->common.context.settings;
78 WINPR_ASSERT(settings);
85 XPutImage(xfc->display, xfc->primary, xfc->gc, xfSurface->image, 0, 0,
86 WINPR_ASSERTING_INT_CAST(
int, surface->x),
87 WINPR_ASSERTING_INT_CAST(
int, surface->y), surface->w, surface->h);
88 xf_draw_screen(xfc, WINPR_ASSERTING_INT_CAST(int32_t, surface->x),
89 WINPR_ASSERTING_INT_CAST(int32_t, surface->y),
90 WINPR_ASSERTING_INT_CAST(int32_t, surface->w),
91 WINPR_ASSERTING_INT_CAST(int32_t, surface->h));
96 XPutImage(xfc->display, xfc->drawable, xfc->gc, xfSurface->image, 0, 0,
97 WINPR_ASSERTING_INT_CAST(
int, surface->x),
98 WINPR_ASSERTING_INT_CAST(
int, surface->y), surface->w, surface->h);
104 static BOOL xfVideoDeleteSurface(VideoClientContext* video,
VideoSurface* surface)
106 xfVideoSurface* xfSurface = (xfVideoSurface*)surface;
111 XFree(xfSurface->image);
113 VideoClient_DestroyCommonContext(surface);
117 void xf_video_control_init(xfContext* xfc, VideoClientContext* video)
122 gdi_video_control_init(xfc->common.context.gdi, video);
125 if (xfc->depth >= 24)
128 video->createSurface = xfVideoCreateSurface;
129 video->showSurface = xfVideoShowSurface;
130 video->deleteSurface = xfVideoDeleteSurface;
134 void xf_video_control_uninit(xfContext* xfc, VideoClientContext* video)
137 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