Skip to content

Commit

Permalink
[elistboxcontent.cpp] add float check
Browse files Browse the repository at this point in the history
Based on OpenATV
  • Loading branch information
Huevos committed Feb 9, 2022
1 parent 4e00e30 commit 411885f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/gui/elistboxcontent.cpp
Expand Up @@ -918,10 +918,10 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
continue;

const char *string = (PyUnicode_Check(pstring)) ? PyUnicode_AsUTF8(pstring) : "<not-a-string>";
int x = PyLong_AsLong(px) + offset.x();
int y = PyLong_AsLong(py) + offset.y();
int width = PyLong_AsLong(pwidth);
int height = PyLong_AsLong(pheight);
int x = (PyFloat_Check(px) ? (int)PyFloat_AsDouble(px) : PyLong_AsLong(px)) + offset.x();
int y = (PyFloat_Check(py) ? (int)PyFloat_AsDouble(py) : PyLong_AsLong(py)) + offset.y();
int width = PyFloat_Check(pwidth) ? (int)PyFloat_AsDouble(pwidth) : PyLong_AsLong(pwidth);
int height = PyFloat_Check(pheight) ? (int)PyFloat_AsDouble(pheight) : PyLong_AsLong(pheight);
int flags = PyLong_AsLong(pflags);
int fnt = PyLong_AsLong(pfnt);
int bwidth = pborderWidth ? PyLong_AsLong(pborderWidth) : 0;
Expand Down Expand Up @@ -1039,10 +1039,10 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
pbackColorSelected=ePyObject();
}

int x = PyLong_AsLong(px) + offset.x();
int y = PyLong_AsLong(py) + offset.y();
int width = PyLong_AsLong(pwidth);
int height = PyLong_AsLong(pheight);
int x = (PyFloat_Check(px) ? (int)PyFloat_AsDouble(px) : PyLong_AsLong(px)) + offset.x();
int y = (PyFloat_Check(py) ? (int)PyFloat_AsDouble(py) : PyLong_AsLong(py)) + offset.y();
int width = PyFloat_Check(pwidth) ? (int)PyFloat_AsDouble(pwidth) : PyLong_AsLong(pwidth);
int height = PyFloat_Check(pheight) ? (int)PyFloat_AsDouble(pheight) : PyLong_AsLong(pheight);
int filled = PyLong_AsLong(pfilled_perc);

if ((filled < 0) && data) /* if the string is in a negative number, it refers to the 'data' list. */
Expand Down Expand Up @@ -1129,10 +1129,10 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
if (ppixmap == Py_None)
continue;

int x = PyLong_AsLong(px) + offset.x();
int y = PyLong_AsLong(py) + offset.y();
int width = PyLong_AsLong(pwidth);
int height = PyLong_AsLong(pheight);
int x = (PyFloat_Check(px) ? (int)PyFloat_AsDouble(px) : PyLong_AsLong(px)) + offset.x();
int y = (PyFloat_Check(py) ? (int)PyFloat_AsDouble(py) : PyLong_AsLong(py)) + offset.y();
int width = PyFloat_Check(pwidth) ? (int)PyFloat_AsDouble(pwidth) : PyLong_AsLong(pwidth);
int height = PyFloat_Check(pheight) ? (int)PyFloat_AsDouble(pheight) : PyLong_AsLong(pheight);
int flags = 0;
ePtr<gPixmap> pixmap;
if (SwigFromPython(pixmap, ppixmap))
Expand Down

0 comments on commit 411885f

Please sign in to comment.