Mercurial > sdl-ios-xcode
comparison src/video/SDL_video.c @ 1680:9488fca10677 SDL-1.3
Dummy video driver works again in high color video modes. Yay!
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 14 Jun 2006 08:41:13 +0000 |
parents | 153477a6cc31 |
children | 80a5e6a4e1e2 |
comparison
equal
deleted
inserted
replaced
1679:153477a6cc31 | 1680:9488fca10677 |
---|---|
1027 } | 1027 } |
1028 | 1028 |
1029 if (index < 0) { | 1029 if (index < 0) { |
1030 int n = SDL_GetNumRenderers(); | 1030 int n = SDL_GetNumRenderers(); |
1031 for (index = 0; index < n; ++index) { | 1031 for (index = 0; index < n; ++index) { |
1032 if ((SDL_CurrentDisplay.render_drivers[index].info. | 1032 SDL_RenderDriver *driver = |
1033 flags & flags) == flags) { | 1033 &SDL_CurrentDisplay.render_drivers[index]; |
1034 | |
1035 /* Skip minimal drivers in automatic scans */ | |
1036 if (!(flags & SDL_Renderer_Minimal) | |
1037 && (driver->info.flags & SDL_Renderer_Minimal)) { | |
1038 continue; | |
1039 } | |
1040 if ((driver->info.flags & flags) == flags) { | |
1034 break; | 1041 break; |
1035 } | 1042 } |
1036 } | 1043 } |
1037 if (index == n) { | 1044 if (index == n) { |
1038 SDL_SetError("Couldn't find matching render driver"); | 1045 SDL_SetError("Couldn't find matching render driver"); |
1074 } | 1081 } |
1075 | 1082 |
1076 SDL_TextureID | 1083 SDL_TextureID |
1077 SDL_CreateTexture(Uint32 format, int access, int w, int h) | 1084 SDL_CreateTexture(Uint32 format, int access, int w, int h) |
1078 { | 1085 { |
1086 int hash; | |
1079 SDL_Renderer *renderer; | 1087 SDL_Renderer *renderer; |
1080 SDL_Texture *texture; | 1088 SDL_Texture *texture; |
1081 | 1089 |
1082 if (!_this) { | 1090 if (!_this) { |
1083 return 0; | 1091 return 0; |
1104 | 1112 |
1105 if (renderer->CreateTexture(renderer, texture) < 0) { | 1113 if (renderer->CreateTexture(renderer, texture) < 0) { |
1106 SDL_free(texture); | 1114 SDL_free(texture); |
1107 return 0; | 1115 return 0; |
1108 } | 1116 } |
1117 | |
1118 hash = (texture->id % SDL_arraysize(SDL_CurrentDisplay.textures)); | |
1119 texture->next = SDL_CurrentDisplay.textures[hash]; | |
1120 SDL_CurrentDisplay.textures[hash] = texture; | |
1121 | |
1122 return texture->id; | |
1109 } | 1123 } |
1110 | 1124 |
1111 SDL_TextureID | 1125 SDL_TextureID |
1112 SDL_CreateTextureFromSurface(Uint32 format, int access, SDL_Surface * surface) | 1126 SDL_CreateTextureFromSurface(Uint32 format, int access, SDL_Surface * surface) |
1113 { | 1127 { |
1298 renderer = texture->renderer; | 1312 renderer = texture->renderer; |
1299 if (!renderer->QueryTexturePixels) { | 1313 if (!renderer->QueryTexturePixels) { |
1300 return -1; | 1314 return -1; |
1301 } | 1315 } |
1302 return renderer->QueryTexturePixels(renderer, texture, pixels, pitch); | 1316 return renderer->QueryTexturePixels(renderer, texture, pixels, pitch); |
1317 } | |
1318 | |
1319 int | |
1320 SDL_SetTexturePalette(SDL_TextureID textureID, SDL_Color * colors, | |
1321 int firstcolor, int ncolors) | |
1322 { | |
1323 SDL_Texture *texture = SDL_GetTextureFromID(textureID); | |
1324 SDL_Renderer *renderer; | |
1325 | |
1326 if (!texture) { | |
1327 return -1; | |
1328 } | |
1329 | |
1330 renderer = texture->renderer; | |
1331 if (!renderer->SetTexturePalette) { | |
1332 return -1; | |
1333 } | |
1334 return renderer->SetTexturePalette(renderer, texture, colors, firstcolor, | |
1335 ncolors); | |
1303 } | 1336 } |
1304 | 1337 |
1305 int | 1338 int |
1306 SDL_UpdateTexture(SDL_TextureID textureID, SDL_Rect * rect, | 1339 SDL_UpdateTexture(SDL_TextureID textureID, SDL_Rect * rect, |
1307 const void *pixels, int pitch) | 1340 const void *pixels, int pitch) |