diff options
author | louis <louis.braun@gmx.de> | 2013-01-17 13:16:44 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2013-01-17 13:16:44 +0100 |
commit | 47c3fea545a1b4607deda1e7d2fa51cbcf89a656 (patch) | |
tree | 4109469360bfb71ce467c240a33d0738ad44c18e /osdmanager.c | |
download | vdr-plugin-tvguide-47c3fea545a1b4607deda1e7d2fa51cbcf89a656.tar.gz vdr-plugin-tvguide-47c3fea545a1b4607deda1e7d2fa51cbcf89a656.tar.bz2 |
Initial push tvguide 0.0.1
Diffstat (limited to 'osdmanager.c')
-rw-r--r-- | osdmanager.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/osdmanager.c b/osdmanager.c new file mode 100644 index 0000000..fb0ec6e --- /dev/null +++ b/osdmanager.c @@ -0,0 +1,52 @@ +#ifndef __TVGUIDE_OSDMANAGER_H
+#define __TVGUIDE_OSDMANAGER_H
+
+class cOsdManager {
+ private:
+ cOsd *osd;
+ int activePixmaps;
+ public:
+ cOsdManager(void);
+ bool setOsd();
+ void setBackground();
+ void flush() {osd->Flush();};
+ cPixmap *requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null, const char *caller = "anonymous");
+ void releasePixmap(cPixmap *pixmap, const char *caller = "anonymous");
+ void deleteOsd() {delete osd;};
+ int Width() { return osd->Width(); };
+ int Height() { return osd->Height(); };
+};
+
+#endif //__TVGUIDE_OSDMANAGER_H
+
+cOsdManager::cOsdManager(void) {
+ activePixmaps = 0;
+}
+
+bool cOsdManager::setOsd() {
+ osd = cOsdProvider::NewOsd(cOsd::OsdLeft(), cOsd::OsdTop());
+ if (osd) {
+ tArea Area = { 0, 0, cOsd::OsdWidth(), cOsd::OsdHeight(), 32 };
+ if (osd->SetAreas(&Area, 1) == oeOk) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void cOsdManager::setBackground() {
+ osd->DrawRectangle(0, 0, cOsd::OsdWidth(), cOsd::OsdHeight(), theme.Color(clrBackgroundOSD));
+}
+cPixmap *cOsdManager::requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort, const char *caller) {
+ if (activePixmaps >= 64)
+ return NULL;
+ activePixmaps++;
+ //esyslog("tvguide: Pixmap angefordert von %s, verwendet: %d", caller, activePixmaps);
+ return osd->CreatePixmap(Layer, ViewPort, DrawPort);
+ }
+
+void cOsdManager::releasePixmap(cPixmap *pixmap, const char *caller) {
+ activePixmaps--;
+ //esyslog("tvguide: Pixmap geloescht von %s, verwendet: %d", caller, activePixmaps);
+ osd->DestroyPixmap(pixmap);
+}
\ No newline at end of file |