Fixed scaled drawing of video content.
This commit is contained in:
parent
73bef4ca23
commit
11f11a8763
@ -35,6 +35,7 @@ typedef struct
|
||||
void xf_video_geometry_init(xfContext* xfc, GeometryClientContext* geom)
|
||||
{
|
||||
xfc->geometry = geom;
|
||||
|
||||
if (xfc->video)
|
||||
{
|
||||
VideoClientContext* video = xfc->video;
|
||||
@ -47,6 +48,7 @@ static VideoSurface *xfVideoCreateSurface(VideoClientContext *video, BYTE *data,
|
||||
{
|
||||
xfContext* xfc = (xfContext*)video->custom;
|
||||
xfVideoSurface* ret = calloc(1, sizeof(*ret));
|
||||
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
@ -55,15 +57,16 @@ static VideoSurface *xfVideoCreateSurface(VideoClientContext *video, BYTE *data,
|
||||
ret->base.y = y;
|
||||
ret->base.w = width;
|
||||
ret->base.h = height;
|
||||
|
||||
ret->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*)data, width, height, 8, width * 4);
|
||||
|
||||
if (!ret->image)
|
||||
{
|
||||
WLog_ERR(TAG, "unable to create surface image");
|
||||
free(ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &ret->base;
|
||||
}
|
||||
|
||||
@ -71,10 +74,23 @@ static VideoSurface *xfVideoCreateSurface(VideoClientContext *video, BYTE *data,
|
||||
static BOOL xfVideoShowSurface(VideoClientContext* video, xfVideoSurface* surface)
|
||||
{
|
||||
xfContext* xfc = video->custom;
|
||||
#ifdef WITH_XRENDER
|
||||
|
||||
if (xfc->context.settings->SmartSizing
|
||||
|| xfc->context.settings->MultiTouchGestures)
|
||||
{
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, surface->image,
|
||||
0, 0, surface->base.x, surface->base.y, surface->base.w, surface->base.h);
|
||||
xf_draw_screen(xfc, surface->base.x, surface->base.y, surface->base.w, surface->base.h);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
XPutImage(xfc->display, xfc->drawable, xfc->gc, surface->image,
|
||||
0, 0,
|
||||
surface->base.x, surface->base.y, surface->base.w, surface->base.h);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -82,14 +98,12 @@ static BOOL xfVideoDeleteSurface(VideoClientContext *video, xfVideoSurface *surf
|
||||
{
|
||||
XFree(surface->image);
|
||||
free(surface);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
void xf_video_control_init(xfContext* xfc, VideoClientContext* video)
|
||||
{
|
||||
xfc->video = video;
|
||||
video->custom = xfc;
|
||||
|
||||
video->createSurface = xfVideoCreateSurface;
|
||||
video->showSurface = (pcVideoShowSurface)xfVideoShowSurface;
|
||||
video->deleteSurface = (pcVideoDeleteSurface)xfVideoDeleteSurface;
|
||||
|
Loading…
Reference in New Issue
Block a user