comparison src/video/nds/SDL_ndsrender.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
48 const SDL_Color * colors, int firstcolor, 48 const SDL_Color * colors, int firstcolor,
49 int ncolors); 49 int ncolors);
50 static int NDS_GetTexturePalette(SDL_Renderer * renderer, 50 static int NDS_GetTexturePalette(SDL_Renderer * renderer,
51 SDL_Texture * texture, SDL_Color * colors, 51 SDL_Texture * texture, SDL_Color * colors,
52 int firstcolor, int ncolors); 52 int firstcolor, int ncolors);
53 static int NDS_SetTextureColorMod(SDL_Renderer * renderer,
54 SDL_Texture * texture);
55 static int NDS_SetTextureAlphaMod(SDL_Renderer * renderer,
56 SDL_Texture * texture);
57 static int NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, 53 static int NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
58 const SDL_Rect * rect, const void *pixels, 54 const SDL_Rect * rect, const void *pixels,
59 int pitch); 55 int pitch);
60 static int NDS_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, 56 static int NDS_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
61 const SDL_Rect * rect, int markDirty, 57 const SDL_Rect * rect, int markDirty,
74 70
75 SDL_RenderDriver NDS_RenderDriver = { 71 SDL_RenderDriver NDS_RenderDriver = {
76 NDS_CreateRenderer, 72 NDS_CreateRenderer,
77 {"nds", /* char* name */ 73 {"nds", /* char* name */
78 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC), /* u32 flags */ 74 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC), /* u32 flags */
79 (SDL_TEXTUREMODULATE_NONE), /* u32 mod_modes */
80 3, /* u32 num_texture_formats */ 75 3, /* u32 num_texture_formats */
81 { 76 {
82 SDL_PIXELFORMAT_INDEX8, 77 SDL_PIXELFORMAT_INDEX8,
83 SDL_PIXELFORMAT_ABGR1555, 78 SDL_PIXELFORMAT_ABGR1555,
84 SDL_PIXELFORMAT_BGR555, 79 SDL_PIXELFORMAT_BGR555,
173 renderer->driverdata = data; 168 renderer->driverdata = data;
174 renderer->CreateTexture = NDS_CreateTexture; 169 renderer->CreateTexture = NDS_CreateTexture;
175 renderer->QueryTexturePixels = NDS_QueryTexturePixels; 170 renderer->QueryTexturePixels = NDS_QueryTexturePixels;
176 renderer->SetTexturePalette = NDS_SetTexturePalette; 171 renderer->SetTexturePalette = NDS_SetTexturePalette;
177 renderer->GetTexturePalette = NDS_GetTexturePalette; 172 renderer->GetTexturePalette = NDS_GetTexturePalette;
178 renderer->SetTextureColorMod = NDS_SetTextureColorMod;
179 renderer->SetTextureAlphaMod = NDS_SetTextureAlphaMod;
180 renderer->UpdateTexture = NDS_UpdateTexture; 173 renderer->UpdateTexture = NDS_UpdateTexture;
181 renderer->LockTexture = NDS_LockTexture; 174 renderer->LockTexture = NDS_LockTexture;
182 renderer->UnlockTexture = NDS_UnlockTexture; 175 renderer->UnlockTexture = NDS_UnlockTexture;
183 renderer->DestroyTexture = NDS_DestroyTexture; 176 renderer->DestroyTexture = NDS_DestroyTexture;
184 177
185 renderer->info.mod_modes = NDS_RenderDriver.info.mod_modes;
186 renderer->info.num_texture_formats = 178 renderer->info.num_texture_formats =
187 NDS_RenderDriver.info.num_texture_formats; 179 NDS_RenderDriver.info.num_texture_formats;
188 SDL_memcpy(renderer->info.texture_formats, 180 SDL_memcpy(renderer->info.texture_formats,
189 NDS_RenderDriver.info.texture_formats, 181 NDS_RenderDriver.info.texture_formats,
190 sizeof(renderer->info.texture_formats)); 182 sizeof(renderer->info.texture_formats));
555 NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; 547 NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata;
556 /* stub! */ 548 /* stub! */
557 return 0; 549 return 0;
558 } 550 }
559 551
560 static int
561 NDS_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
562 {
563 /* stub! */
564 return 0;
565 }
566
567 static int
568 NDS_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
569 {
570 /* stub! */
571 return 0;
572 }
573
574 /* vi: set ts=4 sw=4 expandtab: */ 552 /* vi: set ts=4 sw=4 expandtab: */