Ticket #4901: 4901-v1.patch

File 4901-v1.patch, 4.3 KB (added by danielk, 12 years ago)

Potential fix (tested fix zooming issues.. chromakey and similar OSD's not tested yet)

  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    69716971        ClearAfterSeek(true);
    69726972}
    69736973
     6974static QString toString(const QRect &rect)
     6975{
     6976    return QString("@%1,%2 %3x%4")
     6977        .arg(rect.x()).arg(rect.y()).arg(rect.width()).arg(rect.height());
     6978}
     6979
    69746980void NuppelVideoPlayer::DisplayDVDButton(void)
    69756981{
    69766982    if (!ringBuffer->InDVDMenuOrStillFrame() || !osd)
     
    70307036        }
    70317037
    70327038        // scale highlight image to match OSD size, if required
    7033         // TODO FIXME This is pretty bogus, it does not adjust for zooming
    7034         //   or scaling at all, nor does it account for OSD renderers
    7035         //   where the OSD resolution != video resolution.
    7036         float hmult = osd->GetSubtitleBounds().width() /
    7037             (float) video_disp_dim.width();
    7038         float vmult = osd->GetSubtitleBounds().height() /
    7039             (float) video_disp_dim.height();
     7039        QRect subbounds = osd->GetSubtitleBounds();
     7040        QRect total, visible;
     7041        float visibleAspect, fontScale, themeAspect;
     7042        videoOutput->GetOSDBounds(
     7043            total, visible, visibleAspect, fontScale, themeAspect);
    70407044
    7041         if ((hmult < 0.99) || (hmult > 1.01) || (vmult < 0.99) || (vmult > 1.01))
     7045        VERBOSE(VB_IMPORTANT, "osd subtitle: " << toString(subbounds));
     7046        VERBOSE(VB_IMPORTANT, "osd total:    " << toString(total));
     7047        VERBOSE(VB_IMPORTANT, "osd visible:  " << toString(visible));
     7048        VERBOSE(VB_IMPORTANT, "vid total:    " <<
     7049                toString(QRect(QPoint(0,0),video_disp_dim)));
     7050        cout<<endl;
     7051
     7052        float hmult = 1.0f, vmult = 1.0f;
     7053        if (video_disp_dim.width() > 0)
     7054            hmult = total.width()  / (float) video_disp_dim.width();
     7055        if (video_disp_dim.height() > 0)
     7056            vmult = total.height() / (float) video_disp_dim.height();
     7057
     7058        VERBOSE(VB_IMPORTANT, QString("hmult: %1 vmult: %2")
     7059                .arg(hmult).arg(vmult));
     7060
     7061        if ((hmult < 0.99) || (hmult > 1.01) ||
     7062            (vmult < 0.99) || (vmult > 1.01))
    70427063        {
    70437064            btnX = (int)    (btnX * hmult);
    70447065            btnY = (int)    (btnY * vmult);
     
    70477068
    70487069            hl_button = hl_button.smoothScale(w, h);
    70497070        }
    7050         else
     7071        else
     7072        {
    70517073            hmult = vmult = 1.0;
     7074        }
    70527075
     7076        int xoff = 0, yoff = 0;
     7077        if (visible != total)
     7078        {
     7079            xoff = total.left() - visible.left();
     7080            yoff = total.top()  - visible.top();
     7081        }
     7082
     7083        btnX = max(0, (int)btnX + xoff);
     7084        btnY = max(0, (int)btnY + yoff);
     7085
    70537086        OSDTypeImage* image = new OSDTypeImage();
    70547087        image->SetPosition(QPoint(btnX, btnY), hmult, vmult);
    70557088        image->Load(hl_button);
  • libs/libmythtv/videooutbase.cpp

     
    705705//    { return ((1.0f - r) * a) + (r * b); }
    706706
    707707/**
    708  * \fn VideoOutput::GetVisibleOSDBounds(float&,float&) const
     708 * \fn VideoOutput::GetVisibleOSDBounds(float&,float&,float) const
    709709 * \brief Returns visible portions of total OSD bounds
    710710 * \param visible_aspect physical aspect ratio of bounds returned
    711711 * \param font_scaling   scaling to apply to fonts
  • libs/libmythtv/videooutbase.h

     
    7474    virtual void Zoom(ZoomDirection direction);
    7575 
    7676    virtual void GetDrawSize(int &xoff, int &yoff, int &width, int &height);
    77     virtual void GetOSDBounds(QRect &visible, QRect &total,
    78                               float &pixelAspect, float &fontScale,
    79                               float themeaspect) const;
     77    virtual void GetOSDBounds(QRect &total, QRect &visible,
     78                              float &visibleAspect, float &fontScale,
     79                              float themeAspect) const;
    8080
    8181    /// \brief Returns current display's frame refresh period in microseconds.
    8282    ///        e.g. 1000000 / frame_rate_in_Hz