[DEV] remove etk_min and etk_max & color properties

This commit is contained in:
Edouard DUPIN 2014-07-03 21:03:26 +02:00
parent a6c50c8f94
commit ac34d1f531
5 changed files with 14 additions and 14 deletions

View File

@ -221,20 +221,20 @@ void esvg::Base::parsePaintAttr(const exml::Element *_element) {
content = _element->getAttribute("opacity"); content = _element->getAttribute("opacity");
if (content.size()!=0) { if (content.size()!=0) {
float opacity = parseLength(content); float opacity = parseLength(content);
opacity = etk_max(0.0, etk_min(1.0, opacity)); opacity = std::avg(0.0f, opacity, 1.0f);
m_paint.fill.a = opacity*0xFF; m_paint.fill.a = opacity*0xFF;
m_paint.stroke.a = opacity*0xFF; m_paint.stroke.a = opacity*0xFF;
} }
content = _element->getAttribute("fill-opacity"); content = _element->getAttribute("fill-opacity");
if (content.size()!=0) { if (content.size()!=0) {
float opacity = parseLength(content); float opacity = parseLength(content);
opacity = etk_max(0.0, etk_min(1.0, opacity)); opacity = std::avg(0.0f, opacity, 1.0f);
m_paint.fill.a = opacity*0xFF; m_paint.fill.a = opacity*0xFF;
} }
content = _element->getAttribute("stroke-opacity"); content = _element->getAttribute("stroke-opacity");
if (content.size()!=0) { if (content.size()!=0) {
float opacity = parseLength(content); float opacity = parseLength(content);
opacity = etk_max(0.0, etk_min(1.0, opacity)); opacity = std::avg(0.0f, opacity, 1.0f);
m_paint.stroke.a = opacity*0xFF; m_paint.stroke.a = opacity*0xFF;
} }
content = _element->getAttribute("fill-rule"); content = _element->getAttribute("fill-rule");
@ -299,18 +299,18 @@ void esvg::Base::parsePaintAttr(const exml::Element *_element) {
SVG_VERBOSE(" input : \"" << outputValue << "\" == > " << m_paint.strokeWidth); SVG_VERBOSE(" input : \"" << outputValue << "\" == > " << m_paint.strokeWidth);
} else if (outputType == "opacity" ) { } else if (outputType == "opacity" ) {
float opacity = parseLength(outputValue); float opacity = parseLength(outputValue);
opacity = etk_max(0.0, etk_min(1.0, opacity)); opacity = std::avg(0.0f, opacity, 1.0f);
m_paint.fill.a = opacity*0xFF; m_paint.fill.a = opacity*0xFF;
m_paint.stroke.a = opacity*0xFF; m_paint.stroke.a = opacity*0xFF;
SVG_VERBOSE(" input : \"" << outputValue << "\" == > " << m_paint.fill); SVG_VERBOSE(" input : \"" << outputValue << "\" == > " << m_paint.fill);
} else if (outputType == "fill-opacity") { } else if (outputType == "fill-opacity") {
float opacity = parseLength(outputValue); float opacity = parseLength(outputValue);
opacity = etk_max(0.0, etk_min(1.0, opacity)); opacity = std::avg(0.0f, opacity, 1.0f);
m_paint.fill.a = opacity*0xFF; m_paint.fill.a = opacity*0xFF;
SVG_VERBOSE(" input : \"" << outputValue << "\" == > " << m_paint.fill); SVG_VERBOSE(" input : \"" << outputValue << "\" == > " << m_paint.fill);
} else if (outputType == "stroke-opacity") { } else if (outputType == "stroke-opacity") {
float opacity = parseLength(outputValue); float opacity = parseLength(outputValue);
opacity = etk_max(0.0, etk_min(1.0, opacity)); opacity = std::avg(0.0f, opacity, 1.0f);
m_paint.stroke.a = opacity*0xFF; m_paint.stroke.a = opacity*0xFF;
SVG_VERBOSE(" input : \"" << outputValue << "\" == > " << m_paint.stroke); SVG_VERBOSE(" input : \"" << outputValue << "\" == > " << m_paint.stroke);
} else if (outputType == "fill-rule" ) { } else if (outputType == "fill-rule" ) {

View File

@ -89,8 +89,8 @@ bool esvg::Group::parse(exml::Element * _element, agg::trans_affine& _parentTran
delete(elementParser); delete(elementParser);
elementParser = NULL; elementParser = NULL;
} else { } else {
_sizeMax.setValue(etk_max(_sizeMax.x(), tmpPos.x()), _sizeMax.setValue(std::max(_sizeMax.x(), tmpPos.x()),
etk_max(_sizeMax.y(), tmpPos.y())); std::max(_sizeMax.y(), tmpPos.y()));
// add element in the system // add element in the system
m_subElementList.push_back(elementParser); m_subElementList.push_back(elementParser);
} }

View File

@ -51,8 +51,8 @@ bool esvg::Line::parse(exml::Element * _element, agg::trans_affine& _parentTrans
if (content.size()!=0) { if (content.size()!=0) {
m_stopPos.setY(parseLength(content)); m_stopPos.setY(parseLength(content));
} }
_sizeMax.setValue(etk_max(m_startPos.x(), m_stopPos.x()), _sizeMax.setValue(std::max(m_startPos.x(), m_stopPos.x()),
etk_max(m_startPos.y(), m_stopPos.y())); std::max(m_startPos.y(), m_stopPos.y()));
return true; return true;
} }

View File

@ -50,8 +50,8 @@ bool esvg::Polygon::parse(exml::Element * _element, agg::trans_affine& _parentTr
if (sscanf(sss, "%f,%f%n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) { if (sscanf(sss, "%f,%f%n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
m_listPoint.push_back(pos); m_listPoint.push_back(pos);
sss += n; sss += n;
_sizeMax.setValue(etk_max(_sizeMax.x(), pos.x()), _sizeMax.setValue(std::max(_sizeMax.x(), pos.x()),
etk_max(_sizeMax.y(), pos.y())); std::max(_sizeMax.y(), pos.y()));
if(sss[0] == ' ' || sss[0] == ',') { if(sss[0] == ' ' || sss[0] == ',') {
sss++; sss++;
} }

View File

@ -44,8 +44,8 @@ bool esvg::Polyline::parse(exml::Element * _element, agg::trans_affine& _parentT
int32_t n; int32_t n;
if (sscanf(sss, "%f,%f %n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) { if (sscanf(sss, "%f,%f %n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
m_listPoint.push_back(pos); m_listPoint.push_back(pos);
_sizeMax.setValue(etk_max(_sizeMax.x(), pos.x()), _sizeMax.setValue(std::max(_sizeMax.x(), pos.x()),
etk_max(_sizeMax.y(), pos.y())); std::max(_sizeMax.y(), pos.y()));
sss += n; sss += n;
} else { } else {
break; break;