src/video/directfb/SDL_DirectFB_video.c
changeset 286 3ea69fd0b095
parent 259 80b647695abd
child 297 f6ffac90895c
     1.1 --- a/src/video/directfb/SDL_DirectFB_video.c	Fri Feb 22 17:39:11 2002 +0000
     1.2 +++ b/src/video/directfb/SDL_DirectFB_video.c	Tue Feb 26 14:38:53 2002 +0000
     1.3 @@ -304,7 +304,7 @@
     1.4    DFBCardCapabilities    caps;
     1.5    IDirectFBDisplayLayer *layer;
     1.6    DFBDisplayLayerConfig  dlc;
     1.7 -  IDirectFBInputBuffer  *inputbuffer;
     1.8 +  IDirectFBEventBuffer  *eventbuffer;
     1.9  
    1.10  
    1.11    ret = DirectFBInit (NULL, NULL);
    1.12 @@ -329,11 +329,10 @@
    1.13        return -1;
    1.14      }
    1.15  
    1.16 -  ret = dfb->CreateInputBuffer (dfb, DICAPS_BUTTONS | DICAPS_AXIS | DICAPS_KEYS,
    1.17 -                                &inputbuffer);
    1.18 +  ret = dfb->CreateEventBuffer (dfb, DICAPS_ALL, &eventbuffer);
    1.19    if (ret)
    1.20      {
    1.21 -      SetDirectFBerror ("dfb->CreateInputBuffer", ret);
    1.22 +      SetDirectFBerror ("dfb->CreateEventBuffer", ret);
    1.23        layer->Release (layer);
    1.24        dfb->Release (dfb);
    1.25        return -1;
    1.26 @@ -395,7 +394,7 @@
    1.27    HIDDEN->initialized = 1;
    1.28    HIDDEN->dfb         = dfb;
    1.29    HIDDEN->layer       = layer;
    1.30 -  HIDDEN->inputbuffer = inputbuffer;
    1.31 +  HIDDEN->eventbuffer = eventbuffer;
    1.32  
    1.33    return 0;
    1.34  }
    1.35 @@ -691,34 +690,48 @@
    1.36  
    1.37  static void DirectFB_WindowedUpdate(_THIS, int numrects, SDL_Rect *rects)
    1.38  {
    1.39 +  DFBRegion         region;
    1.40 +  int               i;
    1.41 +  int               region_valid = 0;
    1.42    IDirectFBSurface *surface = this->screen->hwdata->surface;
    1.43 -  DFBRegion region = { rects->x, rects->y,
    1.44 -                       rects->x + rects->w - 1,
    1.45 -                       rects->y + rects->h - 1 };
    1.46  
    1.47 -  while (--numrects)
    1.48 +  for (i=0; i<numrects; ++i)
    1.49      {
    1.50        int x2, y2;
    1.51  
    1.52 -      rects++;
    1.53 +      if ( ! rects[i].w ) /* Clipped? */
    1.54 +        continue;
    1.55 +
    1.56 +      x2 = rects[i].x + rects[i].w - 1;
    1.57 +      y2 = rects[i].y + rects[i].h - 1;
    1.58  
    1.59 -      if (rects->x < region.x1)
    1.60 -        region.x1 = rects->x;
    1.61 +      if (region_valid)
    1.62 +        {
    1.63 +          if (rects[i].x < region.x1)
    1.64 +            region.x1 = rects[i].x;
    1.65  
    1.66 -      if (rects->y < region.y1)
    1.67 -        region.y1 = rects->y;
    1.68 +          if (rects[i].y < region.y1)
    1.69 +            region.y1 = rects[i].y;
    1.70  
    1.71 -      x2 = rects->x + rects->w - 1;
    1.72 -      y2 = rects->y + rects->h - 1;
    1.73 +          if (x2 > region.x2)
    1.74 +            region.x2 = x2;
    1.75  
    1.76 -      if (x2 > region.x2)
    1.77 -        region.x2 = x2;
    1.78 +          if (y2 > region.y2)
    1.79 +            region.y2 = y2;
    1.80 +        }
    1.81 +      else
    1.82 +        {
    1.83 +            region.x1 = rects[i].x;
    1.84 +            region.y1 = rects[i].y;
    1.85 +            region.x2 = x2;
    1.86 +            region.y2 = y2;
    1.87  
    1.88 -      if (y2 > region.y2)
    1.89 -        region.y2 = y2;
    1.90 +            region_valid = 1;
    1.91 +        }
    1.92      }
    1.93  
    1.94 -  surface->Flip (surface, &region, DSFLIP_WAITFORSYNC);
    1.95 +  if (region_valid)
    1.96 +    surface->Flip (surface, &region, DSFLIP_WAITFORSYNC);
    1.97  }
    1.98  
    1.99  int DirectFB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
   1.100 @@ -731,7 +744,7 @@
   1.101  {
   1.102    int i, j;
   1.103  
   1.104 -  HIDDEN->inputbuffer->Release (HIDDEN->inputbuffer);
   1.105 +  HIDDEN->eventbuffer->Release (HIDDEN->eventbuffer);
   1.106    HIDDEN->layer->Release (HIDDEN->layer);
   1.107    HIDDEN->dfb->Release (HIDDEN->dfb);
   1.108