comparison src/video/dummy/SDL_nullrender.c @ 2884:9dde605c7540

Date: Fri, 19 Dec 2008 20:17:35 +0100 From: Couriersud Subject: Re: Aw: Experience using SDL1.3 in sdlmame/Proposal for api additions > For consistency you'd probably want: > SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a); > SDL_SetRenderDrawBlendMode(SDL_BlendMode blendMode); > SDL_RenderLine(int x1, int y1, int x2, int y2); > SDL_RenderFill(SDL_Rect *rect); > > You probably also want to add API functions query the current state. > I have implemented the above api for the opengl, x11, directfb and software renderers. I have also renamed *TEXTUREBLENDMODE* constants to BLENDMODE*. The unix build compiles. The windows renderer still needs to be updated, but I have no windows development machine at hand. Have a look at the x11 renderer for a sample. Vector games now run at 90% both on opengl and directfb in comparison to sdlmame's own opengl renderer. The same applies to raster games. The diff also includes a) Changed XDrawRect to XFillRect in x11 renderer b) A number of changes to fix blending and modulation issues in the directfb renderer.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 20 Dec 2008 12:00:00 +0000
parents 99210400e8b9
children 32e8bbba1e94
comparison
equal deleted inserted replaced
2883:11626a53e7bc 2884:9dde605c7540
29 29
30 /* SDL surface based renderer implementation */ 30 /* SDL surface based renderer implementation */
31 31
32 static SDL_Renderer *SDL_DUMMY_CreateRenderer(SDL_Window * window, 32 static SDL_Renderer *SDL_DUMMY_CreateRenderer(SDL_Window * window,
33 Uint32 flags); 33 Uint32 flags);
34 static int SDL_DUMMY_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, 34 static int SDL_DUMMY_SetDrawColor(SDL_Renderer * renderer);
35 Uint8 b, Uint8 a, const SDL_Rect * rect); 35 static int SDL_DUMMY_RenderFill(SDL_Renderer * renderer,
36 const SDL_Rect * rect);
36 static int SDL_DUMMY_RenderCopy(SDL_Renderer * renderer, 37 static int SDL_DUMMY_RenderCopy(SDL_Renderer * renderer,
37 SDL_Texture * texture, 38 SDL_Texture * texture,
38 const SDL_Rect * srcrect, 39 const SDL_Rect * srcrect,
39 const SDL_Rect * dstrect); 40 const SDL_Rect * dstrect);
40 static void SDL_DUMMY_RenderPresent(SDL_Renderer * renderer); 41 static void SDL_DUMMY_RenderPresent(SDL_Renderer * renderer);
86 SDL_OutOfMemory(); 87 SDL_OutOfMemory();
87 return NULL; 88 return NULL;
88 } 89 }
89 SDL_zerop(data); 90 SDL_zerop(data);
90 91
92 renderer->SetDrawColor = SDL_DUMMY_SetDrawColor;
91 renderer->RenderFill = SDL_DUMMY_RenderFill; 93 renderer->RenderFill = SDL_DUMMY_RenderFill;
92 renderer->RenderCopy = SDL_DUMMY_RenderCopy; 94 renderer->RenderCopy = SDL_DUMMY_RenderCopy;
93 renderer->RenderPresent = SDL_DUMMY_RenderPresent; 95 renderer->RenderPresent = SDL_DUMMY_RenderPresent;
94 renderer->DestroyRenderer = SDL_DUMMY_DestroyRenderer; 96 renderer->DestroyRenderer = SDL_DUMMY_DestroyRenderer;
95 renderer->info.name = SDL_DUMMY_RenderDriver.info.name; 97 renderer->info.name = SDL_DUMMY_RenderDriver.info.name;
122 124
123 return renderer; 125 return renderer;
124 } 126 }
125 127
126 static int 128 static int
127 SDL_DUMMY_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, 129 SDL_DUMMY_SetDrawColor(SDL_Renderer * renderer)
128 Uint8 a, const SDL_Rect * rect) 130 {
131 return 0;
132 }
133
134 static int
135 SDL_DUMMY_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect)
129 { 136 {
130 SDL_DUMMY_RenderData *data = 137 SDL_DUMMY_RenderData *data =
131 (SDL_DUMMY_RenderData *) renderer->driverdata; 138 (SDL_DUMMY_RenderData *) renderer->driverdata;
132 SDL_Surface *target = data->screens[data->current_screen]; 139 SDL_Surface *target = data->screens[data->current_screen];
133 Uint32 color; 140 Uint32 color;
134 SDL_Rect real_rect = *rect; 141 SDL_Rect real_rect = *rect;
135 142
136 color = SDL_MapRGBA(target->format, r, g, b, a); 143 color = SDL_MapRGBA(target->format,
144 renderer->r, renderer->g, renderer->b, renderer->a);
137 145
138 return SDL_FillRect(target, &real_rect, color); 146 return SDL_FillRect(target, &real_rect, color);
139 } 147 }
140 148
141 static int 149 static int