summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-04-03 12:27:09 +0300
committerAndrei Karas <akaras@inbox.ru>2014-04-03 12:27:09 +0300
commit2947d6af4334a736eab6ea1ad8147239311ea027 (patch)
treeb58e2f2f5ad4f0ee970821464ad6f01f07c85bd0 /src/gui
parentda87d0f7ce54182e3ea89a512ce3c24d5d06405e (diff)
downloadplus-2947d6af4334a736eab6ea1ad8147239311ea027.tar.gz
plus-2947d6af4334a736eab6ea1ad8147239311ea027.tar.bz2
plus-2947d6af4334a736eab6ea1ad8147239311ea027.tar.xz
plus-2947d6af4334a736eab6ea1ad8147239311ea027.zip
Remove duplicate code from theme.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/theme.cpp35
1 files changed, 15 insertions, 20 deletions
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 6fa007e06..1b1955647 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -1126,6 +1126,19 @@ void Theme::loadColors(std::string file)
}
}
+#define loadGrid() \
+ { \
+ const ImageRect &rect = skin->getBorder(); \
+ for (int f = start; f <= end; f ++) \
+ { \
+ if (rect.grid[f]) \
+ { \
+ image.grid[f] = rect.grid[f]; \
+ image.grid[f]->incRef(); \
+ } \
+ } \
+ }
+
void Theme::loadRect(ImageRect &image,
const std::string &name,
const std::string &name2,
@@ -1135,15 +1148,7 @@ void Theme::loadRect(ImageRect &image,
Skin *const skin = load(name, name2, false);
if (skin)
{
- const ImageRect &rect = skin->getBorder();
- for (int f = start; f <= end; f ++)
- {
- if (rect.grid[f])
- {
- image.grid[f] = rect.grid[f];
- image.grid[f]->incRef();
- }
- }
+ loadGrid();
unload(skin);
}
}
@@ -1156,17 +1161,7 @@ Skin *Theme::loadSkinRect(ImageRect &image,
{
Skin *const skin = load(name, name2);
if (skin)
- {
- const ImageRect &rect = skin->getBorder();
- for (int f = start; f <= end; f ++)
- {
- if (rect.grid[f])
- {
- image.grid[f] = rect.grid[f];
- image.grid[f]->incRef();
- }
- }
- }
+ loadGrid();
return skin;
}