Ticket #7776: black-background-2.patch

File black-background-2.patch, 5.1 KB (added by Clayton Smith <argilo@…>, 2 years ago)

Force black background and white foreground

  • libs/libmythtv/osdtypes.cpp

     
    26002600} 
    26012601 
    26022602OSDType708CC::OSDType708CC(const QString &name, TTFFont *fonts[48], 
    2603                            int xoff, int yoff, int dispw, int disph) :  
     2603                          int xoff, int yoff, int dispw, int disph, 
     2604                          float wmult, float hmult) :  
    26042605    OSDType(name) 
    26052606{ 
    26062607    xoffset = xoff; 
     
    26102611 
    26112612    for (uint i = 0; i < 48; i++) 
    26122613        m_fonts[i] = fonts[i]; 
     2614 
     2615    QRect rect = QRect(0, 0, 0, 0); 
     2616    m_box = new OSDTypeBox("cc_background", rect, wmult, hmult); 
     2617    m_ccbackground = gContext->GetNumSetting("CCBackground", 0); 
    26132618} 
    26142619 
    26152620QRect OSDType708CC::CalcBounds(const OSDSurface *surface, 
     
    27452750 
    27462751            font->CalcWidth(list[i]->str, &text_length); 
    27472752 
    2748             font->setColor(list[i]->attr.GetFGColor(), kTTF_Normal); 
    2749  
    27502753            font->setOutline(false); 
    27512754            font->setShadow(0,0); 
    2752             if (list[i]->attr.edge_type == 3/*kEdgeUniform*/) 
     2755 
     2756            if (m_ccbackground) 
    27532757            { 
    2754                 font->setColor(list[i]->attr.GetEdgeColor(), kTTF_Outline); 
    2755                 font->setOutline(true); 
     2758                QRect rect = QRect(0, 0, text_length + 1,  
     2759                                   (font->Size() * 3 / 2) + 1); 
     2760                m_box->SetRect(rect, m_wmult, m_hmult); 
     2761                m_box->Draw(surface, 0, 0, ul.x() + tot_width - 2, 
     2762                                           ul.y() + total_height - 2); 
     2763                font->setColor(QColor(255, 255, 255), kTTF_Normal); 
     2764            } else { 
     2765                font->setColor(list[i]->attr.GetFGColor(), kTTF_Normal); 
     2766                if (list[i]->attr.edge_type == 3/*kEdgeUniform*/) 
     2767                { 
     2768                    font->setColor(list[i]->attr.GetEdgeColor(), kTTF_Outline); 
     2769                    font->setOutline(true); 
     2770                } 
     2771                else if (list[i]->attr.edge_type == 4/*kEdgeLeftShadow*/) 
     2772                { 
     2773                    font->setColor(list[i]->attr.GetEdgeColor(), kTTF_Shadow); 
     2774                    font->setShadow(-2, +2); 
     2775                } 
     2776                else if (list[i]->attr.edge_type == 5/*kEdgeRightShadow*/) 
     2777                { 
     2778                    font->setColor(list[i]->attr.GetEdgeColor(), kTTF_Shadow); 
     2779                    font->setShadow(+2, +2); 
     2780                } 
    27562781            } 
    2757             else if (list[i]->attr.edge_type == 4/*kEdgeLeftShadow*/) 
    2758             { 
    2759                 font->setColor(list[i]->attr.GetEdgeColor(), kTTF_Shadow); 
    2760                 font->setShadow(-2, +2); 
    2761             } 
    2762             else if (list[i]->attr.edge_type == 5/*kEdgeRightShadow*/) 
    2763             { 
    2764                 font->setColor(list[i]->attr.GetEdgeColor(), kTTF_Shadow); 
    2765                 font->setShadow(+2, +2); 
    2766             } 
    27672782 
    27682783            font->DrawString(surface, 
    27692784                             ul.x() + tot_width, ul.y() + total_height + 2, 
  • libs/libmythtv/osdtypes.h

     
    604604{ 
    605605  public: 
    606606    OSDType708CC(const QString &name, TTFFont *fonts[48], 
    607                  int xoff, int yoff, int dispw, int disph); 
     607                 int xoff, int yoff, int dispw, int disph, 
     608                 float wmult, float hmult); 
    608609    virtual ~OSDType708CC() {} 
    609610 
    610611    void Reinit(float, float) {} 
     
    625626 
    626627    TTFFont *m_fonts[48]; 
    627628 
     629    OSDTypeBox *m_box; 
     630    int m_ccbackground; 
     631    float m_wmult, m_hmult; 
    628632    int xoffset, yoffset, displaywidth, displayheight; 
    629633}; 
    630634 
  • libs/libmythtv/osd.cpp

     
    325325    AddSet(container, name); 
    326326    OSDType708CC *ccpage =  
    327327        new OSDType708CC(name, ccfonts, xoffset, yoffset,  
    328                          displaywidth, displayheight); 
     328                         displaywidth, displayheight, wmult, hmult); 
    329329    container->AddType(ccpage); 
    330330 
    331331    VERBOSE(VB_VBI, LOC + "InitCC708() -- end"); 
  • programs/mythfrontend/globalsettings.cpp

     
    19501950static HostCheckBox *CCBackground() 
    19511951{ 
    19521952    HostCheckBox *gc = new HostCheckBox("CCBackground"); 
    1953     gc->setLabel(QObject::tr("Black background for analog closed captioning")); 
     1953    gc->setLabel(QObject::tr("Black background for closed captioning")); 
    19541954    gc->setValue(false); 
    19551955    gc->setHelpText(QObject::tr( 
    1956                         "If enabled, analog captions will be displayed " 
     1956                        "If enabled, captions will be displayed " 
    19571957                        "over a black space for maximum contrast. Otherwise, " 
    19581958                        "captions will use outlined text over the picture.")); 
    19591959    return gc;