]> git.sesse.net Git - vlc/commitdiff
.Added 8bits palette SDL support.
authorPierre Baillet <octplane@videolan.org>
Tue, 9 Jan 2001 22:30:26 +0000 (22:30 +0000)
committerPierre Baillet <octplane@videolan.org>
Tue, 9 Jan 2001 22:30:26 +0000 (22:30 +0000)
.Tried to add it to stable, failed, probably because of the initialisation codes which are differents...

plugins/sdl/sdl.c
plugins/sdl/vout_sdl.c

index 6bb9c5cfb9889b7568166ee8a5963ecaf6c70e57..3ada15cb266443380203c3b9f3ebe8e6997c20af 100644 (file)
@@ -127,6 +127,8 @@ static void vout_GetPlugin( p_vout_thread_t p_vout )
     p_vout->p_sys_destroy = vout_SDLDestroy;
     p_vout->p_sys_manage  = vout_SDLManage;
     p_vout->p_sys_display = vout_SDLDisplay;
+    p_vout->p_set_palette = vout_SDLSetPalette;
+
 }
 
 static void intf_GetPlugin( p_intf_thread_t p_intf )
index 33fb42d11f6c435047f7a3283d08983c0977e8c8..da4ef44937979c63bf6473b3267c51de9470a091 100644 (file)
@@ -186,6 +186,36 @@ int vout_SDLManage( vout_thread_t *p_vout )
 
     return( 0 );
 }
+/*****************************************************************************
+ * vout_SDLSetPalette: sets an 8 bpp palette
+ *****************************************************************************
+ * This function sets the palette given as an argument. It does not return
+ * anything, but could later send information on which colors it was unable
+ * to set.
+ *****************************************************************************/
+void vout_SDLSetPalette( p_vout_thread_t p_vout, u16 *red, u16 *green, u16 *blue, u16 *transp)
+{
+     /* Create a display surface with a grayscale palette */
+    SDL_Color colors[256];
+    int i;
+    intf_ErrMsgImm( "palettin'\n");
+  
+    /* Fill colors with color information */
+    for(i=0;i<256;i++){
+      colors[i].r=red[i]>>8;
+      colors[i].g=green[i]>>8;
+      colors[i].b=blue[i]>>8;
+    }
+    
+    /* Set palette */
+    if(SDL_SetColors(p_vout->p_sys->p_display, colors, 0, 256) == 0)
+        intf_ErrMsgImm( "error\n");
+
+}
+
+
+
+
 
 /*****************************************************************************
  * vout_SDLDisplay: displays previously rendered output
@@ -271,7 +301,7 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
      */
 
     /* init flags and cursor */
-    flags = SDL_ANYFORMAT;
+    flags = SDL_ANYFORMAT | SDL_HWPALETTE;
 
     if( p_vout->p_sys->b_fullscreen )
         flags |= SDL_FULLSCREEN;