[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / guilib / TextureBundle.cpp
1 /*
2  *      Copyright (C) 2005-2013 Team XBMC
3  *      http://www.xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 #include "system.h"
22 #include "TextureBundle.h"
23
24 CTextureBundle::CTextureBundle(void)
25 {
26   m_useXPR = false;
27   m_useXBT = false;
28 }
29
30 CTextureBundle::~CTextureBundle(void)
31 {
32 }
33
34 bool CTextureBundle::HasFile(const CStdString& Filename)
35 {
36   if (m_useXBT)
37   {
38     return m_tbXBT.HasFile(Filename);
39   }
40   else if (m_useXPR)
41   {
42     return m_tbXPR.HasFile(Filename);
43   }
44   else if (m_tbXBT.HasFile(Filename))
45   {
46     m_useXBT = true;
47     return true;
48   }
49   else if (m_tbXPR.HasFile(Filename))
50   {
51     m_useXPR = true;
52     return true;
53   }
54   else
55   {
56     return false;
57   }
58 }
59
60 void CTextureBundle::GetTexturesFromPath(const CStdString &path, std::vector<CStdString> &textures)
61 {
62   if (m_useXBT)
63   {
64     m_tbXBT.GetTexturesFromPath(path, textures);
65   }
66   else if (m_useXPR)
67   {
68     m_tbXPR.GetTexturesFromPath(path, textures);
69   }
70 }
71
72 bool CTextureBundle::LoadTexture(const CStdString& Filename, CBaseTexture** ppTexture,
73                                      int &width, int &height)
74 {
75   if (m_useXBT)
76   {
77     return m_tbXBT.LoadTexture(Filename, ppTexture, width, height);
78   }
79   else if (m_useXPR)
80   {
81     return m_tbXPR.LoadTexture(Filename, ppTexture, width, height);
82   }
83   else
84   {
85     return false;
86   }
87 }
88
89 int CTextureBundle::LoadAnim(const CStdString& Filename, CBaseTexture*** ppTextures,
90                               int &width, int &height, int& nLoops, int** ppDelays)
91 {
92   if (m_useXBT)
93   {
94     return m_tbXBT.LoadAnim(Filename, ppTextures, width, height, nLoops, ppDelays);
95   }
96   else if (m_useXPR)
97   {
98     return m_tbXPR.LoadAnim(Filename, ppTextures, width, height, nLoops, ppDelays);
99   }
100   else
101   {
102     return 0;
103   }
104 }
105
106 void CTextureBundle::Cleanup()
107 {
108   m_tbXBT.Cleanup();
109   m_tbXPR.Cleanup();
110   m_useXPR = m_useXBT = false;
111 }
112
113 void CTextureBundle::SetThemeBundle(bool themeBundle)
114 {
115   m_tbXPR.SetThemeBundle(themeBundle);
116   m_tbXBT.SetThemeBundle(themeBundle);
117 }
118
119 CStdString CTextureBundle::Normalize(const CStdString &name)
120 {
121   return CTextureBundleXBT::Normalize(name);
122 }