[DEV] update etk null
This commit is contained in:
parent
bf9d5a126a
commit
e060e381b1
@ -108,7 +108,7 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_
|
||||
colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
|
||||
}
|
||||
// Check if we need to display background
|
||||
if (colorFill != nullptr) {
|
||||
if (colorFill != null) {
|
||||
listSegmentFill.createSegmentList(listPoints);
|
||||
colorFill->setViewPort(listSegmentFill.getViewPort());
|
||||
listSegmentFill.applyMatrix(mtx);
|
||||
@ -118,7 +118,7 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_
|
||||
listSegmentFill);
|
||||
}
|
||||
// check if we need to display stroke:
|
||||
if (colorStroke != nullptr) {
|
||||
if (colorStroke != null) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints,
|
||||
m_paint.strokeWidth,
|
||||
m_paint.lineCap,
|
||||
|
@ -113,7 +113,7 @@ void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
|
||||
colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
|
||||
}
|
||||
// Check if we need to display background
|
||||
if (colorFill != nullptr) {
|
||||
if (colorFill != null) {
|
||||
listSegmentFill.createSegmentList(listPoints);
|
||||
colorFill->setViewPort(listSegmentFill.getViewPort());
|
||||
listSegmentFill.applyMatrix(mtx);
|
||||
@ -123,7 +123,7 @@ void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
|
||||
listSegmentFill);
|
||||
}
|
||||
// check if we need to display stroke:
|
||||
if (colorStroke != nullptr) {
|
||||
if (colorStroke != null) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints,
|
||||
m_paint.strokeWidth,
|
||||
m_paint.lineCap,
|
||||
|
@ -76,7 +76,7 @@ bool esvg::Group::parseXML(const exml::Element& _element, mat2x3& _parentTrans,
|
||||
} else {
|
||||
ESVG_ERROR("(l " << child.getPos() << ") node not suported : '" << child.getValue() << "' must be [g,a,path,rect,circle,ellipse,line,polyline,polygon,text]");
|
||||
}
|
||||
if (elementParser == nullptr) {
|
||||
if (elementParser == null) {
|
||||
ESVG_ERROR("(l " << child.getPos() << ") error on node: '" << child.getValue() << "' allocation error or not supported ...");
|
||||
continue;
|
||||
}
|
||||
@ -98,7 +98,7 @@ void esvg::Group::display(int32_t _spacing) {
|
||||
<< " stroke=" << m_paint.stroke.first << "/" << m_paint.stroke.second
|
||||
<< " stroke-width=" << m_paint.strokeWidth );
|
||||
for (auto &it : m_subElementList) {
|
||||
if (it != nullptr) {
|
||||
if (it != null) {
|
||||
it->display(_spacing+1);
|
||||
}
|
||||
}
|
||||
@ -108,7 +108,7 @@ void esvg::Group::display(int32_t _spacing) {
|
||||
void esvg::Group::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) {
|
||||
ESVG_VERBOSE(spacingDist(_level) << "DRAW esvg::group");
|
||||
for (auto &it : m_subElementList) {
|
||||
if (it != nullptr) {
|
||||
if (it != null) {
|
||||
it->draw(_myRenderer, _basicTrans, _level+1);
|
||||
}
|
||||
}
|
||||
@ -121,7 +121,7 @@ void esvg::Group::drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||
int32_t _level) {
|
||||
ESVG_VERBOSE(spacingDist(_level) << "DRAW shape esvg::group");
|
||||
for (auto &it : m_subElementList) {
|
||||
if (it != nullptr) {
|
||||
if (it != null) {
|
||||
it->drawShapePoints(_out, _recurtionMax, _threshold, _basicTrans, _level+1);
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ void esvg::Line::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t
|
||||
// Check if we need to display background
|
||||
// No background ...
|
||||
// check if we need to display stroke:
|
||||
if (colorStroke != nullptr) {
|
||||
if (colorStroke != null) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints,
|
||||
m_paint.strokeWidth,
|
||||
m_paint.lineCap,
|
||||
|
@ -151,19 +151,19 @@ const etk::Vector<etk::Pair<float, etk::Color<float,4>>>& esvg::LinearGradient::
|
||||
if (m_href == "") {
|
||||
return m_data;
|
||||
}
|
||||
if (_document == nullptr) {
|
||||
ESVG_ERROR("Get nullptr input for document");
|
||||
if (_document == null) {
|
||||
ESVG_ERROR("Get null input for document");
|
||||
return m_data;
|
||||
}
|
||||
ememory::SharedPtr<esvg::Base> base = _document->getReference(m_href);
|
||||
if (base == nullptr) {
|
||||
if (base == null) {
|
||||
ESVG_ERROR("Can not get base : '" << m_href << "'");
|
||||
return m_data;
|
||||
}
|
||||
ememory::SharedPtr<esvg::RadialGradient> gradientR = ememory::dynamicPointerCast<esvg::RadialGradient>(base);
|
||||
if (gradientR == nullptr) {
|
||||
if (gradientR == null) {
|
||||
ememory::SharedPtr<esvg::LinearGradient> gradientL = ememory::dynamicPointerCast<esvg::LinearGradient>(base);
|
||||
if (gradientL == nullptr) {
|
||||
if (gradientL == null) {
|
||||
ESVG_ERROR("Can not cast in a linear/radial gradient: '" << m_href << "' ==> wrong type");
|
||||
return m_data;
|
||||
}
|
||||
|
@ -21,17 +21,17 @@ esvg::Path::~Path() {
|
||||
// return the next char position ... (after 'X' or NULL)
|
||||
const char * extractCmd(const char* _input, char& _cmd, etk::Vector<float>& _outputList) {
|
||||
if (*_input == '\0') {
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
_outputList.clear();
|
||||
_cmd = '\0';
|
||||
const char * outputPointer = nullptr;
|
||||
const char * outputPointer = null;
|
||||
if (!( ( _input[0] <= 'Z'
|
||||
&& _input[0] >= 'A')
|
||||
|| ( _input[0] <= 'z'
|
||||
&& _input[0] >= 'a') ) ) {
|
||||
ESVG_ERROR("Error in the SVG Path : \"" << _input << "\"");
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
_cmd = _input[0];
|
||||
ESVG_VERBOSE("Find command : " << _cmd);
|
||||
@ -100,7 +100,7 @@ bool esvg::Path::parseXML(const exml::Element& _element, mat2x3& _parentTrans, v
|
||||
const char* elementXML = elementXML1.c_str();
|
||||
|
||||
for( const char *sss=extractCmd(elementXML, command, listDot);
|
||||
sss != nullptr;
|
||||
sss != null;
|
||||
sss=extractCmd(sss, command, listDot) ) {
|
||||
bool relative = false;
|
||||
switch(command) {
|
||||
@ -291,7 +291,7 @@ void esvg::Path::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t
|
||||
colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
|
||||
}
|
||||
// Check if we need to display background
|
||||
if (colorFill != nullptr) {
|
||||
if (colorFill != null) {
|
||||
listSegmentFill.createSegmentList(listPoints);
|
||||
colorFill->setViewPort(listSegmentFill.getViewPort());
|
||||
listSegmentFill.applyMatrix(mtx);
|
||||
@ -299,7 +299,7 @@ void esvg::Path::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t
|
||||
tmpFill.generate(_myRenderer.getSize(), _myRenderer.getNumberSubScanLine(), listSegmentFill);
|
||||
}
|
||||
// check if we need to display stroke:
|
||||
if (colorStroke != nullptr) {
|
||||
if (colorStroke != null) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints,
|
||||
m_paint.strokeWidth,
|
||||
m_paint.lineCap,
|
||||
|
@ -94,7 +94,7 @@ void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
|
||||
colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
|
||||
}
|
||||
// Check if we need to display background
|
||||
if (colorFill != nullptr) {
|
||||
if (colorFill != null) {
|
||||
listSegmentFill.createSegmentList(listPoints);
|
||||
colorFill->setViewPort(listSegmentFill.getViewPort());
|
||||
listSegmentFill.applyMatrix(mtx);
|
||||
@ -104,7 +104,7 @@ void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
|
||||
listSegmentFill);
|
||||
}
|
||||
// check if we need to display stroke:
|
||||
if (colorStroke != nullptr) {
|
||||
if (colorStroke != null) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints,
|
||||
m_paint.strokeWidth,
|
||||
m_paint.lineCap,
|
||||
|
@ -91,7 +91,7 @@ void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int3
|
||||
colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
|
||||
}
|
||||
// Check if we need to display background
|
||||
if (colorFill != nullptr) {
|
||||
if (colorFill != null) {
|
||||
listSegmentFill.createSegmentList(listPoints);
|
||||
colorFill->setViewPort(listSegmentFill.getViewPort());
|
||||
listSegmentFill.applyMatrix(mtx);
|
||||
@ -101,7 +101,7 @@ void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int3
|
||||
listSegmentFill);
|
||||
}
|
||||
// check if we need to display stroke:
|
||||
if (colorStroke != nullptr) {
|
||||
if (colorStroke != null) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints,
|
||||
m_paint.strokeWidth,
|
||||
m_paint.lineCap,
|
||||
|
@ -160,19 +160,19 @@ const etk::Vector<etk::Pair<float, etk::Color<float,4>>>& esvg::RadialGradient::
|
||||
if (m_href == "") {
|
||||
return m_data;
|
||||
}
|
||||
if (_document == nullptr) {
|
||||
ESVG_ERROR("Get nullptr input for document");
|
||||
if (_document == null) {
|
||||
ESVG_ERROR("Get null input for document");
|
||||
return m_data;
|
||||
}
|
||||
ememory::SharedPtr<esvg::Base> base = _document->getReference(m_href);
|
||||
if (base == nullptr) {
|
||||
if (base == null) {
|
||||
ESVG_ERROR("Can not get base : '" << m_href << "'");
|
||||
return m_data;
|
||||
}
|
||||
ememory::SharedPtr<esvg::RadialGradient> gradientR = ememory::dynamicPointerCast<esvg::RadialGradient>(base);
|
||||
if (gradientR == nullptr) {
|
||||
if (gradientR == null) {
|
||||
ememory::SharedPtr<esvg::LinearGradient> gradientL = ememory::dynamicPointerCast<esvg::LinearGradient>(base);
|
||||
if (gradientL == nullptr) {
|
||||
if (gradientL == null) {
|
||||
ESVG_ERROR("Can not cast in a linear/radial gradient: '" << m_href << "' ==> wrong type");
|
||||
return m_data;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int
|
||||
colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
|
||||
}
|
||||
// Check if we need to display background
|
||||
if (colorFill != nullptr) {
|
||||
if (colorFill != null) {
|
||||
listSegmentFill.createSegmentList(listPoints);
|
||||
colorFill->setViewPort(listSegmentFill.getViewPort());
|
||||
listSegmentFill.applyMatrix(mtx);
|
||||
@ -118,7 +118,7 @@ void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int
|
||||
listSegmentFill);
|
||||
}
|
||||
// check if we need to display stroke:
|
||||
if (colorStroke != nullptr) {
|
||||
if (colorStroke != null) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints,
|
||||
m_paint.strokeWidth,
|
||||
m_paint.lineCap,
|
||||
|
@ -57,11 +57,11 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
|
||||
const esvg::render::Weight& _weightStroke,
|
||||
ememory::SharedPtr<esvg::render::DynamicColor>& _colorStroke,
|
||||
float _opacity) {
|
||||
if (_colorFill != nullptr) {
|
||||
if (_colorFill != null) {
|
||||
//_colorFill->setViewPort(etk::Pair<vec2, vec2>(vec2(0,0), vec2(sizeX, sizeY)));
|
||||
_colorFill->generate(m_document);
|
||||
}
|
||||
if (_colorStroke != nullptr) {
|
||||
if (_colorStroke != null) {
|
||||
//_colorStroke->setViewPort(etk::Pair<vec2, vec2>(vec2(0,0), vec2(sizeX, sizeY)));
|
||||
_colorStroke->generate(m_document);
|
||||
}
|
||||
@ -74,12 +74,12 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
|
||||
// calculate merge of stroke and fill value:
|
||||
etk::Color<float,4> intermediateColorFill(etk::color::none);
|
||||
etk::Color<float,4> intermediateColorStroke(etk::color::none);
|
||||
if ( _colorFill != nullptr
|
||||
if ( _colorFill != null
|
||||
&& valueFill != 0.0f) {
|
||||
intermediateColorFill = _colorFill->getColor(pos);
|
||||
intermediateColorFill.setA(intermediateColorFill.a()*valueFill);
|
||||
}
|
||||
if ( _colorStroke != nullptr
|
||||
if ( _colorStroke != null
|
||||
&& valueStroke != 0.0f) {
|
||||
intermediateColorStroke = _colorStroke->getColor(pos);
|
||||
intermediateColorStroke.setA(intermediateColorStroke.a()*valueStroke);
|
||||
@ -101,7 +101,7 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
|
||||
#ifdef DEBUG
|
||||
// display the gradient position:
|
||||
ememory::SharedPtr<esvg::render::DynamicColorSpecial> tmpColor = ememory::dynamicPointerCast<esvg::render::DynamicColorSpecial>(_colorFill);
|
||||
if (tmpColor != nullptr) {
|
||||
if (tmpColor != null) {
|
||||
esvg::render::SegmentList listSegment;
|
||||
// Display bounding box
|
||||
listSegment.addSegment(esvg::render::Point(tmpColor->m_viewPort.first),
|
||||
|
@ -36,13 +36,13 @@ void esvg::Document::displayDebug() {
|
||||
ESVG_DEBUG("Main SVG: size=" << m_size);
|
||||
ESVG_DEBUG(" refs:");
|
||||
for (size_t iii=0; iii<m_refList.size(); iii++) {
|
||||
if (m_refList[iii] != nullptr) {
|
||||
if (m_refList[iii] != null) {
|
||||
m_refList[iii]->display(2);
|
||||
}
|
||||
}
|
||||
ESVG_DEBUG(" Nodes:");
|
||||
for (size_t iii=0; iii<m_subElementList.size(); iii++) {
|
||||
if (m_subElementList[iii] != nullptr) {
|
||||
if (m_subElementList[iii] != null) {
|
||||
m_subElementList[iii]->display(2);
|
||||
}
|
||||
}
|
||||
@ -51,7 +51,7 @@ void esvg::Document::displayDebug() {
|
||||
|
||||
void esvg::Document::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) {
|
||||
for (size_t iii=0; iii<m_subElementList.size(); iii++) {
|
||||
if (m_subElementList[iii] != nullptr) {
|
||||
if (m_subElementList[iii] != null) {
|
||||
m_subElementList[iii]->draw(_myRenderer, _basicTrans);
|
||||
}
|
||||
}
|
||||
@ -316,7 +316,7 @@ bool esvg::Document::parseXMLData(const exml::Element& _root, bool _isReference)
|
||||
} else {
|
||||
ESVG_ERROR("(l " << child.getPos() << ") node not suported : '" << child.getValue() << "' must be [title,g,a,path,rect,circle,ellipse,line,polyline,polygon,text,metadata]");
|
||||
}
|
||||
if (elementParser == nullptr) {
|
||||
if (elementParser == null) {
|
||||
ESVG_ERROR("(l " << child.getPos() << ") error on node: '" << child.getValue() << "' allocation error or not supported ...");
|
||||
continue;
|
||||
}
|
||||
@ -355,10 +355,10 @@ bool esvg::Document::parseXMLData(const exml::Element& _root, bool _isReference)
|
||||
ememory::SharedPtr<esvg::Base> esvg::Document::getReference(const etk::String& _name) {
|
||||
if (_name == "") {
|
||||
ESVG_ERROR("request a reference with no name ... ");
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
for (auto &it : m_refList) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
if (it->getId() == _name) {
|
||||
@ -366,7 +366,7 @@ ememory::SharedPtr<esvg::Base> esvg::Document::getReference(const etk::String& _
|
||||
}
|
||||
}
|
||||
ESVG_ERROR("Can not find reference name : '" << _name << "'");
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
|
||||
etk::Vector<etk::Vector<vec2>> esvg::Document::getLines(vec2 _size) {
|
||||
@ -393,7 +393,7 @@ void esvg::Document::drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||
int32_t _level) {
|
||||
ESVG_VERBOSE(spacingDist(_level) << "DRAW shape esvg::Document");
|
||||
for (auto &it : m_subElementList) {
|
||||
if (it != nullptr) {
|
||||
if (it != null) {
|
||||
it->drawShapePoints(_out, _recurtionMax, _threshold, _basicTrans, _level+1);
|
||||
}
|
||||
}
|
||||
|
@ -302,18 +302,18 @@ etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorRadial(const ivec
|
||||
|
||||
|
||||
void esvg::render::DynamicColorSpecial::generate(esvg::Document* _document) {
|
||||
if (_document == nullptr) {
|
||||
ESVG_ERROR("Get nullptr input for document");
|
||||
if (_document == null) {
|
||||
ESVG_ERROR("Get null input for document");
|
||||
return;
|
||||
}
|
||||
ememory::SharedPtr<esvg::Base> base = _document->getReference(m_colorName);
|
||||
if (base == nullptr) {
|
||||
if (base == null) {
|
||||
ESVG_ERROR("Can not get base : '" << m_colorName << "'");
|
||||
return;
|
||||
}
|
||||
// Now we can know if we use linear or radial gradient ...
|
||||
ememory::SharedPtr<esvg::LinearGradient> gradient = ememory::dynamicPointerCast<esvg::LinearGradient>(base);
|
||||
if (gradient != nullptr) {
|
||||
if (gradient != null) {
|
||||
m_linear = true;
|
||||
ESVG_VERBOSE("get for color linear:");
|
||||
gradient->display(2);
|
||||
@ -361,7 +361,7 @@ void esvg::render::DynamicColorSpecial::generate(esvg::Document* _document) {
|
||||
} else {
|
||||
m_linear = false;
|
||||
ememory::SharedPtr<esvg::RadialGradient> gradient = ememory::dynamicPointerCast<esvg::RadialGradient>(base);
|
||||
if (gradient == nullptr) {
|
||||
if (gradient == null) {
|
||||
ESVG_ERROR("Can not cast in a linear gradient: '" << m_colorName << "' ==> wrong type");
|
||||
return;
|
||||
}
|
||||
@ -443,7 +443,7 @@ ememory::SharedPtr<esvg::render::DynamicColor> esvg::render::createColor(etk::Pa
|
||||
// Check if need to create a color:
|
||||
if ( _color.first.a() == 0x00
|
||||
&& _color.second == "") {
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
if (_color.second != "") {
|
||||
return ememory::makeShared<esvg::render::DynamicColorSpecial>(_color.second, _mtx);
|
||||
|
@ -71,7 +71,7 @@ static const char* spacingDist(int32_t _spacing) {
|
||||
void esvg::render::Path::display(int32_t _spacing) {
|
||||
ESVG_DEBUG(spacingDist(_spacing) << "Path");
|
||||
for(auto &it : m_listElement) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
ESVG_DEBUG(spacingDist(_spacing+1) << *it);
|
||||
@ -132,7 +132,7 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
|
||||
bool PathStart = false;
|
||||
// Foreach element, we move in the path:
|
||||
for(auto &it : m_listElement) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
ESVG_VERBOSE(spacingDist(_level+1) << " Draw : " << *it);
|
||||
|
Loading…
Reference in New Issue
Block a user