5#include "helper/SDpiScale.h"
13 : m_bAutoScale(bAutoScale)
22 SSLOGD() <<
"####Detecting Defined Skin Usage BEGIN";
27 if (!m_mapSkinUseCount.Lookup(skinKey))
29 SSLOGD() <<
"skin of [" << skinKey.strName.
c_str() <<
"." << skinKey.scale <<
"] was not used.";
32 SSLOGD() <<
"!!!!Detecting Defined Skin Usage END";
50 if (nScale != -1 && pSkin->
GetScale() == 100)
57 SSLOGW() <<
"load skin duplicated found,type=" << strTypeName <<
"name=" << strSkinName;
65 SSLOGW() <<
"load skin error,type=" << strTypeName <<
"name=" << strSkinName;
100 GETUIDEF->PushSkinPool(
this);
102 GETUIDEF->PopSkinPool(
this);
118 SkinKey key = { pSkin->GetName(), pSkin->GetScale() };
124 SkinKey key = { strSkinName, nScale };
135 const int kMaxBuiltinScales = 20;
137 int nScales[kMaxBuiltinScales] = { 0 };
145 nScales[findScales++] = key.scale;
146 if (nScale > key.scale)
148 if (nScale % key.scale == 0)
150 bestScale = key.scale;
156 if (key.scale % nScale == 0)
158 bestScale = key.scale;
167 bestScale = nScales[0];
168 key.scale = bestScale;
180 m_mapSkinUseCount[key]++;
Skin Object Pool Management.
virtual ISkinObj * CreateSkinByName(LPCWSTR pszSkinClass) const
Create a skin by name.
void RemoveAll()
Removes all key-object pairs from the map.
bool GetKeyObject(const SkinKey &key, SSkinPtr &obj) const
SMap< SkinKey, SSkinPtr > * m_mapNamedObj
bool AddKeyObject(const SkinKey &key, const SSkinPtr &obj)
bool RemoveKeyObject(const SkinKey &key)
bool HasKey(const SkinKey &key) const
void(* m_pFunOnKeyRemoved)(const SSkinPtr &obj)
static const int * GetBuiltinScales()
获取内置的缩放比例数组
static int NormalizeScale(int nScale)
标准化放大比例
static int GetBuiltinScaleCount()
获取内置的缩放比例数量
static SApplication & getSingleton(void)
int _LoadSkins(SXmlNode xmlNode)
Loads skins from an XML node.
BOOL RemoveSkin(ISkinObj *skin) OVERRIDE
Removes a skin object from the pool.
static void OnKeyRemoved(const SSkinPtr &obj)
Callback function called when a skin object is removed from the pool.
ISkinObj * GetSkin(LPCWSTR strSkinName, int nScale) OVERRIDE
Retrieves a skin object by name and scale.
ISkinObj * _LoadSkin(SXmlNode xmlNode, int nScale)
Loads a single skin from an XML node.
void RemoveAll() OVERRIDE
Removes all skin objects from the pool.
BOOL AddSkin(ISkinObj *skin) OVERRIDE
Adds a skin object to the pool.
virtual ~SSkinPool()
Destructor.
SSkinPool(BOOL bAutoScale=TRUE)
Constructor.
int LoadSkins(IXmlNode *xmlNode) OVERRIDE
Loads skins from an XML node.
A class representing an ASCII string.
int CompareNoCase(const wchar_t *psz) SCONST
Compares the string with another string, ignoring case.
const wchar_t * c_str() SCONST
Retrieves a C-style string representation of the string.
BOOL IsEmpty() SCONST
Checks if the string is empty.
int as_int(int def=0) const
Converts the attribute value to an integer.
const wchar_t * value() const
Gets the attribute value.
Class representing an XML node.
SXmlNode next_sibling() const
Gets the next sibling node in the children list of the parent node.
SXmlNode first_child() const
Gets the first child node of the node.
const wchar_t * name() const
Gets the name of the node.
SXmlAttr attribute(const wchar_t *name, bool bCaseSensitive=false) const
Gets the attribute with the specified name.
Key for identifying a skin object in the pool.
Interface for Skin Objects.
int GetScale() SCONST PURE
Retrieves the scaling factor of the skin object.
long AddRef() PURE
Add reference.
BOOL InitFromXml(IXmlNode *xmlNode) PURE
Initializes the object from an XML node.
long Release() PURE
Release reference.
void SetScale(int scale) PURE
Sets the scaling factor of the skin object.
ISkinObj * Scale(int nScale) PURE
Scales the skin object by a specified factor.
LPCWSTR GetName() SCONST PURE
Retrieves the name of the object.