From 8c2caad50cf7386c0bd299fa02d40ff1bdca78d0 Mon Sep 17 00:00:00 2001
From: Lawrence Rust <lvr@softsystem.co.uk>
Date: Mon, 18 Jul 2011 20:27:07 +0200
Subject: [PATCH 3/9] freemheg: Fix the colour of default initialised visible elements
Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
---
mythtv/libs/libmythfreemheg/Visible.cpp | 53 ++++++++++++++++--------------
1 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/mythtv/libs/libmythfreemheg/Visible.cpp b/mythtv/libs/libmythfreemheg/Visible.cpp
index 1d69a39..8ee4e3f 100644
|
a
|
b
|
void MHVisible::Deactivation(MHEngine *engine)
|
| 164 | 164 | MHRgba MHVisible::GetColour(const MHColour &colour) |
| 165 | 165 | { |
| 166 | 166 | int red = 0, green = 0, blue = 0, alpha = 0; |
| 167 | | int cSize = colour.m_ColStr.Size(); |
| 168 | | |
| 169 | | if (cSize != 4) |
| | 167 | if (colour.IsSet()) |
| 170 | 168 | { |
| 171 | | MHLOG(MHLogWarning, QString("Colour string has length %1 not 4.").arg(cSize)); |
| 172 | | } |
| | 169 | int cSize = colour.m_ColStr.Size(); |
| 173 | 170 | |
| 174 | | // Just in case the length is short we handle those properly. |
| 175 | | if (cSize > 0) |
| 176 | | { |
| 177 | | red = colour.m_ColStr.GetAt(0); |
| 178 | | } |
| | 171 | if (cSize != 4) |
| | 172 | { |
| | 173 | MHLOG(MHLogWarning, QString("Colour string has length %1 not 4.").arg(cSize)); |
| | 174 | } |
| 179 | 175 | |
| 180 | | if (cSize > 1) |
| 181 | | { |
| 182 | | green = colour.m_ColStr.GetAt(1); |
| 183 | | } |
| | 176 | // Just in case the length is short we handle those properly. |
| | 177 | if (cSize > 0) |
| | 178 | { |
| | 179 | red = colour.m_ColStr.GetAt(0); |
| | 180 | } |
| 184 | 181 | |
| 185 | | if (cSize > 2) |
| 186 | | { |
| 187 | | blue = colour.m_ColStr.GetAt(2); |
| 188 | | } |
| | 182 | if (cSize > 1) |
| | 183 | { |
| | 184 | green = colour.m_ColStr.GetAt(1); |
| | 185 | } |
| 189 | 186 | |
| 190 | | if (cSize > 3) |
| 191 | | { |
| 192 | | alpha = 255 - colour.m_ColStr.GetAt(3); // Convert transparency to alpha |
| | 187 | if (cSize > 2) |
| | 188 | { |
| | 189 | blue = colour.m_ColStr.GetAt(2); |
| | 190 | } |
| | 191 | |
| | 192 | if (cSize > 3) |
| | 193 | { |
| | 194 | alpha = 255 - colour.m_ColStr.GetAt(3); // Convert transparency to alpha |
| | 195 | } |
| 193 | 196 | } |
| 194 | 197 | |
| 195 | 198 | return MHRgba(red, green, blue, alpha); |