diff 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
line wrap: on
line diff
--- a/src/video/SDL_video.c	Wed Jun 14 06:26:35 2006 +0000
+++ b/src/video/SDL_video.c	Wed Jun 14 08:41:13 2006 +0000
@@ -1029,8 +1029,15 @@
     if (index < 0) {
         int n = SDL_GetNumRenderers();
         for (index = 0; index < n; ++index) {
-            if ((SDL_CurrentDisplay.render_drivers[index].info.
-                 flags & flags) == flags) {
+            SDL_RenderDriver *driver =
+                &SDL_CurrentDisplay.render_drivers[index];
+
+            /* Skip minimal drivers in automatic scans */
+            if (!(flags & SDL_Renderer_Minimal)
+                && (driver->info.flags & SDL_Renderer_Minimal)) {
+                continue;
+            }
+            if ((driver->info.flags & flags) == flags) {
                 break;
             }
         }
@@ -1076,6 +1083,7 @@
 SDL_TextureID
 SDL_CreateTexture(Uint32 format, int access, int w, int h)
 {
+    int hash;
     SDL_Renderer *renderer;
     SDL_Texture *texture;
 
@@ -1106,6 +1114,12 @@
         SDL_free(texture);
         return 0;
     }
+
+    hash = (texture->id % SDL_arraysize(SDL_CurrentDisplay.textures));
+    texture->next = SDL_CurrentDisplay.textures[hash];
+    SDL_CurrentDisplay.textures[hash] = texture;
+
+    return texture->id;
 }
 
 SDL_TextureID
@@ -1303,6 +1317,25 @@
 }
 
 int
+SDL_SetTexturePalette(SDL_TextureID textureID, SDL_Color * colors,
+                      int firstcolor, int ncolors)
+{
+    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+    SDL_Renderer *renderer;
+
+    if (!texture) {
+        return -1;
+    }
+
+    renderer = texture->renderer;
+    if (!renderer->SetTexturePalette) {
+        return -1;
+    }
+    return renderer->SetTexturePalette(renderer, texture, colors, firstcolor,
+                                       ncolors);
+}
+
+int
 SDL_UpdateTexture(SDL_TextureID textureID, SDL_Rect * rect,
                   const void *pixels, int pitch)
 {