xvmc: use a pipe_video_rect for subpicture src & dst
authorChristian König <deathsimple@vodafone.de>
Wed, 13 Apr 2011 17:32:49 +0000 (19:32 +0200)
committerChristian König <deathsimple@vodafone.de>
Wed, 13 Apr 2011 17:32:49 +0000 (19:32 +0200)
src/gallium/state_trackers/xorg/xvmc/subpicture.c
src/gallium/state_trackers/xorg/xvmc/surface.c
src/gallium/state_trackers/xorg/xvmc/xvmc_private.h

index 31b1a96512fb519b6f0ab44180bde44fde4d3247..68519c08885d74ad81a37e7e06127b443c8bd5e2 100644 (file)
@@ -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;
index c8c8638e581e714a2cf76ff3dbf8d528e436fbfa..f22d315c90dfa2e6f8f61d94b759d9317db72ab4 100644 (file)
@@ -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);
 
index b902d7d28179a0b78a916caa2cad31d63b6fd07f..056bdfc2f3c00d8f93ca2b4b379ccecec874cec9 100644 (file)
@@ -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;