Ticket #10019: 0003-freemheg-Fix-the-colour-of-default-initialised-visib.patch

File 0003-freemheg-Fix-the-colour-of-default-initialised-visib.patch, 2.1 KB (added by Lawrence Rust <lvr@…>, 9 years ago)
  • mythtv/libs/libmythfreemheg/Visible.cpp

    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) 
    164164MHRgba MHVisible::GetColour(const MHColour &colour)
    165165{
    166166    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())
    170168    {
    171         MHLOG(MHLogWarning, QString("Colour string has length %1 not 4.").arg(cSize));
    172     }
     169        int cSize = colour.m_ColStr.Size();
    173170
    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        }
    179175
    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        }
    184181
    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        }
    189186
    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        }
    193196    }
    194197
    195198    return MHRgba(red, green, blue, alpha);