Skip to content
Browse files

freemheg: Fix the colour of default initialised visible elements

Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
  • Loading branch information...
1 parent d94970b commit 2ffbeb83617157c66dfccb1e23da369e61dddf80 Lawrence Rust committed with stuartm Jul 18, 2011
Showing with 24 additions and 21 deletions.
  1. +24 −21 mythtv/libs/libmythfreemheg/Visible.cpp
View
45 mythtv/libs/libmythfreemheg/Visible.cpp
@@ -164,32 +164,35 @@ void MHVisible::Deactivation(MHEngine *engine)
MHRgba MHVisible::GetColour(const MHColour &colour)
{
int red = 0, green = 0, blue = 0, alpha = 0;
- int cSize = colour.m_ColStr.Size();
-
- if (cSize != 4)
+ if (colour.IsSet())
{
- MHLOG(MHLogWarning, QString("Colour string has length %1 not 4.").arg(cSize));
- }
+ int cSize = colour.m_ColStr.Size();
- // Just in case the length is short we handle those properly.
- if (cSize > 0)
- {
- red = colour.m_ColStr.GetAt(0);
- }
+ if (cSize != 4)
+ {
+ MHLOG(MHLogWarning, QString("Colour string has length %1 not 4.").arg(cSize));
+ }
- if (cSize > 1)
- {
- green = colour.m_ColStr.GetAt(1);
- }
+ // Just in case the length is short we handle those properly.
+ if (cSize > 0)
+ {
+ red = colour.m_ColStr.GetAt(0);
+ }
- if (cSize > 2)
- {
- blue = colour.m_ColStr.GetAt(2);
- }
+ if (cSize > 1)
+ {
+ green = colour.m_ColStr.GetAt(1);
+ }
- if (cSize > 3)
- {
- alpha = 255 - colour.m_ColStr.GetAt(3); // Convert transparency to alpha
+ if (cSize > 2)
+ {
+ blue = colour.m_ColStr.GetAt(2);
+ }
+
+ if (cSize > 3)
+ {
+ alpha = 255 - colour.m_ColStr.GetAt(3); // Convert transparency to alpha
+ }
}
return MHRgba(red, green, blue, alpha);

0 comments on commit 2ffbeb8

Please sign in to comment.
Something went wrong with that request. Please try again.