diff options
author | George Hazan <george.hazan@gmail.com> | 2016-01-05 19:19:47 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-01-05 19:19:47 +0000 |
commit | 3a124ae7cbef494482be0da4ee92b1ee44178f40 (patch) | |
tree | 7b6e11f7ef17123076289b191430e6ff07e96ab9 /src | |
parent | 1ec34c5a5d1888377616142f7391bf1914451e31 (diff) |
more claning
git-svn-id: http://svn.miranda-ng.org/main/trunk@16028 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/IcoLib.h | 9 | ||||
-rw-r--r-- | src/mir_app/src/icolib.cpp | 34 |
2 files changed, 23 insertions, 20 deletions
diff --git a/src/mir_app/src/IcoLib.h b/src/mir_app/src/IcoLib.h index acaa11b327..67e1ea779c 100644 --- a/src/mir_app/src/IcoLib.h +++ b/src/mir_app/src/IcoLib.h @@ -47,19 +47,16 @@ struct IconSourceItemKey int cx, cy;
};
-class IconSourceItem : public MZeroedObject, public IconSourceItemKey
+class IconSourceItem : public MZeroedObject
{
+ IconSourceItemKey key;
int ref_count;
BYTE* icon_data;
int icon_size;
public:
- __inline IconSourceItem(IconSourceFile *_file, int _indx, int _cxIcon, int _cyIcon) :
- ref_count(1)
- {
- file = _file; indx = _indx; cx = _cxIcon; cy = _cyIcon;
- }
+ IconSourceItem(const IconSourceItemKey&);
~IconSourceItem();
__inline void addRef() { ref_count++; }
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index f3c7fe2d05..e22acb338d 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -189,9 +189,15 @@ static int InternalGetDIB(HBITMAP bitmap, HPALETTE palette, void *bitmapInfo, vo #define VER30 0x00030000
+IconSourceItem::IconSourceItem(const IconSourceItemKey &_key)
+ : key(_key),
+ ref_count(1)
+{
+}
+
IconSourceItem::~IconSourceItem()
{
- IconSourceFile_Release(file);
+ IconSourceFile_Release(key.file);
SafeDestroyIcon(icon);
mir_free(icon_data);
}
@@ -204,15 +210,14 @@ HICON IconSourceItem::getIcon() }
if (icon_size) {
- icon = CreateIconFromResourceEx(icon_data, icon_size, TRUE, VER30, cx, cy, LR_COLOR);
+ icon = CreateIconFromResourceEx(icon_data, icon_size, TRUE, VER30, key.cx, key.cy, LR_COLOR);
if (icon) {
icon_ref_count++;
return icon;
}
}
- //SHOULD BE REPLACED WITH GOOD ENOUGH FUNCTION
- _ExtractIconEx(file->file, indx, cx, cy, &icon, LR_COLOR);
+ _ExtractIconEx(key.file->file, key.indx, key.cx, key.cy, &icon, LR_COLOR);
if (icon)
icon_ref_count++;
@@ -283,28 +288,28 @@ int IconSourceItem::releaseIcon() int IconSourceItem::compare(const IconSourceItem *p1, const IconSourceItem *p2)
{
- if (p1->indx < p2->indx)
+ if (p1->key.indx < p2->key.indx)
return -1;
- if (p1->indx > p2->indx)
+ if (p1->key.indx > p2->key.indx)
return 1;
- if (p1->cx < p2->cx)
+ if (p1->key.cx < p2->key.cx)
return -1;
- if (p1->cx > p2->cx)
+ if (p1->key.cx > p2->key.cx)
return 1;
- if (p1->cy < p2->cy)
+ if (p1->key.cy < p2->key.cy)
return -1;
- if (p1->cy > p2->cy)
+ if (p1->key.cy > p2->key.cy)
return 1;
- if (p1->file == p2->file)
+ if (p1->key.file == p2->key.file)
return 0;
- return (p1->file > p2->file) ? 1 : -1;
+ return (p1->key.file > p2->key.file) ? 1 : -1;
}
IconSourceItem* GetIconSourceItem(const TCHAR *file, int indx, int cxIcon, int cyIcon)
@@ -321,7 +326,7 @@ IconSourceItem* GetIconSourceItem(const TCHAR *file, int indx, int cxIcon, int c return iconSourceList[ix];
}
- IconSourceItem *newItem = new IconSourceItem(r_file, indx, cxIcon, cyIcon);
+ IconSourceItem *newItem = new IconSourceItem(key);
iconSourceList.insert(newItem);
return newItem;
}
@@ -350,7 +355,8 @@ IconSourceItem* CreateStaticIconSourceItem(int cxIcon, int cyIcon) TCHAR tszName[100];
mir_sntprintf(tszName, _T("*StaticIcon_%d"), iStaticCount++);
- IconSourceItem *newItem = new IconSourceItem(IconSourceFile_Get(tszName, false), 0, cxIcon, cyIcon);
+ IconSourceItemKey key = { IconSourceFile_Get(tszName, false), 0, cxIcon, cyIcon };
+ IconSourceItem *newItem = new IconSourceItem(key);
iconSourceList.insert(newItem);
return newItem;
}
|