DirectFB driver compiles again
authorCouriersud
Mon, 11 Jan 2010 21:49:09 +0000
changeset 364058c1b9ec7074
parent 3639 6f4c5b0aba7c
child 3641 1e2e19d51265
DirectFB driver compiles again
- moved to new drawing api
src/video/directfb/SDL_DirectFB_modes.c
src/video/directfb/SDL_DirectFB_render.c
     1.1 --- a/src/video/directfb/SDL_DirectFB_modes.c	Mon Jan 11 21:46:59 2010 +0000
     1.2 +++ b/src/video/directfb/SDL_DirectFB_modes.c	Mon Jan 11 21:49:09 2010 +0000
     1.3 @@ -387,6 +387,7 @@
     1.4      }
     1.5  
     1.6      SDL_DFB_FREE(data.modelist);
     1.7 +error:
     1.8      return;
     1.9  }
    1.10  
     2.1 --- a/src/video/directfb/SDL_DirectFB_render.c	Mon Jan 11 21:46:59 2010 +0000
     2.2 +++ b/src/video/directfb/SDL_DirectFB_render.c	Mon Jan 11 21:49:09 2010 +0000
     2.3 @@ -72,11 +72,14 @@
     2.4  static void DirectFB_DirtyTexture(SDL_Renderer * renderer,
     2.5                                    SDL_Texture * texture, int numrects,
     2.6                                    const SDL_Rect * rects);
     2.7 -static int DirectFB_RenderPoint(SDL_Renderer * renderer, int x, int y);
     2.8 -static int DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1,
     2.9 -                               int x2, int y2);
    2.10 -static int DirectFB_RenderFill(SDL_Renderer * renderer,
    2.11 -                               const SDL_Rect * rect);
    2.12 +static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer,
    2.13 +                                const SDL_Point * points, int count);
    2.14 +static int DirectFB_RenderDrawLines(SDL_Renderer * renderer,
    2.15 +                               const SDL_Point * points, int count);
    2.16 +static int DirectFB_RenderDrawRects(SDL_Renderer * renderer,
    2.17 +		const SDL_Rect ** rects, int count);
    2.18 +static int DirectFB_RenderFillRects(SDL_Renderer * renderer,
    2.19 +		const SDL_Rect ** rects, int count);
    2.20  static int DirectFB_RenderCopy(SDL_Renderer * renderer,
    2.21                                 SDL_Texture * texture,
    2.22                                 const SDL_Rect * srcrect,
    2.23 @@ -301,9 +304,10 @@
    2.24      renderer->LockTexture = DirectFB_LockTexture;
    2.25      renderer->UnlockTexture = DirectFB_UnlockTexture;
    2.26      renderer->DirtyTexture = DirectFB_DirtyTexture;
    2.27 -    renderer->RenderPoint = DirectFB_RenderPoint;
    2.28 -    renderer->RenderLine = DirectFB_RenderLine;
    2.29 -    renderer->RenderFill = DirectFB_RenderFill;
    2.30 +    renderer->RenderDrawPoints = DirectFB_RenderDrawPoints;
    2.31 +    renderer->RenderDrawLines = DirectFB_RenderDrawLines;
    2.32 +    renderer->RenderFillRects = DirectFB_RenderFillRects;
    2.33 +    renderer->RenderDrawRects = DirectFB_RenderDrawRects;
    2.34      renderer->RenderCopy = DirectFB_RenderCopy;
    2.35      renderer->RenderPresent = DirectFB_RenderPresent;
    2.36      renderer->DestroyTexture = DirectFB_DestroyTexture;
    2.37 @@ -857,48 +861,76 @@
    2.38      return -1;
    2.39  }
    2.40  
    2.41 -static int
    2.42 -DirectFB_RenderPoint(SDL_Renderer * renderer, int x, int y)
    2.43 +static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer,
    2.44 +                                const SDL_Point * points, int count)
    2.45  {
    2.46      DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
    2.47      SDL_DFB_WINDOWSURFACE(data->window);
    2.48      DFBResult ret;
    2.49 +    int i;
    2.50  
    2.51      PrepareDraw(renderer);
    2.52 -    SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x, y, x, y));
    2.53 +    for (i=0; i < count; i++)
    2.54 +    	SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, points[i].x, points[i].y, points[i].x, points[i].y));
    2.55 +    return 0;
    2.56 +  error:
    2.57 +    return -1;
    2.58 +}
    2.59 +
    2.60 +static int DirectFB_RenderDrawLines(SDL_Renderer * renderer,
    2.61 +                               const SDL_Point * points, int count)
    2.62 +{
    2.63 +    DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
    2.64 +    SDL_DFB_WINDOWSURFACE(data->window);
    2.65 +    DFBResult ret;
    2.66 +    int i;
    2.67 +
    2.68 +    PrepareDraw(renderer);
    2.69 +    /* Use antialiasing when available */
    2.70 +#if (DFB_VERSION_ATLEAST(1,2,0))
    2.71 +    SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf, DSRO_ANTIALIAS));
    2.72 +#endif
    2.73 +
    2.74 +    for (i=0; i < count - 1; i++)
    2.75 +    	SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, points[i].x, points[i].y, points[i+1].x, points[i+1].y));
    2.76 +
    2.77      return 0;
    2.78    error:
    2.79      return -1;
    2.80  }
    2.81  
    2.82  static int
    2.83 -DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
    2.84 +DirectFB_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
    2.85  {
    2.86      DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
    2.87      SDL_DFB_WINDOWSURFACE(data->window);
    2.88      DFBResult ret;
    2.89 +    int i;
    2.90  
    2.91      PrepareDraw(renderer);
    2.92 -    /* Use antialiasing when available */
    2.93 -#if (DFB_VERSION_ATLEAST(1,2,0))
    2.94 -    SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf, DSRO_ANTIALIAS));
    2.95 -#endif
    2.96 -    SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x1, y1, x2, y2));
    2.97 +
    2.98 +    for (i=0; i<count; i++)
    2.99 +    	SDL_DFB_CHECKERR(destsurf->DrawRectangle(destsurf, rects[i]->x, rects[i]->y,
   2.100 +    			rects[i]->w, rects[i]->h));
   2.101 +
   2.102      return 0;
   2.103    error:
   2.104      return -1;
   2.105  }
   2.106  
   2.107  static int
   2.108 -DirectFB_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect)
   2.109 +DirectFB_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
   2.110  {
   2.111      DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
   2.112      SDL_DFB_WINDOWSURFACE(data->window);
   2.113      DFBResult ret;
   2.114 +    int i;
   2.115  
   2.116      PrepareDraw(renderer);
   2.117 -    SDL_DFB_CHECKERR(destsurf->FillRectangle(destsurf, rect->x, rect->y,
   2.118 -                                             rect->w, rect->h));
   2.119 +
   2.120 +    for (i=0; i<count; i++)
   2.121 +    	SDL_DFB_CHECKERR(destsurf->FillRectangle(destsurf, rects[i]->x, rects[i]->y,
   2.122 +    			rects[i]->w, rects[i]->h));
   2.123  
   2.124      return 0;
   2.125    error: