mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-20 02:38:07 +02:00
xvmc: use a pipe_video_rect for subpicture src & dst
This commit is contained in:
parent
c7b65dcaff
commit
efaf024f8c
3 changed files with 13 additions and 16 deletions
|
|
@ -417,6 +417,9 @@ Status XvMCBlendSubpicture(Display *dpy, XvMCSurface *target_surface, XvMCSubpic
|
|||
short subx, short suby, unsigned short subw, unsigned short subh,
|
||||
short surfx, short surfy, unsigned short surfw, unsigned short surfh)
|
||||
{
|
||||
struct pipe_video_rect src_rect = {subx, suby, subw, subh};
|
||||
struct pipe_video_rect dst_rect = {surfx, surfy, surfw, surfh};
|
||||
|
||||
XvMCSurfacePrivate *surface_priv;
|
||||
XvMCSubpicturePrivate *subpicture_priv;
|
||||
|
||||
|
|
@ -439,16 +442,10 @@ Status XvMCBlendSubpicture(Display *dpy, XvMCSurface *target_surface, XvMCSubpic
|
|||
subpicture_priv = subpicture->privData;
|
||||
|
||||
/* TODO: Assert rects are within bounds? Or clip? */
|
||||
subpicture_priv->src_rect = src_rect;
|
||||
subpicture_priv->dst_rect = dst_rect;
|
||||
|
||||
surface_priv->subpicture = subpicture;
|
||||
surface_priv->subx = subx;
|
||||
surface_priv->suby = suby;
|
||||
surface_priv->subw = subw;
|
||||
surface_priv->subh = subh;
|
||||
surface_priv->surfx = surfx;
|
||||
surface_priv->surfy = surfy;
|
||||
surface_priv->surfw = surfw;
|
||||
surface_priv->surfh = surfh;
|
||||
subpicture_priv->surface = target_surface;
|
||||
|
||||
return Success;
|
||||
|
|
|
|||
|
|
@ -431,14 +431,13 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
|
|||
compositor->set_buffer_layer(compositor, 0, surface_priv->video_buffer, &src_rect, NULL);
|
||||
|
||||
if (subpicture_priv) {
|
||||
struct pipe_video_rect src_rect = {surface_priv->subx, surface_priv->suby, surface_priv->subw, surface_priv->subh};
|
||||
struct pipe_video_rect dst_rect = {surface_priv->surfx, surface_priv->surfy, surface_priv->surfw, surface_priv->surfh};
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Surface %p has subpicture %p.\n", surface, surface_priv->subpicture);
|
||||
|
||||
assert(subpicture_priv->surface == surface);
|
||||
|
||||
if (subpicture_priv->palette)
|
||||
compositor->set_palette_layer(compositor, 1, subpicture_priv->sampler, subpicture_priv->palette, &src_rect, &dst_rect);
|
||||
compositor->set_palette_layer(compositor, 1, subpicture_priv->sampler, subpicture_priv->palette,
|
||||
&subpicture_priv->src_rect, &subpicture_priv->dst_rect);
|
||||
else
|
||||
compositor->set_rgba_layer(compositor, 1, subpicture_priv->sampler, &src_rect, &dst_rect);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/XvMClib.h>
|
||||
|
||||
#include <pipe/p_video_state.h>
|
||||
|
||||
#include <util/u_debug.h>
|
||||
#include <util/u_math.h>
|
||||
|
||||
|
|
@ -77,10 +79,6 @@ typedef struct
|
|||
|
||||
/* The subpicture associated with this surface, if any. */
|
||||
XvMCSubpicture *subpicture;
|
||||
short subx, suby;
|
||||
unsigned short subw, subh;
|
||||
short surfx, surfy;
|
||||
unsigned short surfw, surfh;
|
||||
|
||||
/* Some XvMC functions take a surface but not a context,
|
||||
so we keep track of which context each surface belongs to. */
|
||||
|
|
@ -94,6 +92,9 @@ typedef struct
|
|||
/* optional palette for this subpicture */
|
||||
struct pipe_sampler_view *palette;
|
||||
|
||||
struct pipe_video_rect src_rect;
|
||||
struct pipe_video_rect dst_rect;
|
||||
|
||||
/* The surface this subpicture is currently associated with, if any. */
|
||||
XvMCSurface *surface;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue