comparison src/video/directfb/SDL_DirectFB_render.c @ 5144:31e7f523ab3d

Making the API simpler, texture color and alpha modulation are supported by all renderers.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 31 Jan 2011 23:37:30 -0800
parents e743b9c3f6d6
children c8e049de174c
comparison
equal deleted inserted replaced
5143:e743b9c3f6d6 5144:31e7f523ab3d
49 int firstcolor, int ncolors); 49 int firstcolor, int ncolors);
50 static int DirectFB_GetTexturePalette(SDL_Renderer * renderer, 50 static int DirectFB_GetTexturePalette(SDL_Renderer * renderer,
51 SDL_Texture * texture, 51 SDL_Texture * texture,
52 SDL_Color * colors, 52 SDL_Color * colors,
53 int firstcolor, int ncolors); 53 int firstcolor, int ncolors);
54 static int DirectFB_SetTextureAlphaMod(SDL_Renderer * renderer,
55 SDL_Texture * texture);
56 static int DirectFB_SetTextureColorMod(SDL_Renderer * renderer,
57 SDL_Texture * texture);
58 static int DirectFB_UpdateTexture(SDL_Renderer * renderer, 54 static int DirectFB_UpdateTexture(SDL_Renderer * renderer,
59 SDL_Texture * texture, 55 SDL_Texture * texture,
60 const SDL_Rect * rect, 56 const SDL_Rect * rect,
61 const void *pixels, int pitch); 57 const void *pixels, int pitch);
62 static int DirectFB_LockTexture(SDL_Renderer * renderer, 58 static int DirectFB_LockTexture(SDL_Renderer * renderer,
66 static void DirectFB_UnlockTexture(SDL_Renderer * renderer, 62 static void DirectFB_UnlockTexture(SDL_Renderer * renderer,
67 SDL_Texture * texture); 63 SDL_Texture * texture);
68 static void DirectFB_DirtyTexture(SDL_Renderer * renderer, 64 static void DirectFB_DirtyTexture(SDL_Renderer * renderer,
69 SDL_Texture * texture, int numrects, 65 SDL_Texture * texture, int numrects,
70 const SDL_Rect * rects); 66 const SDL_Rect * rects);
71 static int DirectFB_SetDrawBlendMode(SDL_Renderer * renderer);
72 static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer, 67 static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer,
73 const SDL_Point * points, int count); 68 const SDL_Point * points, int count);
74 static int DirectFB_RenderDrawLines(SDL_Renderer * renderer, 69 static int DirectFB_RenderDrawLines(SDL_Renderer * renderer,
75 const SDL_Point * points, int count); 70 const SDL_Point * points, int count);
76 static int DirectFB_RenderDrawRects(SDL_Renderer * renderer, 71 static int DirectFB_RenderDrawRects(SDL_Renderer * renderer,
94 "directfb", 89 "directfb",
95 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY | 90 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
96 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | 91 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
97 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD | 92 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD |
98 SDL_RENDERER_ACCELERATED), 93 SDL_RENDERER_ACCELERATED),
99 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
100 SDL_TEXTUREMODULATE_ALPHA),
101 14, 94 14,
102 { 95 {
103 SDL_PIXELFORMAT_INDEX4LSB, 96 SDL_PIXELFORMAT_INDEX4LSB,
104 SDL_PIXELFORMAT_INDEX8, 97 SDL_PIXELFORMAT_INDEX8,
105 SDL_PIXELFORMAT_RGB332, 98 SDL_PIXELFORMAT_RGB332,
273 renderer->ActivateRenderer = DirectFB_ActivateRenderer; 266 renderer->ActivateRenderer = DirectFB_ActivateRenderer;
274 renderer->CreateTexture = DirectFB_CreateTexture; 267 renderer->CreateTexture = DirectFB_CreateTexture;
275 renderer->QueryTexturePixels = DirectFB_QueryTexturePixels; 268 renderer->QueryTexturePixels = DirectFB_QueryTexturePixels;
276 renderer->SetTexturePalette = DirectFB_SetTexturePalette; 269 renderer->SetTexturePalette = DirectFB_SetTexturePalette;
277 renderer->GetTexturePalette = DirectFB_GetTexturePalette; 270 renderer->GetTexturePalette = DirectFB_GetTexturePalette;
278 renderer->SetTextureAlphaMod = DirectFB_SetTextureAlphaMod;
279 renderer->SetTextureColorMod = DirectFB_SetTextureColorMod;
280 renderer->UpdateTexture = DirectFB_UpdateTexture; 271 renderer->UpdateTexture = DirectFB_UpdateTexture;
281 renderer->LockTexture = DirectFB_LockTexture; 272 renderer->LockTexture = DirectFB_LockTexture;
282 renderer->UnlockTexture = DirectFB_UnlockTexture; 273 renderer->UnlockTexture = DirectFB_UnlockTexture;
283 renderer->DirtyTexture = DirectFB_DirtyTexture; 274 renderer->DirtyTexture = DirectFB_DirtyTexture;
284 renderer->RenderDrawPoints = DirectFB_RenderDrawPoints; 275 renderer->RenderDrawPoints = DirectFB_RenderDrawPoints;
285 renderer->RenderDrawLines = DirectFB_RenderDrawLines; 276 renderer->RenderDrawLines = DirectFB_RenderDrawLines;
286 /* SetDrawColor - no needed */
287 renderer->SetDrawBlendMode = DirectFB_SetDrawBlendMode;
288 renderer->RenderFillRects = DirectFB_RenderFillRects; 277 renderer->RenderFillRects = DirectFB_RenderFillRects;
289 renderer->RenderDrawRects = DirectFB_RenderDrawRects; 278 renderer->RenderDrawRects = DirectFB_RenderDrawRects;
290 /* RenderDrawEllipse - no reference implementation yet */ 279 /* RenderDrawEllipse - no reference implementation yet */
291 /* RenderFillEllipse - no reference implementation yet */ 280 /* RenderFillEllipse - no reference implementation yet */
292 renderer->RenderCopy = DirectFB_RenderCopy; 281 renderer->RenderCopy = DirectFB_RenderCopy;
634 error: 623 error:
635 return -1; 624 return -1;
636 } 625 }
637 626
638 static int 627 static int
639 DirectFB_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
640 {
641 return 0;
642 }
643
644 static int
645 DirectFB_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
646 {
647 return 0;
648 }
649
650 static int
651 DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) 628 DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
652 { 629 {
653 #if (DFB_VERSION_ATLEAST(1,2,0)) 630 #if (DFB_VERSION_ATLEAST(1,2,0))
654 631
655 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; 632 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;