CComponentsForm: avoid of height or width error due to odd values

Some calculations can resulting odd values and can provocate
unnecessary debug spam, but more lines should be repaired.


Origin commit data
------------------
Branch: ni/coolstream
Commit: a0a4cc1355
Author: Thilo Graf <dbt@novatux.de>
Date: 2014-01-06 (Mon, 06 Jan 2014)



------------------
This commit was generated by Migit
This commit is contained in:
2014-01-06 00:58:02 +01:00
parent ca7b7ccf03
commit 540cecde0f

View File

@@ -355,6 +355,9 @@ void CComponentsForm::paintCCItems()
int right_item = cc_item->getRealXPos() + w_item; int right_item = cc_item->getRealXPos() + w_item;
int w_diff = right_item - right_frm; int w_diff = right_item - right_frm;
int new_w = w_item - w_diff; int new_w = w_item - w_diff;
//avoid of width error due to odd values (1 line only)
right_item -= (new_w%2);
w_item -= (new_w%2);
if (right_item > right_frm){ if (right_item > right_frm){
printf("[CComponentsForm] %s: [form: %d] [item-index %d] [type=%d] width is too large, definied width=%d, possible width=%d \n", printf("[CComponentsForm] %s: [form: %d] [item-index %d] [type=%d] width is too large, definied width=%d, possible width=%d \n",
__func__, cc_item_index, cc_item->getIndex(), cc_item->getItemType(), w_item, new_w); __func__, cc_item_index, cc_item->getIndex(), cc_item->getItemType(), w_item, new_w);
@@ -366,6 +369,9 @@ void CComponentsForm::paintCCItems()
int bottom_item = cc_item->getRealYPos() + h_item; int bottom_item = cc_item->getRealYPos() + h_item;
int h_diff = bottom_item - bottom_frm; int h_diff = bottom_item - bottom_frm;
int new_h = h_item - h_diff; int new_h = h_item - h_diff;
//avoid of height error due to odd values (1 line only)
bottom_item -= (new_h%2);
h_item -= (new_h%2);
if (bottom_item > bottom_frm){ if (bottom_item > bottom_frm){
printf("[CComponentsForm] %s: [form: %d] [item-index %d] [type=%d] height is too large, definied height=%d, possible height=%d \n", printf("[CComponentsForm] %s: [form: %d] [item-index %d] [type=%d] height is too large, definied height=%d, possible height=%d \n",
__func__, cc_item_index, cc_item->getIndex(), cc_item->getItemType(), h_item, new_h); __func__, cc_item_index, cc_item->getIndex(), cc_item->getItemType(), h_item, new_h);