Permalink
Browse files

[droid] intercept android icons and skip decoding them

These are raw bitmaps, render them untouched.

TODO: detect bpp rather than assuming 32 (though it seems to be a safe
assumption currently)
  • Loading branch information...
1 parent 73d6689 commit c09c8496e7e36472146cb11732702ec6b485485a Cory Fields committed Jul 27, 2012
Showing with 26 additions and 1 deletion.
  1. +26 −1 xbmc/guilib/Texture.cpp
@@ -32,7 +32,10 @@
#include "filesystem/File.h"
#include "osx/DarwinUtils.h"
#endif
-
+#if defined(TARGET_ANDROID)
+#include "URL.h"
+#include "filesystem/AndroidAppFile.h"
+#endif
/************************************************************************/
/* */
/************************************************************************/
@@ -183,6 +186,28 @@ void CBaseTexture::ClampToEdge()
CBaseTexture *CBaseTexture::LoadFromFile(const CStdString& texturePath, unsigned int idealWidth, unsigned int idealHeight, bool autoRotate)
{
+#if defined(TARGET_ANDROID)
+ CURL url(texturePath);
+ if (url.GetProtocol() == "androidapp")
+ {
+ XFILE::CFileAndroidApp file;
+ if (file.Open(url))
+ {
+ unsigned int imgsize = (unsigned int)file.GetLength();
+ unsigned char* inputBuff = new unsigned char[imgsize];
+ unsigned int inputBuffSize = file.Read(inputBuff, imgsize);
+ file.Close();
+ if (inputBuffSize != imgsize)
+ return NULL;
+ CTexture *texture = new CTexture();
+ unsigned int width = file.GetIconWidth();
+ unsigned int height = file.GetIconHeight();
+ texture->LoadFromMemory(width, height, width*4, XB_FMT_RGBA8, true, inputBuff);
+ delete [] inputBuff;
+ return texture;
+ }
+ }
+#endif
CTexture *texture = new CTexture();
if (texture->LoadFromFile(texturePath, idealWidth, idealHeight, autoRotate, NULL, NULL))
return texture;

0 comments on commit c09c849

Please sign in to comment.