diff --git a/openglosd.cpp b/openglosd.cpp index ab3258d..e85f9a4 100644 --- a/openglosd.cpp +++ b/openglosd.cpp @@ -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); } } diff --git a/openglosd.h b/openglosd.h index c7cb9cf..e5d9cb6 100644 --- a/openglosd.h +++ b/openglosd.h @@ -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 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);