[Spice-devel] [PATCH 18/18] display: factor out current_find_intersects_rect

Frediano Ziglio fziglio at redhat.com
Tue Nov 24 02:10:26 PST 2015


> 
> On Mon, Nov 23, 2015 at 6:02 PM, Frediano Ziglio <fziglio at redhat.com> wrote:
> > From: Marc-André Lureau <marcandre.lureau at gmail.com>
> >
> > ---
> >  server/display-channel.c | 51
> >  ++++++++++++++++++++++++++++--------------------
> >  1 file changed, 30 insertions(+), 21 deletions(-)
> >
> > diff --git a/server/display-channel.c b/server/display-channel.c
> > index a78f86a..ab70947 100644
> > --- a/server/display-channel.c
> > +++ b/server/display-channel.c
> > @@ -1299,6 +1299,30 @@ static void draw_until(DisplayChannel *display,
> > RedSurface *surface, Drawable *l
> >      } while (now != last);
> >  }
> >
> > +static Drawable* current_find_intersects_rect(Ring *current, const
> > SpiceRect *area)
> > +{
> > +    Ring *ring;
> > +    RingItem *ring_item;
> > +    QRegion rgn;
> > +    Drawable *last = NULL, *now;
> > +
> > +    ring = current;
> > +    ring_item = ring;
> > +    region_init(&rgn);
> > +    region_add(&rgn, area);
> > +
> > +    while ((ring_item = ring_next(ring, ring_item))) {
> > +        now = SPICE_CONTAINEROF(ring_item, Drawable, surface_list_link);
> > +        if (region_intersects(&rgn, &now->tree_item.base.rgn)) {
> > +            last = now;
> > +            break;
> > +        }
> > +    }
> > +
> > +    region_destroy(&rgn);
> > +    return last;
> > +}
> > +
> >  /*
> >   * Renders drawables for updating the requested area, but only drawables
> >   that are older
> >   * than 'last' (exclusive).
> > @@ -1376,10 +1400,8 @@ void display_channel_draw_till(DisplayChannel
> > *display, const SpiceRect *area, i
> >  void display_channel_draw(DisplayChannel *display, const SpiceRect *area,
> >  int surface_id)
> >  {
> >      RedSurface *surface;
> > -    Ring *ring;
> > -    RingItem *ring_item;
> > -    QRegion rgn;
> > -    Drawable *last, *now;
> > +    Drawable *last;
> > +
> >      spice_debug("surface %d: area ==>", surface_id);
> >      rect_debug(area);
> >
> > @@ -1390,23 +1412,10 @@ void display_channel_draw(DisplayChannel *display,
> > const SpiceRect *area, int su
> >
> >      surface = &display->surfaces[surface_id];
> >
> > -    last = NULL;
> > -    ring = &surface->current_list;
> > -    ring_item = ring;
> > -
> > -    region_init(&rgn);
> > -    region_add(&rgn, area);
> > -    while ((ring_item = ring_next(ring, ring_item))) {
> > -        now = SPICE_CONTAINEROF(ring_item, Drawable, surface_list_link);
> > -        if (region_intersects(&rgn, &now->tree_item.base.rgn)) {
> > -            last = now;
> > -            break;
> > -        }
> > -    }
> > -    region_destroy(&rgn);
> > -
> > -    if (last)
> > -        draw_until(display, surface, last);
> > +    last = current_find_intersects_rect(&surface->current_list, area);
> > +    if (!last)
> > +        return;
> >
> > +    draw_until(display, surface, last);
> >      surface_update_dest(surface, area);

Now surface_update_dest is not called if last was NULL.
Previously was always called.

> >  }
> > --
> > 2.4.3
> >
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
> Looks good!
> Acked-by: Fabiano FidĂȘncio <fidencio at redhat.com>
> 

Combined if the previous patch I don't know if these changes are
correct or not

Frediano


More information about the Spice-devel mailing list