[DEV] update to the new ETK allocator wrapper

This commit is contained in:
Edouard DUPIN 2017-10-21 19:05:21 +02:00
parent eaa443d484
commit bf9d5a126a
6 changed files with 14 additions and 15 deletions

View File

@ -200,7 +200,7 @@ etk::Pair<float, enum esvg::distance> esvg::Base::parseLength2(const etk::String
ESVG_VERBOSE(" lenght : '" << _dataInput << "'"); ESVG_VERBOSE(" lenght : '" << _dataInput << "'");
float n = _dataInput.to<float>(); float n = _dataInput.to<float>();
etk::String unit; etk::String unit;
for (int32_t iii=0; iii<_dataInput.size(); ++iii) { for (size_t iii=0; iii<_dataInput.size(); ++iii) {
if( (_dataInput[iii]>='0' && _dataInput[iii]<='9') if( (_dataInput[iii]>='0' && _dataInput[iii]<='9')
|| _dataInput[iii]=='+' || _dataInput[iii]=='+'
|| _dataInput[iii]=='-' || _dataInput[iii]=='-'

View File

@ -64,7 +64,7 @@ void esvg::Polygon::display(int32_t _spacing) {
esvg::render::Path esvg::Polygon::createPath() { esvg::render::Path esvg::Polygon::createPath() {
esvg::render::Path out; esvg::render::Path out;
out.moveTo(false, m_listPoint[0]); out.moveTo(false, m_listPoint[0]);
for( int32_t iii=1; iii< m_listPoint.size(); iii++) { for(size_t iii=1; iii< m_listPoint.size(); iii++) {
out.lineTo(false, m_listPoint[iii]); out.lineTo(false, m_listPoint[iii]);
} }
out.close(); out.close();

View File

@ -61,7 +61,7 @@ esvg::render::Path esvg::Polyline::createPath() {
esvg::render::Path out; esvg::render::Path out;
out.clear(); out.clear();
out.moveTo(false, m_listPoint[0]); out.moveTo(false, m_listPoint[0]);
for( int32_t iii=1; iii< m_listPoint.size(); iii++) { for(size_t iii=1; iii< m_listPoint.size(); iii++) {
out.lineTo(false, m_listPoint[iii]); out.lineTo(false, m_listPoint[iii]);
} }
out.stop(); out.stop();

View File

@ -39,7 +39,7 @@ void esvg::render::PointList::display() {
ESVG_VERBOSE(" Display list of points : size=" << m_data.size()); ESVG_VERBOSE(" Display list of points : size=" << m_data.size());
for (auto &it : m_data) { for (auto &it : m_data) {
ESVG_VERBOSE(" Find List " << it.size() << " members"); ESVG_VERBOSE(" Find List " << it.size() << " members");
for (int32_t iii=0; for (size_t iii=0;
iii < it.size(); iii < it.size();
++iii) { ++iii) {
switch (it[iii].m_type) { switch (it[iii].m_type) {

View File

@ -8,8 +8,7 @@
#include <esvg/debug.hpp> #include <esvg/debug.hpp>
esvg::render::Scanline::Scanline(size_t _size) { esvg::render::Scanline::Scanline(size_t _size) {
float tmp(0); m_data.resize(_size, 0.0f);
m_data.resize(_size, tmp);
} }
size_t esvg::render::Scanline::size() const { size_t esvg::render::Scanline::size() const {
@ -23,16 +22,16 @@ void esvg::render::Scanline::clear(float _fill) {
} }
float esvg::render::Scanline::get(int32_t _pos) const { float esvg::render::Scanline::get(int32_t _pos) const {
if( _pos>=0 if( _pos >= 0
&& _pos<m_data.size()) { && size_t(_pos) < m_data.size()) {
return m_data[_pos]; return m_data[_pos];
} }
return 0; return 0;
} }
void esvg::render::Scanline::set(int32_t _pos, float _newColor) { void esvg::render::Scanline::set(int32_t _pos, float _newColor) {
if( _pos>=0 if( _pos >= 0
&& _pos<m_data.size()) { && size_t(_pos) < m_data.size()) {
m_data[_pos] = _newColor; m_data[_pos] = _newColor;
} }
} }

View File

@ -49,7 +49,7 @@ etk::Pair<vec2, vec2> esvg::render::SegmentList::getViewPort() {
void esvg::render::SegmentList::createSegmentList(const esvg::render::PointList& _listPoint) { void esvg::render::SegmentList::createSegmentList(const esvg::render::PointList& _listPoint) {
for (auto &it : _listPoint.m_data) { for (auto &it : _listPoint.m_data) {
// Build Segments // Build Segments
for (int32_t iii=0, jjj=it.size()-1; for (size_t iii=0, jjj=it.size()-1;
iii < it.size(); iii < it.size();
jjj = iii++) { jjj = iii++) {
addSegment(it[jjj], it[iii]); addSegment(it[jjj], it[iii]);
@ -137,10 +137,10 @@ void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList&
// . * * . * * * * * * * * * * * * * // . * * . * * * * * * * * * * * * *
// * * // * *
// * * // * *
for (int32_t idPevious=itListPoint.size()-1, idCurrent=0, idNext=1; for (int64_t idPevious=itListPoint.size()-1, idCurrent=0, idNext=1;
idCurrent < itListPoint.size(); idCurrent < int64_t(itListPoint.size());
idPevious = idCurrent++, idNext++) { idPevious = idCurrent++, idNext++) {
if (idNext == itListPoint.size()) { if (idNext == int64_t(itListPoint.size())) {
idNext = 0; idNext = 0;
} }
if ( itListPoint[idCurrent].m_type == esvg::render::Point::type::join if ( itListPoint[idCurrent].m_type == esvg::render::Point::type::join
@ -149,7 +149,7 @@ void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList&
ESVG_ERROR("an error occure a previous ID is < 0.... "); ESVG_ERROR("an error occure a previous ID is < 0.... ");
continue; continue;
} }
if (idNext >= itListPoint.size()) { if (idNext >= int64_t(itListPoint.size())) {
ESVG_ERROR("an error occure a next ID is >= nbPoint len .... "); ESVG_ERROR("an error occure a next ID is >= nbPoint len .... ");
continue; continue;
} }