mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +02:00
neutrino: fix possible div-by-zero in scrollbar calculation
This commit is contained in:
committed by
Jacek Jendrzej
parent
5420e509da
commit
a33086568b
@@ -1874,6 +1874,8 @@ void CAudioPlayerGui::paint()
|
||||
|
||||
int sbc = ((m_playlist.size() - 1) / m_listmaxshow) + 1;
|
||||
int sbs = (m_selected / m_listmaxshow);
|
||||
if (sbc < 1)
|
||||
sbc = 1;
|
||||
|
||||
m_frameBuffer->paintBoxRel(m_x + m_width - 13, ypos + 2 + sbs*(sb-4)/sbc , 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3, RADIUS_SMALL);
|
||||
}
|
||||
|
@@ -121,6 +121,9 @@ void CBEBouquetWidget::paint()
|
||||
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1);
|
||||
|
||||
int sbc= ((Bouquets->size()- 1)/ listmaxshow)+ 1;
|
||||
if (sbc < 1)
|
||||
sbc = 1;
|
||||
|
||||
float sbh= (sb- 4)/ sbc;
|
||||
int sbs= (selected/listmaxshow);
|
||||
|
||||
|
@@ -160,6 +160,9 @@ void CBEChannelWidget::paint()
|
||||
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1);
|
||||
|
||||
int sbc= ((Channels->size()- 1)/ listmaxshow)+ 1;
|
||||
if (sbc < 1)
|
||||
sbc = 1;
|
||||
|
||||
float sbh= (sb- 4)/ sbc;
|
||||
int sbs= (selected/listmaxshow);
|
||||
|
||||
|
@@ -476,6 +476,9 @@ void CBookmarkManager::paint()
|
||||
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1);
|
||||
|
||||
int sbc= ((bookmarks.size()- 1)/ listmaxshow)+ 1;
|
||||
if (sbc < 1)
|
||||
sbc = 1;
|
||||
|
||||
float sbh= (sb- 4)/ sbc;
|
||||
|
||||
frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ int(page_nr * sbh) , 11, int(sbh), COL_MENUCONTENT_PLUS_3);
|
||||
|
@@ -615,7 +615,7 @@ void CBouquetList::paint()
|
||||
int sb = fheight* listmaxshow;
|
||||
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1);
|
||||
|
||||
int sbc= ((bsize - 1)/ listmaxshow)+ 1;
|
||||
int sbc= ((bsize - 1)/ listmaxshow)+ 1; /* bsize is > 0, so sbc is also > 0 */
|
||||
float sbh= (sb - 4)/ sbc;
|
||||
int sbs= (selected/listmaxshow);
|
||||
|
||||
|
@@ -2123,8 +2123,10 @@ void CChannelList::paint()
|
||||
const int sb = height - theight - footerHeight; // paint scrollbar over full height of main box
|
||||
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1);
|
||||
|
||||
const int sbc= ((chanlist.size()- 1)/ listmaxshow)+ 1;
|
||||
int sbc= ((chanlist.size()- 1)/ listmaxshow)+ 1;
|
||||
const int sbs= (selected/listmaxshow);
|
||||
if (sbc < 1)
|
||||
sbc = 1;
|
||||
|
||||
frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs*(sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3);
|
||||
showChannelLogo();
|
||||
|
@@ -263,6 +263,8 @@ void CEpgData::showText( int startPos, int ypos )
|
||||
|
||||
int sbc = ((textSize - 1)/ medlinecount) + 1;
|
||||
int sbs= (startPos+ 1)/ medlinecount;
|
||||
if (sbc < 1)
|
||||
sbc = 1;
|
||||
frameBuffer->paintBoxRel(sx+ ox- 15, ypos, 15, sb, COL_MENUCONTENT_PLUS_1); // scrollbar bg
|
||||
frameBuffer->paintBoxRel(sx+ ox- 13, ypos+ 2+ sbs*(sb-4)/sbc , 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3); // scrollbar
|
||||
}
|
||||
|
@@ -912,6 +912,9 @@ void CNeutrinoEventList::paint(t_channel_id channel_id)
|
||||
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1);
|
||||
|
||||
int sbc= ((evtlist.size()- 1)/ listmaxshow)+ 1;
|
||||
if (sbc < 1)
|
||||
sbc = 1;
|
||||
|
||||
float sbh= (sb- 4)/ sbc;
|
||||
int sbs= (selected/listmaxshow);
|
||||
|
||||
|
@@ -1523,6 +1523,8 @@ void CFileBrowser::paint()
|
||||
|
||||
int sbc= ((filelist.size()- 1)/ listmaxshow)+ 1;
|
||||
int sbs= (selected/listmaxshow);
|
||||
if (sbc < 1)
|
||||
sbc = 1;
|
||||
|
||||
frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs*(sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3, RADIUS_SMALL);
|
||||
}
|
||||
|
@@ -754,6 +754,9 @@ void CPictureViewerGui::paint()
|
||||
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1);
|
||||
|
||||
int sbc= ((playlist.size()- 1)/ listmaxshow)+ 1;
|
||||
if (sbc < 1)
|
||||
sbc = 1;
|
||||
|
||||
float sbh= (sb- 4)/ sbc;
|
||||
int sbs= (selected/listmaxshow);
|
||||
|
||||
|
@@ -70,6 +70,9 @@ void CListBox::paint()
|
||||
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1);
|
||||
|
||||
int sbc= ((getItemCount()- 1)/ listmaxshow)+ 1;
|
||||
if (sbc < 1)
|
||||
sbc = 1;
|
||||
|
||||
float sbh= (sb- 4)/ sbc;
|
||||
int sbs= (selected/listmaxshow);
|
||||
|
||||
|
Reference in New Issue
Block a user