return the grid::value_type instead of hardcoding int

This commit is contained in:
Dane Springmeyer 2012-12-19 18:06:51 -08:00
parent 3df8574c84
commit e53914463a

View file

@ -39,13 +39,12 @@ bool painted(mapnik::grid const& grid)
return grid.painted(); return grid.painted();
} }
int get_pixel(mapnik::grid const& grid, int x, int y) mapnik::grid::value_type get_pixel(mapnik::grid const& grid, int x, int y)
{ {
if (x < static_cast<int>(grid.width()) && y < static_cast<int>(grid.height())) if (x < static_cast<int>(grid.width()) && y < static_cast<int>(grid.height()))
{ {
mapnik::grid::value_type const * row = grid.getRow(y); mapnik::grid::data_type const & data = grid.data();
mapnik::grid::value_type const pixel = row[x]; return data(x,y);
return pixel;
} }
PyErr_SetString(PyExc_IndexError, "invalid x,y for grid dimensions"); PyErr_SetString(PyExc_IndexError, "invalid x,y for grid dimensions");
boost::python::throw_error_already_set(); boost::python::throw_error_already_set();