Ticket #2163: 2163_fix_edit_osd_placement.diff

File 2163_fix_edit_osd_placement.diff, 3.0 KB (added by Janne <janne-mythtv@…>, 17 years ago)

libmythtv patch for correct osd placement of cut marks

  • mythtv/libs/libmythtv/osd.cpp

    diff --git a/mythtv/libs/libmythtv/osd.cpp b/mythtv/libs/libmythtv/osd.cpp
    index 557f7a7..e5e6817 100644
    a b void OSD::ShowEditArrow(long long number 
    22372237    char name[128];
    22382238    sprintf(name, "%lld-%d", number, type);
    22392239
    2240     int xtmp = (int)((editarrowRect.width() * 1.0 / totalframes) * number);
    2241     int xpos = (int) round((editarrowRect.left() + xtmp) * wmult);
     2240    int pos  = number * 1000 / totalframes;
     2241    int xtmp = (int)(round(editarrowRect.width() * wmult) / 1000.0 * pos);
     2242    int xpos = xtmp + (int)(editarrowRect.left() * wmult);
    22422243    int ypos = (int) round(editarrowRect.top() * hmult);
    22432244
    22442245    osdlock.lock();
    22452246
    22462247    OSDSet *set = new OSDSet(name, false,
    22472248                             osdBounds.width(), osdBounds.height(),
    2248                              wmult, hmult, frameint);
     2249                             wmult, hmult, frameint, xoffset, yoffset);
    22492250    set->SetAllowFade(false);
    22502251    OSDSet *container = GetSet("editmode");
    22512252    if (container)
    void OSD::ShowEditArrow(long long number 
    22572258
    22582259    OSDTypeImage *image;
    22592260    if (type == 0)
    2260     {
    22612261        image = new OSDTypeImage(*editarrowleft);
    2262         xpos -= image->ImageSize().width();
    2263     }
    22642262    else
    2265     {
    22662263        image = new OSDTypeImage(*editarrowright);
    2267     }
     2264
     2265    // FIXME: image is only after Reinit() correctly scaled
     2266    image->Reinit(wmult, hmult);
     2267
     2268    xpos -= image->ImageSize().width()/2;
    22682269
    22692270    image->SetPosition(QPoint(xpos, ypos), wmult, hmult);
    22702271
  • mythtv/libs/libmythtv/osdtypes.cpp

    diff --git a/mythtv/libs/libmythtv/osdtypes.cpp b/mythtv/libs/libmythtv/osdtypes.cpp
    index 8838212..f53357d 100644
    a b using namespace std; 
    1919/// Shared OSD image cache
    2020OSDImageCache OSDTypeImage::c_cache;
    2121
    22 OSDSet::OSDSet(const QString &name, bool cache, int screenwidth,
    23                int screenheight, float wmult, float hmult, int frint)
     22
     23OSDSet::OSDSet(const QString &name, bool cache, int screenwidth,
     24               int screenheight, float wmult, float hmult,
     25               int frint, int xoff, int yoff)
    2426      : QObject()
    2527{
    2628    m_wantsupdates = false;
    OSDSet::OSDSet(const QString &name, bool 
    4345    m_screenheight = screenheight;
    4446    m_wmult = wmult;
    4547    m_hmult = hmult;
    46     m_xoffsetbase = 0;
    47     m_yoffsetbase = 0;
     48    m_xoffsetbase = xoff;
     49    m_yoffsetbase = yoff;
    4850
    4951    m_notimeout = false;
    5052    m_fadetime = -1;
  • mythtv/libs/libmythtv/osdtypes.h

    diff --git a/mythtv/libs/libmythtv/osdtypes.h b/mythtv/libs/libmythtv/osdtypes.h
    index 9f63fc5..fcaea88 100644
    a b class OSDSet : public QObject 
    4444{
    4545    Q_OBJECT
    4646  public:
    47     OSDSet(const QString &name, bool cache, int screenwidth, int screenheight, 
    48            float wmult, float hmult, int frint);
     47    OSDSet(const QString &name, bool cache, int screenwidth, int screenheight,
     48           float wmult, float hmult, int frint, int xoff=0, int yoff=0);
    4949    OSDSet(const OSDSet &other);
    5050   ~OSDSet();
    5151