]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/src/file_bitmap.cpp
Contribs: update freetype to 2.4.2
[vlc] / modules / gui / skins2 / src / file_bitmap.cpp
index 39c986fa333de3e13f44313d015ed7d478fbc022..051de8a693dba47122afd34b72bf94f992433cda 100644 (file)
@@ -5,7 +5,7 @@
  * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
- *          Olivier Teulière <ipkiss@via.ecp.fr>
+ *          Olivier Teulière <ipkiss@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#include <vlc/vlc.h>
-#include "vlc_image.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_image.h>
+#include <vlc_url.h>
 #include "file_bitmap.hpp"
 
 FileBitmap::FileBitmap( intf_thread_t *pIntf, image_handler_t *pImageHandler,
                         string fileName, uint32_t aColor, int nbFrames,
-                        int fps ):
-    GenericBitmap( pIntf, nbFrames, fps ), m_width( 0 ), m_height( 0 ),
+                        int fps, int nbLoops ):
+    GenericBitmap( pIntf, nbFrames, fps, nbLoops ), m_width( 0 ), m_height( 0 ),
     m_pData( NULL )
 {
     video_format_t fmt_in = {0}, fmt_out = {0};
     picture_t *pPic;
 
-    fmt_out.i_chroma = VLC_FOURCC('R','V','3','2');
+    fmt_out.i_chroma = VLC_CODEC_RGBA;
+
+    char* psz_uri = make_URI( fileName.c_str(), NULL );
+    pPic = image_ReadUrl( pImageHandler, psz_uri, &fmt_in, &fmt_out );
+    free( psz_uri );
 
-    pPic = image_ReadUrl( pImageHandler, fileName.c_str(), &fmt_in, &fmt_out );
-    if( !pPic ) return;
+    if( !pPic )
+        return;
 
     m_width = fmt_out.i_width;
     m_height = fmt_out.i_height;
@@ -51,13 +60,14 @@ FileBitmap::FileBitmap( intf_thread_t *pIntf, image_handler_t *pImageHandler,
     {
         for( int x = 0; x < m_width; x++ )
         {
-            uint32_t b = *(pSrc++);
-            uint32_t g = *(pSrc++);
-            uint32_t r = *(pSrc++);
-            uint8_t a = *(pSrc++);
-            *(pData++) = (b * a) >> 8;
-            *(pData++) = (g * a) >> 8;
-            *(pData++) = (r * a) >> 8;
+            uint32_t r = *pSrc++;
+            uint32_t g = *pSrc++;
+            uint32_t b = *pSrc++;
+            uint8_t  a = *pSrc++;
+
+            *(pData++) = b * a / 255;
+            *(pData++) = g * a / 255;
+            *(pData++) = r * a / 255;
 
             // Transparent pixel ?
             if( aColor == (r<<16 | g<<8 | b) )
@@ -73,14 +83,14 @@ FileBitmap::FileBitmap( intf_thread_t *pIntf, image_handler_t *pImageHandler,
         pSrc += pPic->p->i_pitch - m_width * 4;
     }
 
-    pPic->pf_release( pPic );
+    picture_Release( pPic );
     return;
 }
 
 
 FileBitmap::~FileBitmap()
 {
-    if( m_pData ) delete[] m_pData;
+    delete[] m_pData;
 }