1
0
mirror of https://github.com/jojo61/vdr-plugin-softhdcuvid.git synced 2023-10-10 13:37:41 +02:00

Fix for Layer0 Pixmap alpha

This commit is contained in:
jojo61 2023-08-07 13:46:33 +02:00
parent 838dfab45b
commit e59eeba0d2
2 changed files with 28 additions and 8 deletions

View File

@ -726,14 +726,15 @@ bool cOglCmdDeleteFb::Execute(void) {
//------------------ cOglCmdRenderFbToBufferFb -------------------- //------------------ cOglCmdRenderFbToBufferFb --------------------
cOglCmdRenderFbToBufferFb::cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, cOglCmdRenderFbToBufferFb::cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency,
GLint drawPortX, GLint drawPortY) GLint drawPortX, GLint drawPortY, bool alphablending)
: cOglCmd(fb) { : cOglCmd(fb) {
this->buffer = buffer; this->buffer = buffer;
this->x = (GLfloat)x; this->x = (GLfloat)x;
this->y = (GLfloat)y; this->y = (GLfloat)y;
this->drawPortX = (GLfloat)drawPortX; this->drawPortX = (GLfloat)drawPortX;
this->drawPortY = (GLfloat)drawPortY; this->drawPortY = (GLfloat)drawPortY;
this->transparency = transparency; this->transparency = (alphablending ? transparency : ALPHA_OPAQUE);
this->alphablending = alphablending;
} }
bool cOglCmdRenderFbToBufferFb::Execute(void) { bool cOglCmdRenderFbToBufferFb::Execute(void) {
@ -773,11 +774,14 @@ bool cOglCmdRenderFbToBufferFb::Execute(void) {
if (!fb->BindTexture()) if (!fb->BindTexture())
return false; return false;
if (!alphablending)
VertexBuffers[vbTexture]->DisableBlending();
VertexBuffers[vbTexture]->Bind(); VertexBuffers[vbTexture]->Bind();
VertexBuffers[vbTexture]->SetVertexData(quadVertices); VertexBuffers[vbTexture]->SetVertexData(quadVertices);
VertexBuffers[vbTexture]->DrawArrays(); VertexBuffers[vbTexture]->DrawArrays();
VertexBuffers[vbTexture]->Unbind(); VertexBuffers[vbTexture]->Unbind();
if (!alphablending)
VertexBuffers[vbTexture]->EnableBlending();
buffer->Unbind(); buffer->Unbind();
return true; return true;
@ -2096,6 +2100,14 @@ cPixmap *cOglOsd::CreatePixmap(int Layer, const cRect &ViewPort, const cRect &Dr
return NULL; return NULL;
} }
extern "C" {void VideoSetOsdSize(int, int ) ;}
void SetOsdPosition(int Left, int Top, int Width, int Height) {
printf("Set OSD Position %d %d\n",Width,Height);
VideoSetOsdSize( Width, Height) ;
}
void cOglOsd::DestroyPixmap(cPixmap *Pixmap) { void cOglOsd::DestroyPixmap(cPixmap *Pixmap) {
if (!oglThread->Active()) if (!oglThread->Active())
return; return;
@ -2141,10 +2153,16 @@ void cOglOsd::Flush(void) {
for (int i = 0; i < oglPixmaps.Size(); i++) { for (int i = 0; i < oglPixmaps.Size(); i++) {
if (oglPixmaps[i]) { if (oglPixmaps[i]) {
if (oglPixmaps[i]->Layer() == layer) { if (oglPixmaps[i]->Layer() == layer) {
oglThread->DoCmd(new cOglCmdRenderFbToBufferFb( bool alphablending = layer == 0 ? false : true; // Decide wether to render (with alpha) or copy a pixmap
oglPixmaps[i]->Fb(), bFb, oglPixmaps[i]->ViewPort().X(), oglThread->DoCmd(new cOglCmdRenderFbToBufferFb( oglPixmaps[i]->Fb(),
(!isSubtitleOsd) ? oglPixmaps[i]->ViewPort().Y() : 0, oglPixmaps[i]->Alpha(), bFb,
oglPixmaps[i]->DrawPort().X(), oglPixmaps[i]->DrawPort().Y())); oglPixmaps[i]->ViewPort().X(),
(!isSubtitleOsd) ? oglPixmaps[i]->ViewPort().Y() : 0,
oglPixmaps[i]->Alpha(),
oglPixmaps[i]->DrawPort().X(),
oglPixmaps[i]->DrawPort().Y(),
alphablending
));
oglPixmaps[i]->SetDirty(false); oglPixmaps[i]->SetDirty(false);
} }
} }

View File

@ -290,10 +290,11 @@ class cOglCmdRenderFbToBufferFb : public cOglCmd {
GLfloat x, y; GLfloat x, y;
GLfloat drawPortX, drawPortY; GLfloat drawPortX, drawPortY;
GLint transparency; GLint transparency;
GLint alphablending;
public: public:
cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, GLint drawPortX, cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, GLint drawPortX,
GLint drawPortY); GLint drawPortY, bool alphablending);
virtual ~cOglCmdRenderFbToBufferFb(void){}; virtual ~cOglCmdRenderFbToBufferFb(void){};
virtual const char *Description(void) { return "Render Framebuffer to Buffer"; } virtual const char *Description(void) { return "Render Framebuffer to Buffer"; }
virtual bool Execute(void); virtual bool Execute(void);
@ -528,6 +529,7 @@ class cOglOsd : public cOsd {
public: public:
cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglThread); cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglThread);
virtual ~cOglOsd(); virtual ~cOglOsd();
static void SetOsdPosition(int Left, int Top, int Width, int Height);
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas); virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null); virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
virtual void DestroyPixmap(cPixmap *Pixmap); virtual void DestroyPixmap(cPixmap *Pixmap);