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(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency,
GLint drawPortX, GLint drawPortY)
GLint drawPortX, GLint drawPortY, bool alphablending)
: cOglCmd(fb) {
this->buffer = buffer;
this->x = (GLfloat)x;
this->y = (GLfloat)y;
this->drawPortX = (GLfloat)drawPortX;
this->drawPortY = (GLfloat)drawPortY;
this->transparency = transparency;
this->transparency = (alphablending ? transparency : ALPHA_OPAQUE);
this->alphablending = alphablending;
}
bool cOglCmdRenderFbToBufferFb::Execute(void) {
@ -773,11 +774,14 @@ bool cOglCmdRenderFbToBufferFb::Execute(void) {
if (!fb->BindTexture())
return false;
if (!alphablending)
VertexBuffers[vbTexture]->DisableBlending();
VertexBuffers[vbTexture]->Bind();
VertexBuffers[vbTexture]->SetVertexData(quadVertices);
VertexBuffers[vbTexture]->DrawArrays();
VertexBuffers[vbTexture]->Unbind();
if (!alphablending)
VertexBuffers[vbTexture]->EnableBlending();
buffer->Unbind();
return true;
@ -2096,6 +2100,14 @@ cPixmap *cOglOsd::CreatePixmap(int Layer, const cRect &ViewPort, const cRect &Dr
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) {
if (!oglThread->Active())
return;
@ -2141,10 +2153,16 @@ void cOglOsd::Flush(void) {
for (int i = 0; i < oglPixmaps.Size(); i++) {
if (oglPixmaps[i]) {
if (oglPixmaps[i]->Layer() == layer) {
oglThread->DoCmd(new cOglCmdRenderFbToBufferFb(
oglPixmaps[i]->Fb(), bFb, oglPixmaps[i]->ViewPort().X(),
(!isSubtitleOsd) ? oglPixmaps[i]->ViewPort().Y() : 0, oglPixmaps[i]->Alpha(),
oglPixmaps[i]->DrawPort().X(), oglPixmaps[i]->DrawPort().Y()));
bool alphablending = layer == 0 ? false : true; // Decide wether to render (with alpha) or copy a pixmap
oglThread->DoCmd(new cOglCmdRenderFbToBufferFb( oglPixmaps[i]->Fb(),
bFb,
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);
}
}

View File

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