aboutsummaryrefslogtreecommitdiff
path: root/guilib
diff options
context:
space:
mode:
authorjmarshallnz <jmarshallnz@svn>2009-09-23 02:42:37 +0000
committerjmarshallnz <jmarshallnz@svn>2009-09-23 02:42:37 +0000
commitadab057db495446713b6ff665614ef16a0d7f992 (patch)
treef821eaa9ca234eaa3d69ca26479d7a6bc541a735 /guilib
parent1001353789febdece3420424c8e4cf291a88a946 (diff)
cleanup: Indicate why system.h is included in a header, and remove where reasonable.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@23100 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib')
-rw-r--r--guilib/FrameBufferObject.h2
-rw-r--r--guilib/Shader.h2
-rw-r--r--guilib/TextureBundle.cpp28
-rw-r--r--guilib/TextureBundle.h13
-rw-r--r--guilib/common/SDLJoystick.h2
-rw-r--r--guilib/gui3d.h2
6 files changed, 22 insertions, 27 deletions
diff --git a/guilib/FrameBufferObject.h b/guilib/FrameBufferObject.h
index cc3d679daf..6134678e22 100644
--- a/guilib/FrameBufferObject.h
+++ b/guilib/FrameBufferObject.h
@@ -22,7 +22,7 @@
*
*/
-#include "system.h"
+#include "system.h" // for HAS_GL
#ifdef HAS_GL
diff --git a/guilib/Shader.h b/guilib/Shader.h
index b9d6775dc8..b3e70f6fbf 100644
--- a/guilib/Shader.h
+++ b/guilib/Shader.h
@@ -22,7 +22,7 @@
*
*/
-#include "system.h"
+#include "system.h" // for HAS_GL/HAS_GLES
#include <vector>
#include <string>
diff --git a/guilib/TextureBundle.cpp b/guilib/TextureBundle.cpp
index 6d7176c9a6..2089802172 100644
--- a/guilib/TextureBundle.cpp
+++ b/guilib/TextureBundle.cpp
@@ -246,16 +246,13 @@ void CTextureBundle::GetTexturesFromPath(const CStdString &path, std::vector<CSt
}
}
-HRESULT CTextureBundle::LoadFile(const CStdString& Filename, CAutoTexBuffer& UnpackedBuf)
+bool CTextureBundle::LoadFile(const CStdString& Filename, CAutoTexBuffer& UnpackedBuf)
{
- if (Filename == "-")
- return 0;
-
CStdString name = Normalize(Filename);
std::map<CStdString, FileHeader_t>::iterator file = m_FileHeaders.find(name);
if (file == m_FileHeaders.end())
- return E_FAIL;
+ return false;
// found texture - allocate the necessary buffers
DWORD ReadSize = (file->second.PackedSize + (ALIGN - 1)) & ~(ALIGN - 1);
@@ -280,7 +277,7 @@ HRESULT CTextureBundle::LoadFile(const CStdString& Filename, CAutoTexBuffer& Unp
info.totalram);
#endif
free(buffer);
- return E_OUTOFMEMORY;
+ return false;
}
// read the file into our buffer
@@ -291,17 +288,17 @@ HRESULT CTextureBundle::LoadFile(const CStdString& Filename, CAutoTexBuffer& Unp
{
CLog::Log(LOGERROR, "Error loading texture: %s: %s", Filename.c_str(), strerror(ferror(m_hFile)));
free(buffer);
- return E_FAIL;
+ return false;
}
// allocate a buffer for our unpacked texture
lzo_uint s = file->second.UnpackedSize;
- HRESULT hr = S_OK;
+ bool success = true;
if (lzo1x_decompress(buffer, file->second.PackedSize, UnpackedBuf, &s, NULL) != LZO_E_OK ||
s != file->second.UnpackedSize)
{
CLog::Log(LOGERROR, "Error loading texture: %s: Decompression error", Filename.c_str());
- hr = E_FAIL;
+ success = false;
}
try
@@ -313,19 +310,18 @@ HRESULT CTextureBundle::LoadFile(const CStdString& Filename, CAutoTexBuffer& Unp
CLog::Log(LOGERROR, "Error freeing preload buffer.");
}
- return hr;
+ return success;
}
-HRESULT CTextureBundle::LoadTexture(const CStdString& Filename, CBaseTexture** ppTexture,
+bool CTextureBundle::LoadTexture(const CStdString& Filename, CBaseTexture** ppTexture,
int &width, int &height)
{
DWORD ResDataOffset;
*ppTexture = NULL;
CAutoTexBuffer UnpackedBuf;
- HRESULT r = LoadFile(Filename, UnpackedBuf);
- if (r != S_OK)
- return r;
+ if (!LoadFile(Filename, UnpackedBuf))
+ return false;
D3DTexture *pTex = (D3DTexture *)(new char[sizeof (D3DTexture)]);
D3DPalette* pPal = 0;
@@ -378,13 +374,13 @@ HRESULT CTextureBundle::LoadTexture(const CStdString& Filename, CBaseTexture** p
pInfo->Format = desc.Format;
#endif
*/
- return S_OK;
+ return true;
PackedLoadError:
CLog::Log(LOGERROR, "Error loading texture: %s: Invalid data", Filename.c_str());
delete[] pTex;
delete pPal;
- return E_FAIL;
+ return false;
}
int CTextureBundle::LoadAnim(const CStdString& Filename, CBaseTexture*** ppTextures,
diff --git a/guilib/TextureBundle.h b/guilib/TextureBundle.h
index c538d760a3..5ae9aebca0 100644
--- a/guilib/TextureBundle.h
+++ b/guilib/TextureBundle.h
@@ -22,8 +22,7 @@
*/
#include "StdString.h"
-#include "system.h"
-
+#include <stdint.h>
#include <map>
class CAutoTexBuffer;
@@ -33,9 +32,9 @@ class CTextureBundle
{
struct FileHeader_t
{
- DWORD Offset;
- DWORD UnpackedSize;
- DWORD PackedSize;
+ uint32_t Offset;
+ uint32_t UnpackedSize;
+ uint32_t PackedSize;
};
FILE* m_hFile;
@@ -47,7 +46,7 @@ class CTextureBundle
bool m_themeBundle;
bool OpenBundle();
- HRESULT LoadFile(const CStdString& Filename, CAutoTexBuffer& UnpackedBuf);
+ bool LoadFile(const CStdString& Filename, CAutoTexBuffer& UnpackedBuf);
public:
CTextureBundle(void);
@@ -60,7 +59,7 @@ public:
void GetTexturesFromPath(const CStdString &path, std::vector<CStdString> &textures);
static CStdString Normalize(const CStdString &name);
- HRESULT LoadTexture(const CStdString& Filename, CBaseTexture** ppTexture,
+ bool LoadTexture(const CStdString& Filename, CBaseTexture** ppTexture,
int &width, int &height);
int LoadAnim(const CStdString& Filename, CBaseTexture*** ppTextures,
diff --git a/guilib/common/SDLJoystick.h b/guilib/common/SDLJoystick.h
index 1aa89fecd4..202593422e 100644
--- a/guilib/common/SDLJoystick.h
+++ b/guilib/common/SDLJoystick.h
@@ -1,7 +1,7 @@
#ifndef SDL_JOYSTICK_H
#define SDL_JOYSTICK_H
-#include "../system.h"
+#include "../system.h" // for HAS_SDL_JOYSTICK
#include <vector>
#include <string>
diff --git a/guilib/gui3d.h b/guilib/gui3d.h
index 9ce1d988fb..b12a85e573 100644
--- a/guilib/gui3d.h
+++ b/guilib/gui3d.h
@@ -28,7 +28,7 @@
*
*/
-#include "system.h"
+#include "system.h" // for WIN32 types
#define GAMMA_RAMP_FLAG D3DSGR_CALIBRATE