Skip to content

Commit

Permalink
MythMainWindow: Break out the actual UI drawing into a separate method.
Browse files Browse the repository at this point in the history
If the rendering context is shared, MythMainWindow assumes the 'other'
owner will call the draw method as appropriate (though UI animation will
continue to run as before).

In VideoOutputOpenGL, if we are embedding and the context is shared,
render the main UI after the framebuffer has been cleared and before the
video.
  • Loading branch information
Mark Kendall committed May 2, 2011
1 parent 285b967 commit 5c5ad6c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions mythtv/libs/libmythtv/videoout_opengl.cpp
Expand Up @@ -423,6 +423,9 @@ void VideoOutputOpenGL::PrepareFrame(VideoFrame *buffer, FrameScanType t,
gl_context->SetBackground(0, 0, 0, 255);
gl_context->ClearFramebuffer();

if (gl_context->IsShared() && GetMythMainWindow() && window.IsEmbedding())
GetMythMainWindow()->draw();

if (gl_videochain)
{
gl_videochain->SetVideoRect(vsz_enabled ? vsz_desired_display_rect :
Expand Down
15 changes: 12 additions & 3 deletions mythtv/libs/libmythui/mythmainwindow.cpp
Expand Up @@ -641,7 +641,7 @@ void MythMainWindow::animate(void)
}
}

if (redraw)
if (redraw && !(d->render && d->render->IsShared()))
d->paintwin->update(d->repaintRegion);

for (it = d->stackList.begin(); it != d->stackList.end(); ++it)
Expand Down Expand Up @@ -701,6 +701,17 @@ void MythMainWindow::drawScreen(void)
}
}

if (!(d->render && d->render->IsShared()))
draw();

d->repaintRegion = QRegion(QRect(0, 0, 0, 0));
}

void MythMainWindow::draw(void)
{
if (!d->painter)
return;

d->painter->Begin(d->paintwin);

QVector<QRect> rects = d->repaintRegion.rects();
Expand Down Expand Up @@ -729,8 +740,6 @@ void MythMainWindow::drawScreen(void)
}

d->painter->End();

d->repaintRegion = QRegion(QRect(0, 0, 0, 0));
}

void MythMainWindow::closeEvent(QCloseEvent *e)
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythui/mythmainwindow.h
Expand Up @@ -121,6 +121,7 @@ class MUI_PUBLIC MythMainWindow : public QWidget
uint PushDrawDisabled(void);
uint PopDrawDisabled(void);
void SetEffectsEnabled(bool enable);
void draw(void);

public slots:
void mouseTimeout();
Expand Down

0 comments on commit 5c5ad6c

Please sign in to comment.