Skip to content

Commit

Permalink
UI: Fix Xv painter rendering of OSD menu gradient elements
Browse files Browse the repository at this point in the history
Commit #xxxxx re-worked and simplified MythPainter.
MythYUVAPainter::DrawRect is passed a brush to paint the background.
This brush may be configured to gradient fill - for instance in
the MythCentre theme to draw the MythPopupBox OSD menu buttons.
Currently only the basic brush colour is translated to YUVA so the
OSD menu is incorrectly rendered.

This patch translates the colours in the brush fill gradient from
RGB to YUV.

Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
  • Loading branch information
Lawrence Rust authored and stuartm committed Sep 8, 2013
1 parent bb6e3a0 commit a166efd
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion mythtv/libs/libmythui/mythpainter_yuva.cpp
Expand Up @@ -56,7 +56,29 @@ void MythYUVAPainter::DrawRect(const QRect &area, const QBrush &fillBrush,
const QPen &linePen, int alpha)
{
QBrush brush(fillBrush);
brush.setColor(rgb_to_yuv(brush.color()));

switch (fillBrush.style())
{
case Qt::LinearGradientPattern:
case Qt::RadialGradientPattern:
case Qt::ConicalGradientPattern:
{
QGradient gradient = *fillBrush.gradient();
QGradientStops stops = gradient.stops();
for (QGradientStops::iterator it = stops.begin(); it != stops.end(); ++it)
{
it->second = rgb_to_yuv(it->second);
it->second.setAlpha(alpha);
}
gradient.setStops(stops);
brush = gradient;
}
break;
default:
brush.setColor(rgb_to_yuv(brush.color()));
break;
}

QPen pen(linePen);
pen.setColor(rgb_to_yuv(pen.color()));

Expand Down

0 comments on commit a166efd

Please sign in to comment.