Ticket #8564: 8564_v3.patch

File 8564_v3.patch, 4.7 KB (added by Jim Stichnoth <stichnot@…>, 14 years ago)
  • libs/libmythtv/deletemap.cpp

     
    7171{
    7272    if (!osd || !ctx)
    7373        return;
    74     CleanMap(total);
     74    //CleanMap(total);
    7575
    7676    InfoMap infoMap;
    7777    ctx->LockPlayingInfo(__FILE__, __LINE__);
     
    162162        int type = Delete(it.key());
    163163        Add(it.key(), type == MARK_CUT_END ? MARK_CUT_START : MARK_CUT_END);
    164164    }
    165     CleanMap(total);
     165    //CleanMap(total);
    166166}
    167167
    168168/**
     
    177177       ((MARK_CUT_START != type) && (MARK_CUT_END != type)))
    178178        return;
    179179
     180#if 0
    180181    int       lasttype  = MARK_UNSET;
    181182    long long lastframe = -1;
    182183    long long remove    = -1;
     
    224225
    225226    if (remove > -1)
    226227        Delete((uint64_t)remove);
     228#endif // 0
    227229    Add(frame, type);
    228     CleanMap(total);
     230    //CleanMap(total);
    229231}
    230232
    231233/// Remove the mark at the given frame.
     
    233235{
    234236    EDIT_CHECK
    235237    Delete(frame);
    236     CleanMap(total);
     238    //CleanMap(total);
    237239}
    238240
    239241/// Reverse the direction of the mark at the given frame.
     
    387389            uint64_t thisframe = it.key();
    388390            if (lasttype == thistype)
    389391            {
    390                 Delete(thistype == MARK_CUT_END ? thisframe :
     392                Delete(thistype == MARK_CUT_START ? thisframe :
    391393                                                  (uint64_t)lastframe);
    392394                clear = false;
    393395                break;
  • libs/libmythtv/osd.cpp

     
    461461    long long start = -1;
    462462    long long end   = -1;
    463463    bool first = true;
     464    QVector<float> pendingStarts;
     465    int i;
    464466    QMapIterator<uint64_t, MarkTypes> it(map);
    465467    while (it.hasNext())
    466468    {
    467         bool error = false;
    468469        it.next();
    469470        if (it.value() == MARK_CUT_START)
    470471        {
    471472            start = it.key();
    472             if (end > -1)
    473                 error = true;
     473            if (start > total)
     474                start = total;
     475            pendingStarts += start;
    474476        }
    475477        else if (it.value() == MARK_CUT_END)
    476478        {
    477479            if (first)
    478480                start = 0;
    479             if (start < 0)
    480                 error = true;
    481481            end = it.key();
     482            if (end > total)
     483                end = total;
     484            if (pendingStarts.isEmpty())
     485                pendingStarts += start;
     486            for (i=0; i<pendingStarts.size(); i++)
     487                bar->AddRegion((float)(pendingStarts[i]/(double)total),
     488                               (float)(end/(double)total));
     489            pendingStarts.clear();
    482490        }
    483491        first = false;
    484 
    485         if (error)
    486         {
    487             VERBOSE(VB_IMPORTANT, LOC_ERR + "deleteMap discontinuity");
    488             start = -1;
    489             end   = -1;
    490         }
    491 
    492         if (start >=0 && end >= 0)
    493         {
    494             bar->AddRegion((float)((double)start/(double)total),
    495                            (float)((double)end/(double)total));
    496             start = -1;
    497             end   = -1;
    498         }
    499492    }
    500     if (start > -1 && end < 0)
    501         bar->AddRegion((float)((double)start/(double)total), 1.0f);
     493    for (i=0; i<pendingStarts.size(); i++)
     494        bar->AddRegion((float)(pendingStarts[i]/(double)total), 1.0f);
    502495
    503496    bar->Display();
    504497}
  • libs/libmythui/mythuieditbar.cpp

     
    130130        QPair<float,float> region = regions.next();
    131131        int left  = (int)((region.first * cutarea.width()) + 0.5f);
    132132        int right = (int)((region.second * cutarea.width()) + 0.5f);
     133        if (left >= right)
     134            right = left + 1;
    133135        if (cut)
    134136        {
    135137            AddBar(barshape, barimage, QRect(left, cutarea.top(), right - left,
     
    158160        QPair<float,float> region = regions2.next();
    159161        int left  = (int)((region.first * keeparea.width()) + 0.5f);
    160162        int right = (int)((region.second * keeparea.width()) + 0.5f);
     163        if (left >= right)
     164            right = left + 1;
    161165        if (keep)
    162166        {
    163167            AddBar(barshape, barimage, QRect(left, keeparea.top(), right - left,
     
    250254        }
    251255        else
    252256        {
    253             m_invregions.append(qMakePair(start, region.first));
     257            if (region.first > start)
     258                m_invregions.append(qMakePair(start, region.first));
    254259            start = region.second;
    255260        }
    256261    }