From 37c5f7c7d39f9bdf37332af6045f1149d5703535 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 25 Dec 2011 23:13:03 +0100 Subject: [PATCH] neutrino: avoid float when calculating scrollbars --- src/gui/bedit/bouqueteditor_bouquets.cpp | 3 +-- src/gui/bedit/bouqueteditor_channels.cpp | 3 +-- src/gui/bookmarkmanager.cpp | 3 +-- src/gui/bouquetlist.cpp | 3 +-- src/gui/epgplus.cpp | 5 ++--- src/gui/eventlist.cpp | 3 +-- src/gui/pictureviewer.cpp | 3 +-- src/gui/pluginlist.cpp | 3 +-- src/gui/timerlist.cpp | 3 +-- src/gui/widget/listbox.cpp | 3 +-- 10 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 1efd6d39f..61a71b530 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -131,10 +131,9 @@ void CBEBouquetWidget::paint() frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1); int sbc= ((Bouquets->size()- 1)/ listmaxshow)+ 1; - float sbh= (sb- 4)/ sbc; int sbs= (selected/listmaxshow); - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ int(sbs* sbh) , 11, int(sbh), COL_MENUCONTENT_PLUS_3); + frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3); } void CBEBouquetWidget::paintHead() diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index feef9b827..023395e9c 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -145,10 +145,9 @@ void CBEChannelWidget::paint() frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1); int sbc= ((Channels->size()- 1)/ listmaxshow)+ 1; - float sbh= (sb- 4)/ sbc; int sbs= (selected/listmaxshow); - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ int(sbs* sbh) , 11, int(sbh), COL_MENUCONTENT_PLUS_3); + frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3); } void CBEChannelWidget::paintHead() diff --git a/src/gui/bookmarkmanager.cpp b/src/gui/bookmarkmanager.cpp index 6b076d86c..89061c1f0 100644 --- a/src/gui/bookmarkmanager.cpp +++ b/src/gui/bookmarkmanager.cpp @@ -475,9 +475,8 @@ void CBookmarkManager::paint() frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1); int sbc= ((bookmarks.size()- 1)/ listmaxshow)+ 1; - float sbh= (sb- 4)/ sbc; - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ int(page_nr * sbh) , 11, int(sbh), COL_MENUCONTENT_PLUS_3); + frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ page_nr * (sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3); } paintFoot(); diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 556bf70d5..7c4a46f5f 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -614,8 +614,7 @@ void CBouquetList::paint() frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1); int sbc= ((bsize - 1)/ listmaxshow)+ 1; - float sbh= (sb - 4)/ sbc; int sbs= (selected/listmaxshow); - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ int(sbs* sbh) , 11, int(sbh), COL_MENUCONTENT_PLUS_3); + frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3); } diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 727a7aa2b..3a2fd9440 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -1235,11 +1235,10 @@ void EpgPlus::paint() this->frameBuffer->paintBoxRel (this->sliderX, this->sliderY, this->sliderWidth, this->sliderHeight, COL_MENUCONTENT_PLUS_0); int tmp = ((this->channelList->getSize() - 1) / this->maxNumberOfDisplayableEntries) + 1; - float sliderKnobHeight = (sliderHeight - 4) / tmp; int sliderKnobPosition = this->selectedChannelEntry == NULL ? 0 : (this->selectedChannelEntry->index / this->maxNumberOfDisplayableEntries); - this->frameBuffer->paintBoxRel (this->sliderX + 2, this->sliderY + int (sliderKnobPosition * sliderKnobHeight) - , this->sliderWidth - 4, int (sliderKnobHeight) , COL_MENUCONTENT_PLUS_3); + this->frameBuffer->paintBoxRel(this->sliderX + 2, this->sliderY + sliderKnobPosition * (sliderHeight-4)/tmp + , this->sliderWidth - 4, (sliderHeight-4)/tmp, COL_MENUCONTENT_PLUS_3); } // -- EPG+ Menue Handler Class diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index d2fd4cda0..b80e383a6 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -857,10 +857,9 @@ void EventList::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; - float sbh= (sb- 4)/ sbc; int sbs= (selected/listmaxshow); - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ int(sbs* sbh) , 11, int(sbh), COL_MENUCONTENT_PLUS_3); + frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3); } diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index c5d4bbf00..35a410184 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -697,10 +697,9 @@ void CPictureViewerGui::paint() frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1); int sbc= ((playlist.size()- 1)/ listmaxshow)+ 1; - float sbh= (sb- 4)/ sbc; int sbs= (selected/listmaxshow); - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ int(sbs* sbh) , 11, int(sbh), COL_MENUCONTENT_PLUS_3); + frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3); paintFoot(); paintInfo(); diff --git a/src/gui/pluginlist.cpp b/src/gui/pluginlist.cpp index da3ea9124..20dd6520c 100644 --- a/src/gui/pluginlist.cpp +++ b/src/gui/pluginlist.cpp @@ -343,12 +343,11 @@ void CPluginList::paintItems() // Scrollbar int nrOfPages = ((pluginlist.size()-1) / listmaxshow)+1; int currPage = (liststart/listmaxshow) +1; - float blockHeight = (height-theight-4-RADIUS_LARGE)/nrOfPages; frameBuffer->paintBoxRel(x, y+theight, width+15, height-theight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); frameBuffer->paintBoxRel(x+width, y+theight, 15, height-theight-RADIUS_LARGE, COL_MENUCONTENT_PLUS_1); - frameBuffer->paintBoxRel(x+ width +2, y+theight+2+int((currPage-1)*blockHeight) , 11, int(blockHeight), COL_MENUCONTENT_PLUS_3); + frameBuffer->paintBoxRel(x+ width +2, y+theight+2+(currPage-1)*(height-theight-4-RADIUS_LARGE)/nrOfPages, 11, (height-theight-4-RADIUS_LARGE)/nrOfPages, COL_MENUCONTENT_PLUS_3); } else frameBuffer->paintBoxRel(x, y+theight, width, height-theight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 8b02ef68d..ad6859b6c 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -875,9 +875,8 @@ void CTimerList::paint() frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1); int sbc= ((timerlist.size()- 1)/ listmaxshow)+ 1; - float sbh= (sb- 4)/ sbc; - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ int(page_nr * sbh) , 11, int(sbh), COL_MENUCONTENT_PLUS_3, RADIUS_SMALL); + frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ page_nr * (sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3, RADIUS_SMALL); } paintFoot(); diff --git a/src/gui/widget/listbox.cpp b/src/gui/widget/listbox.cpp index aca058963..1f364a804 100644 --- a/src/gui/widget/listbox.cpp +++ b/src/gui/widget/listbox.cpp @@ -70,10 +70,9 @@ void CListBox::paint() frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1); int sbc= ((getItemCount()- 1)/ listmaxshow)+ 1; - float sbh= (sb- 4)/ sbc; int sbs= (selected/listmaxshow); - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ int(sbs* sbh) , 11, int(sbh), COL_MENUCONTENT_PLUS_3); + frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3); } void CListBox::paintHead()