comparison src/video/directfb/SDL_DirectFB_render.c @ 3640:58c1b9ec7074

DirectFB driver compiles again - moved to new drawing api
author Couriersud <couriersud@arcor.de>
date Mon, 11 Jan 2010 21:49:09 +0000
parents 83518f8fcd61
children 64ce267332c6
comparison
equal deleted inserted replaced
3639:6f4c5b0aba7c 3640:58c1b9ec7074
70 static void DirectFB_UnlockTexture(SDL_Renderer * renderer, 70 static void DirectFB_UnlockTexture(SDL_Renderer * renderer,
71 SDL_Texture * texture); 71 SDL_Texture * texture);
72 static void DirectFB_DirtyTexture(SDL_Renderer * renderer, 72 static void DirectFB_DirtyTexture(SDL_Renderer * renderer,
73 SDL_Texture * texture, int numrects, 73 SDL_Texture * texture, int numrects,
74 const SDL_Rect * rects); 74 const SDL_Rect * rects);
75 static int DirectFB_RenderPoint(SDL_Renderer * renderer, int x, int y); 75 static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer,
76 static int DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1, 76 const SDL_Point * points, int count);
77 int x2, int y2); 77 static int DirectFB_RenderDrawLines(SDL_Renderer * renderer,
78 static int DirectFB_RenderFill(SDL_Renderer * renderer, 78 const SDL_Point * points, int count);
79 const SDL_Rect * rect); 79 static int DirectFB_RenderDrawRects(SDL_Renderer * renderer,
80 const SDL_Rect ** rects, int count);
81 static int DirectFB_RenderFillRects(SDL_Renderer * renderer,
82 const SDL_Rect ** rects, int count);
80 static int DirectFB_RenderCopy(SDL_Renderer * renderer, 83 static int DirectFB_RenderCopy(SDL_Renderer * renderer,
81 SDL_Texture * texture, 84 SDL_Texture * texture,
82 const SDL_Rect * srcrect, 85 const SDL_Rect * srcrect,
83 const SDL_Rect * dstrect); 86 const SDL_Rect * dstrect);
84 static void DirectFB_RenderPresent(SDL_Renderer * renderer); 87 static void DirectFB_RenderPresent(SDL_Renderer * renderer);
299 renderer->SetTextureScaleMode = DirectFB_SetTextureScaleMode; 302 renderer->SetTextureScaleMode = DirectFB_SetTextureScaleMode;
300 renderer->UpdateTexture = DirectFB_UpdateTexture; 303 renderer->UpdateTexture = DirectFB_UpdateTexture;
301 renderer->LockTexture = DirectFB_LockTexture; 304 renderer->LockTexture = DirectFB_LockTexture;
302 renderer->UnlockTexture = DirectFB_UnlockTexture; 305 renderer->UnlockTexture = DirectFB_UnlockTexture;
303 renderer->DirtyTexture = DirectFB_DirtyTexture; 306 renderer->DirtyTexture = DirectFB_DirtyTexture;
304 renderer->RenderPoint = DirectFB_RenderPoint; 307 renderer->RenderDrawPoints = DirectFB_RenderDrawPoints;
305 renderer->RenderLine = DirectFB_RenderLine; 308 renderer->RenderDrawLines = DirectFB_RenderDrawLines;
306 renderer->RenderFill = DirectFB_RenderFill; 309 renderer->RenderFillRects = DirectFB_RenderFillRects;
310 renderer->RenderDrawRects = DirectFB_RenderDrawRects;
307 renderer->RenderCopy = DirectFB_RenderCopy; 311 renderer->RenderCopy = DirectFB_RenderCopy;
308 renderer->RenderPresent = DirectFB_RenderPresent; 312 renderer->RenderPresent = DirectFB_RenderPresent;
309 renderer->DestroyTexture = DirectFB_DestroyTexture; 313 renderer->DestroyTexture = DirectFB_DestroyTexture;
310 renderer->DestroyRenderer = DirectFB_DestroyRenderer; 314 renderer->DestroyRenderer = DirectFB_DestroyRenderer;
311 renderer->info = DirectFB_RenderDriver.info; 315 renderer->info = DirectFB_RenderDriver.info;
855 return 0; 859 return 0;
856 error: 860 error:
857 return -1; 861 return -1;
858 } 862 }
859 863
860 static int 864 static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer,
861 DirectFB_RenderPoint(SDL_Renderer * renderer, int x, int y) 865 const SDL_Point * points, int count)
862 { 866 {
863 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; 867 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
864 SDL_DFB_WINDOWSURFACE(data->window); 868 SDL_DFB_WINDOWSURFACE(data->window);
865 DFBResult ret; 869 DFBResult ret;
870 int i;
866 871
867 PrepareDraw(renderer); 872 PrepareDraw(renderer);
868 SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x, y, x, y)); 873 for (i=0; i < count; i++)
874 SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, points[i].x, points[i].y, points[i].x, points[i].y));
869 return 0; 875 return 0;
870 error: 876 error:
871 return -1; 877 return -1;
872 } 878 }
873 879
874 static int 880 static int DirectFB_RenderDrawLines(SDL_Renderer * renderer,
875 DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2) 881 const SDL_Point * points, int count)
876 { 882 {
877 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; 883 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
878 SDL_DFB_WINDOWSURFACE(data->window); 884 SDL_DFB_WINDOWSURFACE(data->window);
879 DFBResult ret; 885 DFBResult ret;
886 int i;
880 887
881 PrepareDraw(renderer); 888 PrepareDraw(renderer);
882 /* Use antialiasing when available */ 889 /* Use antialiasing when available */
883 #if (DFB_VERSION_ATLEAST(1,2,0)) 890 #if (DFB_VERSION_ATLEAST(1,2,0))
884 SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf, DSRO_ANTIALIAS)); 891 SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf, DSRO_ANTIALIAS));
885 #endif 892 #endif
886 SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x1, y1, x2, y2)); 893
894 for (i=0; i < count - 1; i++)
895 SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, points[i].x, points[i].y, points[i+1].x, points[i+1].y));
896
887 return 0; 897 return 0;
888 error: 898 error:
889 return -1; 899 return -1;
890 } 900 }
891 901
892 static int 902 static int
893 DirectFB_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect) 903 DirectFB_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
894 { 904 {
895 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; 905 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
896 SDL_DFB_WINDOWSURFACE(data->window); 906 SDL_DFB_WINDOWSURFACE(data->window);
897 DFBResult ret; 907 DFBResult ret;
908 int i;
898 909
899 PrepareDraw(renderer); 910 PrepareDraw(renderer);
900 SDL_DFB_CHECKERR(destsurf->FillRectangle(destsurf, rect->x, rect->y, 911
901 rect->w, rect->h)); 912 for (i=0; i<count; i++)
913 SDL_DFB_CHECKERR(destsurf->DrawRectangle(destsurf, rects[i]->x, rects[i]->y,
914 rects[i]->w, rects[i]->h));
915
916 return 0;
917 error:
918 return -1;
919 }
920
921 static int
922 DirectFB_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
923 {
924 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
925 SDL_DFB_WINDOWSURFACE(data->window);
926 DFBResult ret;
927 int i;
928
929 PrepareDraw(renderer);
930
931 for (i=0; i<count; i++)
932 SDL_DFB_CHECKERR(destsurf->FillRectangle(destsurf, rects[i]->x, rects[i]->y,
933 rects[i]->w, rects[i]->h));
902 934
903 return 0; 935 return 0;
904 error: 936 error:
905 return -1; 937 return -1;
906 } 938 }