2019-07-11 11:07:13 +02:00
|
|
|
#include "config.h"
|
|
|
|
#include "osdmanager.h"
|
|
|
|
|
|
|
|
cOsdManager::cOsdManager(void) {
|
2019-11-10 15:37:28 +01:00
|
|
|
osd = NULL;
|
2019-07-11 11:07:13 +02:00
|
|
|
}
|
|
|
|
|
2019-11-10 15:37:28 +01:00
|
|
|
void cOsdManager::Lock(void) {
|
|
|
|
mutex.Lock();
|
|
|
|
}
|
|
|
|
|
|
|
|
void cOsdManager::Unlock(void) {
|
|
|
|
mutex.Unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cOsdManager::CreateOsd(void) {
|
2019-07-11 11:07:13 +02:00
|
|
|
osd = cOsdProvider::NewOsd(cOsd::OsdLeft(), cOsd::OsdTop());
|
|
|
|
if (osd) {
|
2020-03-11 14:58:42 +01:00
|
|
|
tArea Area = { 0, 0, cOsd::OsdWidth() - 1, cOsd::OsdHeight() - 1, 32 };
|
2019-07-11 11:07:13 +02:00
|
|
|
if (osd->SetAreas(&Area, 1) == oeOk) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-11-10 15:37:28 +01:00
|
|
|
void cOsdManager::DeleteOsd(void) {
|
|
|
|
Lock();
|
|
|
|
delete osd;
|
|
|
|
osd = NULL;
|
|
|
|
Unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
void cOsdManager::SetBackground(void) {
|
2019-07-11 11:07:13 +02:00
|
|
|
|
2019-07-11 11:28:11 +02:00
|
|
|
if (config.displayStatusHeader && config.scaleVideo) {
|
2019-07-11 11:07:13 +02:00
|
|
|
int widthStatus = cOsd::OsdWidth() - geoManager.statusHeaderHeight * 16 / 9;
|
|
|
|
osd->DrawRectangle(0, 0, widthStatus, geoManager.statusHeaderHeight, theme.Color(clrBackgroundOSD));
|
|
|
|
osd->DrawRectangle(0, geoManager.statusHeaderHeight, Width(), Height(), theme.Color(clrBackgroundOSD));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
osd->DrawRectangle(0, 0, Width(), Height(), theme.Color(clrBackgroundOSD));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-11-10 15:37:28 +01:00
|
|
|
cPixmap *cOsdManager::CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort) {
|
|
|
|
if (osd)
|
|
|
|
return osd->CreatePixmap(Layer, ViewPort, DrawPort);
|
|
|
|
return NULL;
|
2019-07-11 11:07:13 +02:00
|
|
|
}
|
|
|
|
|
2019-11-10 15:37:28 +01:00
|
|
|
void cOsdManager::DestroyPixmap(cPixmap *pixmap) {
|
|
|
|
if (!osd || !pixmap)
|
2019-07-11 11:07:13 +02:00
|
|
|
return;
|
|
|
|
osd->DestroyPixmap(pixmap);
|
|
|
|
}
|
2019-11-10 15:37:28 +01:00
|
|
|
|
|
|
|
void cOsdManager::Flush(void) {
|
|
|
|
if (osd) {
|
|
|
|
osd->Flush();
|
|
|
|
}
|
|
|
|
}
|