summaryrefslogtreecommitdiff
path: root/displaymessage.c
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2013-09-29 12:03:45 +0200
committerlouis <louis.braun@gmx.de>2013-09-29 12:03:45 +0200
commitacce422dcfe6bb57818f062b3a6e2db99b4cb2d3 (patch)
tree33d129161784818b95890a656c7a802f1118bfed /displaymessage.c
parent9a0778bbdf309018a635229bd0523b3435388978 (diff)
downloadskin-nopacity-acce422dcfe6bb57818f062b3a6e2db99b4cb2d3.tar.gz
skin-nopacity-acce422dcfe6bb57818f062b3a6e2db99b4cb2d3.tar.bz2
Added Cache for images and fonts
Diffstat (limited to 'displaymessage.c')
-rw-r--r--displaymessage.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/displaymessage.c b/displaymessage.c
index 894d8d8..b512a44 100644
--- a/displaymessage.c
+++ b/displaymessage.c
@@ -1,19 +1,17 @@
#include "displaymessage.h"
-cNopacityDisplayMessage::cNopacityDisplayMessage(void) {
+cNopacityDisplayMessage::cNopacityDisplayMessage(cImageCache *imgCache) {
+ this->imgCache = imgCache;
config.setDynamicValues();
- height = cOsd::OsdHeight() * config.messageHeight / 100;
- int top = cOsd::OsdTop() + cOsd::OsdHeight() - height - config.messageBorderBottom;
- width = cOsd::OsdWidth() * config.messageWidth / 100;
- int left = (cOsd::OsdLeft() + cOsd::OsdWidth() - width) / 2;
- osd = CreateOsd(left, top, width, height);
- pixmap = osd->CreatePixmap(2, cRect(0, 0, width, height));
- pixmapBackground = osd->CreatePixmap(1, cRect(0, 0, width, height));
+ int top = geoManager->osdTop + geoManager->osdHeight - geoManager->messageHeight - config.messageBorderBottom;
+ int left = (geoManager->osdLeft + geoManager->osdWidth - geoManager->messageWidth) / 2;
+ osd = CreateOsd(left, top, geoManager->messageWidth, geoManager->messageHeight);
+ pixmap = osd->CreatePixmap(2, cRect(0, 0, geoManager->messageWidth, geoManager->messageHeight));
+ pixmapBackground = osd->CreatePixmap(1, cRect(0, 0, geoManager->messageWidth, geoManager->messageHeight));
if (config.messageFadeTime) {
pixmap->SetAlpha(0);
pixmapBackground->SetAlpha(0);
}
- font = cFont::CreateFont(config.fontName, height / 4 + 15 + config.fontMessage);
FrameTime = config.messageFrameTime;
FadeTime = config.messageFadeTime;
}
@@ -24,7 +22,6 @@ cNopacityDisplayMessage::~cNopacityDisplayMessage() {
cCondWait::SleepMs(10);
osd->DestroyPixmap(pixmap);
osd->DestroyPixmap(pixmapBackground);
- delete font;
delete osd;
}
@@ -52,15 +49,14 @@ void cNopacityDisplayMessage::SetMessage(eMessageType Type, const char *Text) {
pixmapBackground->Fill(clrBlack);
pixmap->Fill(col);
if (config.doBlending) {
- cImageLoader imgLoader;
- imgLoader.DrawBackground2(Theme.Color(clrMessageBlend), col, width-2, height-2);
- pixmap->DrawImage(cPoint(1, 1), imgLoader.GetImage());
+ cImage imgBack = imgCache->GetBackground(Theme.Color(clrMessageBlend), col, geoManager->messageWidth-2, geoManager->messageHeight-2, true);
+ pixmap->DrawImage(cPoint(1, 1), imgBack);
}
if (config.roundedCorners) {
- DrawRoundedCornersWithBorder(pixmap, col, config.cornerRadius, width, height, pixmapBackground);
+ DrawRoundedCornersWithBorder(pixmap, col, config.cornerRadius, geoManager->messageWidth, geoManager->messageHeight, pixmapBackground);
}
- int textWidth = font->Width(Text);
- pixmap->DrawText(cPoint((width - textWidth) / 2, (height - font->Height()) / 2), Text, colFont, (config.doBlending)?clrTransparent:col, font);
+ int textWidth = fontManager->messageText->Width(Text);
+ pixmap->DrawText(cPoint((geoManager->messageWidth - textWidth) / 2, (geoManager->messageHeight - fontManager->messageText->Height()) / 2), Text, colFont, (config.doBlending)?clrTransparent:col, fontManager->messageText);
if (config.messageFadeTime)
Start();
}