[DEV] update new ememory::SharedPtr

This commit is contained in:
Edouard DUPIN 2016-07-15 21:22:11 +02:00
parent 2b3f855485
commit a9297c4cb1
19 changed files with 85 additions and 85 deletions

View File

@ -99,8 +99,8 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
esvg::render::SegmentList listSegmentStroke;
esvg::render::Weight tmpFill;
esvg::render::Weight tmpStroke;
std::shared_ptr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
std::shared_ptr<esvg::render::DynamicColor> colorStroke;
ememory::SharedPtr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
ememory::SharedPtr<esvg::render::DynamicColor> colorStroke;
if (m_paint.strokeWidth > 0.0f) {
colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
}

View File

@ -104,8 +104,8 @@ void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
esvg::render::SegmentList listSegmentStroke;
esvg::render::Weight tmpFill;
esvg::render::Weight tmpStroke;
std::shared_ptr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
std::shared_ptr<esvg::render::DynamicColor> colorStroke;
ememory::SharedPtr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
ememory::SharedPtr<esvg::render::DynamicColor> colorStroke;
if (m_paint.strokeWidth > 0.0f) {
colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
}

View File

@ -54,27 +54,27 @@ bool esvg::Group::parseXML(const exml::Element& _element, mat2& _parentTrans, ve
// can be a comment ...
continue;
}
std::shared_ptr<esvg::Base> elementParser;
ememory::SharedPtr<esvg::Base> elementParser;
if (child.getValue() == "g") {
elementParser = std::make_shared<esvg::Group>(m_paint);
elementParser = ememory::makeShared<esvg::Group>(m_paint);
} else if (child.getValue() == "a") {
// TODO ...
} else if (child.getValue() == "path") {
elementParser = std::make_shared<esvg::Path>(m_paint);
elementParser = ememory::makeShared<esvg::Path>(m_paint);
} else if (child.getValue() == "rect") {
elementParser = std::make_shared<esvg::Rectangle>(m_paint);
elementParser = ememory::makeShared<esvg::Rectangle>(m_paint);
} else if (child.getValue() == "circle") {
elementParser = std::make_shared<esvg::Circle>(m_paint);
elementParser = ememory::makeShared<esvg::Circle>(m_paint);
} else if (child.getValue() == "ellipse") {
elementParser = std::make_shared<esvg::Ellipse>(m_paint);
elementParser = ememory::makeShared<esvg::Ellipse>(m_paint);
} else if (child.getValue() == "line") {
elementParser = std::make_shared<esvg::Line>(m_paint);
elementParser = ememory::makeShared<esvg::Line>(m_paint);
} else if (child.getValue() == "polyline") {
elementParser = std::make_shared<esvg::Polyline>(m_paint);
elementParser = ememory::makeShared<esvg::Polyline>(m_paint);
} else if (child.getValue() == "polygon") {
elementParser = std::make_shared<esvg::Polygon>(m_paint);
elementParser = ememory::makeShared<esvg::Polygon>(m_paint);
} else if (child.getValue() == "text") {
elementParser = std::make_shared<esvg::Text>(m_paint);
elementParser = ememory::makeShared<esvg::Text>(m_paint);
} else {
ESVG_ERROR("(l " << child.getPos() << ") node not suported : '" << child.getValue() << "' must be [g,a,path,rect,circle,ellipse,line,polyline,polygon,text]");
}

View File

@ -13,7 +13,7 @@
namespace esvg {
class Group : public esvg::Base {
private:
std::vector<std::shared_ptr<esvg::Base>> m_subElementList; //!< sub elements ...
std::vector<ememory::SharedPtr<esvg::Base>> m_subElementList; //!< sub elements ...
public:
Group(PaintState _parentPaintState);
~Group();

View File

@ -78,8 +78,8 @@ void esvg::Line::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _l
esvg::render::SegmentList listSegmentStroke;
esvg::render::Weight tmpFill;
esvg::render::Weight tmpStroke;
std::shared_ptr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
std::shared_ptr<esvg::render::DynamicColor> colorStroke;
ememory::SharedPtr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
ememory::SharedPtr<esvg::render::DynamicColor> colorStroke;
if (m_paint.strokeWidth > 0.0f) {
colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
}

View File

@ -157,14 +157,14 @@ const std::vector<std::pair<float, etk::Color<float,4>>>& esvg::LinearGradient::
ESVG_ERROR("Get nullptr input for document");
return m_data;
}
std::shared_ptr<esvg::Base> base = _document->getReference(m_href);
ememory::SharedPtr<esvg::Base> base = _document->getReference(m_href);
if (base == nullptr) {
ESVG_ERROR("Can not get base : '" << m_href << "'");
return m_data;
}
std::shared_ptr<esvg::RadialGradient> gradientR = std::dynamic_pointer_cast<esvg::RadialGradient>(base);
ememory::SharedPtr<esvg::RadialGradient> gradientR = ememory::dynamicPointerCast<esvg::RadialGradient>(base);
if (gradientR == nullptr) {
std::shared_ptr<esvg::LinearGradient> gradientL = std::dynamic_pointer_cast<esvg::LinearGradient>(base);
ememory::SharedPtr<esvg::LinearGradient> gradientL = ememory::dynamicPointerCast<esvg::LinearGradient>(base);
if (gradientL == nullptr) {
ESVG_ERROR("Can not cast in a linear/radial gradient: '" << m_href << "' ==> wrong type");
return m_data;

View File

@ -287,8 +287,8 @@ void esvg::Path::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _l
esvg::render::SegmentList listSegmentStroke;
esvg::render::Weight tmpFill;
esvg::render::Weight tmpStroke;
std::shared_ptr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
std::shared_ptr<esvg::render::DynamicColor> colorStroke;
ememory::SharedPtr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
ememory::SharedPtr<esvg::render::DynamicColor> colorStroke;
if (m_paint.strokeWidth > 0.0f) {
colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
}

View File

@ -85,8 +85,8 @@ void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
esvg::render::SegmentList listSegmentStroke;
esvg::render::Weight tmpFill;
esvg::render::Weight tmpStroke;
std::shared_ptr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
std::shared_ptr<esvg::render::DynamicColor> colorStroke;
ememory::SharedPtr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
ememory::SharedPtr<esvg::render::DynamicColor> colorStroke;
if (m_paint.strokeWidth > 0.0f) {
colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
}

View File

@ -82,8 +82,8 @@ void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_
esvg::render::SegmentList listSegmentStroke;
esvg::render::Weight tmpFill;
esvg::render::Weight tmpStroke;
std::shared_ptr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
std::shared_ptr<esvg::render::DynamicColor> colorStroke;
ememory::SharedPtr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
ememory::SharedPtr<esvg::render::DynamicColor> colorStroke;
if (m_paint.strokeWidth > 0.0f) {
colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
}

View File

@ -166,14 +166,14 @@ const std::vector<std::pair<float, etk::Color<float,4>>>& esvg::RadialGradient::
ESVG_ERROR("Get nullptr input for document");
return m_data;
}
std::shared_ptr<esvg::Base> base = _document->getReference(m_href);
ememory::SharedPtr<esvg::Base> base = _document->getReference(m_href);
if (base == nullptr) {
ESVG_ERROR("Can not get base : '" << m_href << "'");
return m_data;
}
std::shared_ptr<esvg::RadialGradient> gradientR = std::dynamic_pointer_cast<esvg::RadialGradient>(base);
ememory::SharedPtr<esvg::RadialGradient> gradientR = ememory::dynamicPointerCast<esvg::RadialGradient>(base);
if (gradientR == nullptr) {
std::shared_ptr<esvg::LinearGradient> gradientL = std::dynamic_pointer_cast<esvg::LinearGradient>(base);
ememory::SharedPtr<esvg::LinearGradient> gradientL = ememory::dynamicPointerCast<esvg::LinearGradient>(base);
if (gradientL == nullptr) {
ESVG_ERROR("Can not cast in a linear/radial gradient: '" << m_href << "' ==> wrong type");
return m_data;

View File

@ -99,8 +99,8 @@ void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32
esvg::render::SegmentList listSegmentStroke;
esvg::render::Weight tmpFill;
esvg::render::Weight tmpStroke;
std::shared_ptr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
std::shared_ptr<esvg::render::DynamicColor> colorStroke;
ememory::SharedPtr<esvg::render::DynamicColor> colorFill = esvg::render::createColor(m_paint.fill, mtx);
ememory::SharedPtr<esvg::render::DynamicColor> colorStroke;
if (m_paint.strokeWidth > 0.0f) {
colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
}

View File

@ -55,9 +55,9 @@ etk::Color<float,4> esvg::Renderer::mergeColor(etk::Color<float,4> _base, etk::C
}
void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
const std::shared_ptr<esvg::render::DynamicColor>& _colorFill,
ememory::SharedPtr<esvg::render::DynamicColor>& _colorFill,
const esvg::render::Weight& _weightStroke,
const std::shared_ptr<esvg::render::DynamicColor>& _colorStroke,
ememory::SharedPtr<esvg::render::DynamicColor>& _colorStroke,
float _opacity) {
if (_colorFill != nullptr) {
//_colorFill->setViewPort(std::pair<vec2, vec2>(vec2(0,0), vec2(sizeX, sizeY)));
@ -102,7 +102,7 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
}
#ifdef DEBUG
// display the gradient position:
std::shared_ptr<esvg::render::DynamicColorSpecial> tmpColor = std::dynamic_pointer_cast<esvg::render::DynamicColorSpecial>(_colorFill);
ememory::SharedPtr<esvg::render::DynamicColorSpecial> tmpColor = ememory::dynamicPointerCast<esvg::render::DynamicColorSpecial>(_colorFill);
if (tmpColor != nullptr) {
esvg::render::SegmentList listSegment;
// Display bounding box

View File

@ -55,9 +55,9 @@ namespace esvg {
etk::Color<float,4> mergeColor(etk::Color<float,4> _base, etk::Color<float,4> _integration);
public:
void print(const esvg::render::Weight& _weightFill,
const std::shared_ptr<esvg::render::DynamicColor>& _colorFill,
ememory::SharedPtr<esvg::render::DynamicColor>& _colorFill,
const esvg::render::Weight& _weightStroke,
const std::shared_ptr<esvg::render::DynamicColor>& _colorStroke,
ememory::SharedPtr<esvg::render::DynamicColor>& _colorStroke,
float _opacity);
#ifdef DEBUG
void addDebugSegment(const esvg::render::SegmentList& _listSegment);

View File

@ -73,7 +73,7 @@ void esvg::Document::generateAnImage(const ivec2& _size, const std::string& _fil
}
ESVG_DEBUG("Generate size " << sizeRender);
std::shared_ptr<esvg::Renderer> renderedElement = std::make_shared<esvg::Renderer>(sizeRender, this, _visualDebug);
ememory::SharedPtr<esvg::Renderer> renderedElement = ememory::makeShared<esvg::Renderer>(sizeRender, this, _visualDebug);
// create the first element matrix modification ...
mat2 basicTrans;
basicTrans *= etk::mat2Scale(vec2(sizeRender.x()/m_size.x(), sizeRender.y()/m_size.y()));
@ -98,7 +98,7 @@ std::vector<etk::Color<float,4>> esvg::Document::renderImageFloatRGBA(ivec2& _si
_size.setY(m_size.y());
}
ESVG_DEBUG("Generate size " << _size);
std::shared_ptr<esvg::Renderer> renderedElement = std::make_shared<esvg::Renderer>(_size, this);
ememory::SharedPtr<esvg::Renderer> renderedElement = ememory::makeShared<esvg::Renderer>(_size, this);
// create the first element matrix modification ...
mat2 basicTrans;
basicTrans *= etk::mat2Scale(vec2(_size.x()/m_size.x(), _size.y()/m_size.y()));
@ -260,44 +260,44 @@ bool esvg::Document::parseXMLData(const exml::Element& _root, bool _isReference)
// comment can be here...
continue;
}
std::shared_ptr<esvg::Base> elementParser;
ememory::SharedPtr<esvg::Base> elementParser;
if (child.getValue() == "g") {
elementParser = std::make_shared<esvg::Group>(m_paint);
elementParser = ememory::makeShared<esvg::Group>(m_paint);
} else if (child.getValue() == "a") {
ESVG_INFO("Note : 'a' balise is parsed like a g balise ...");
elementParser = std::make_shared<esvg::Group>(m_paint);
elementParser = ememory::makeShared<esvg::Group>(m_paint);
} else if (child.getValue() == "title") {
m_title = "TODO : set the title here ...";
continue;
} else if (child.getValue() == "path") {
elementParser = std::make_shared<esvg::Path>(m_paint);
elementParser = ememory::makeShared<esvg::Path>(m_paint);
} else if (child.getValue() == "rect") {
elementParser = std::make_shared<esvg::Rectangle>(m_paint);
elementParser = ememory::makeShared<esvg::Rectangle>(m_paint);
} else if (child.getValue() == "circle") {
elementParser = std::make_shared<esvg::Circle>(m_paint);
elementParser = ememory::makeShared<esvg::Circle>(m_paint);
} else if (child.getValue() == "ellipse") {
elementParser = std::make_shared<esvg::Ellipse>(m_paint);
elementParser = ememory::makeShared<esvg::Ellipse>(m_paint);
} else if (child.getValue() == "line") {
elementParser = std::make_shared<esvg::Line>(m_paint);
elementParser = ememory::makeShared<esvg::Line>(m_paint);
} else if (child.getValue() == "polyline") {
elementParser = std::make_shared<esvg::Polyline>(m_paint);
elementParser = ememory::makeShared<esvg::Polyline>(m_paint);
} else if (child.getValue() == "polygon") {
elementParser = std::make_shared<esvg::Polygon>(m_paint);
elementParser = ememory::makeShared<esvg::Polygon>(m_paint);
} else if (child.getValue() == "text") {
elementParser = std::make_shared<esvg::Text>(m_paint);
elementParser = ememory::makeShared<esvg::Text>(m_paint);
} else if (child.getValue() == "radialGradient") {
if (_isReference == false) {
ESVG_ERROR("'" << child.getValue() << "' node must not be defined outside a defs Section");
continue;
} else {
elementParser = std::make_shared<esvg::RadialGradient>(m_paint);
elementParser = ememory::makeShared<esvg::RadialGradient>(m_paint);
}
} else if (child.getValue() == "linearGradient") {
if (_isReference == false) {
ESVG_ERROR("'" << child.getValue() << "' node must not be defined outside a defs Section");
continue;
} else {
elementParser = std::make_shared<esvg::LinearGradient>(m_paint);
elementParser = ememory::makeShared<esvg::LinearGradient>(m_paint);
}
} else if (child.getValue() == "defs") {
if (_isReference == true) {
@ -353,7 +353,7 @@ bool esvg::Document::parseXMLData(const exml::Element& _root, bool _isReference)
std::shared_ptr<esvg::Base> esvg::Document::getReference(const std::string& _name) {
ememory::SharedPtr<esvg::Base> esvg::Document::getReference(const std::string& _name) {
if (_name == "") {
ESVG_ERROR("request a reference with no name ... ");
return nullptr;

View File

@ -21,8 +21,8 @@ namespace esvg {
bool m_loadOK;
std::string m_version;
std::string m_title;
std::vector<std::shared_ptr<esvg::Base>> m_subElementList; //!< sub-element list
std::vector<std::shared_ptr<esvg::Base>> m_refList; //!< reference elements ...
std::vector<ememory::SharedPtr<esvg::Base>> m_subElementList; //!< sub-element list
std::vector<ememory::SharedPtr<esvg::Base>> m_refList; //!< reference elements ...
vec2 m_size;
public:
Document();
@ -91,7 +91,7 @@ namespace esvg {
vec2 getDefinedSize() {
return m_size;
};
std::shared_ptr<esvg::Base> getReference(const std::string& _name);
ememory::SharedPtr<esvg::Base> getReference(const std::string& _name);
};
}

View File

@ -42,7 +42,7 @@ static vec2 getIntersect(const vec2& _point1,
return _point2;
}
etk::Color<float,4> esvg::render::DynamicColorSpecial::getColor(const ivec2& _pos) {
etk::Color<float,4> esvg::render::DynamicColorSpecial::getColor(const ivec2& _pos) const {
if (m_data.size() < 2) {
return etk::color::purple;
}
@ -54,7 +54,7 @@ etk::Color<float,4> esvg::render::DynamicColorSpecial::getColor(const ivec2& _po
return etk::color::purple;
}
etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorLinear(const ivec2& _pos) {
etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorLinear(const ivec2& _pos) const {
float ratio = 0.0f;
if (m_unit == gradientUnits_userSpaceOnUse) {
vec2 vectorBase = m_pos2 - m_pos1;
@ -205,7 +205,7 @@ static std::pair<vec2,vec2> intersectLineToCircle(const vec2& _pos1,
return std::pair<vec2,vec2>(midpt + v1, midpt - v1);
}
etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorRadial(const ivec2& _pos) {
etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorRadial(const ivec2& _pos) const {
float ratio = 0.0f;
// in the basic vertion of the gradient the color is calculated with the ration in X and Y in the bonding box associated (it is rotate with the object)..
vec2 intersecX = getIntersect(m_pos1, m_axeX,
@ -308,13 +308,13 @@ void esvg::render::DynamicColorSpecial::generate(esvg::Document* _document) {
ESVG_ERROR("Get nullptr input for document");
return;
}
std::shared_ptr<esvg::Base> base = _document->getReference(m_colorName);
ememory::SharedPtr<esvg::Base> base = _document->getReference(m_colorName);
if (base == nullptr) {
ESVG_ERROR("Can not get base : '" << m_colorName << "'");
return;
}
// Now we can know if we use linear or radial gradient ...
std::shared_ptr<esvg::LinearGradient> gradient = std::dynamic_pointer_cast<esvg::LinearGradient>(base);
ememory::SharedPtr<esvg::LinearGradient> gradient = ememory::dynamicPointerCast<esvg::LinearGradient>(base);
if (gradient != nullptr) {
m_linear = true;
ESVG_VERBOSE("get for color linear:");
@ -362,7 +362,7 @@ void esvg::render::DynamicColorSpecial::generate(esvg::Document* _document) {
m_data = gradient->getColors(_document);
} else {
m_linear = false;
std::shared_ptr<esvg::RadialGradient> gradient = std::dynamic_pointer_cast<esvg::RadialGradient>(base);
ememory::SharedPtr<esvg::RadialGradient> gradient = ememory::dynamicPointerCast<esvg::RadialGradient>(base);
if (gradient == nullptr) {
ESVG_ERROR("Can not cast in a linear gradient: '" << m_colorName << "' ==> wrong type");
return;
@ -441,14 +441,14 @@ void esvg::render::DynamicColorSpecial::generate(esvg::Document* _document) {
}
}
std::shared_ptr<esvg::render::DynamicColor> esvg::render::createColor(std::pair<etk::Color<float,4>, std::string> _color, const mat2& _mtx) {
ememory::SharedPtr<esvg::render::DynamicColor> esvg::render::createColor(std::pair<etk::Color<float,4>, std::string> _color, const mat2& _mtx) {
// Check if need to create a color:
if ( _color.first.a() == 0x00
&& _color.second == "") {
return nullptr;
}
if (_color.second != "") {
return std::make_shared<esvg::render::DynamicColorSpecial>(_color.second, _mtx);
return ememory::makeShared<esvg::render::DynamicColorSpecial>(_color.second, _mtx);
}
return std::make_shared<esvg::render::DynamicColorUni>(_color.first);
return ememory::makeShared<esvg::render::DynamicColorUni>(_color.first);
}

View File

@ -7,7 +7,7 @@
*/
#pragma once
#include <memory>
#include <ememory/memory.h>
#include <etk/types.h>
#include <etk/Color.h>
#include <etk/math/Vector2D.h>
@ -24,7 +24,7 @@ namespace esvg {
// nothing to do ...
}
virtual ~DynamicColor() {};
virtual etk::Color<float,4> getColor(const ivec2& _pos) = 0;
virtual etk::Color<float,4> getColor(const ivec2& _pos) const = 0;
virtual void generate(esvg::Document* _document) = 0;
virtual void setViewPort(const std::pair<vec2, vec2>& _viewPort) = 0;
};
@ -36,7 +36,7 @@ namespace esvg {
m_color(_color) {
}
virtual etk::Color<float,4> getColor(const ivec2& _pos) {
virtual etk::Color<float,4> getColor(const ivec2& _pos) const {
return m_color;
}
virtual void generate(esvg::Document* _document) {
@ -66,16 +66,16 @@ namespace esvg {
std::vector<std::pair<float, etk::Color<float,4>>> m_data;
public:
DynamicColorSpecial(const std::string& _link, const mat2& _mtx);
virtual etk::Color<float,4> getColor(const ivec2& _pos);
virtual etk::Color<float,4> getColor(const ivec2& _pos) const;
private:
etk::Color<float,4> getColorLinear(const ivec2& _pos);
etk::Color<float,4> getColorRadial(const ivec2& _pos);
etk::Color<float,4> getColorLinear(const ivec2& _pos) const;
etk::Color<float,4> getColorRadial(const ivec2& _pos) const;
public:
virtual void generate(esvg::Document* _document);
virtual void setViewPort(const std::pair<vec2, vec2>& _viewPort);
};
std::shared_ptr<DynamicColor> createColor(std::pair<etk::Color<float,4>, std::string> _color, const mat2& _mtx);
ememory::SharedPtr<DynamicColor> createColor(std::pair<etk::Color<float,4>, std::string> _color, const mat2& _mtx);
}
}

View File

@ -14,43 +14,43 @@ void esvg::render::Path::clear() {
}
void esvg::render::Path::stop() {
m_listElement.push_back(std::make_shared<esvg::render::ElementStop>());
m_listElement.push_back(ememory::makeShared<esvg::render::ElementStop>());
}
void esvg::render::Path::close(bool _relative) {
m_listElement.push_back(std::make_shared<esvg::render::ElementClose>(_relative));
m_listElement.push_back(ememory::makeShared<esvg::render::ElementClose>(_relative));
}
void esvg::render::Path::moveTo(bool _relative, const vec2& _pos) {
m_listElement.push_back(std::make_shared<esvg::render::ElementMoveTo>(_relative, _pos));
m_listElement.push_back(ememory::makeShared<esvg::render::ElementMoveTo>(_relative, _pos));
}
void esvg::render::Path::lineTo(bool _relative, const vec2& _pos) {
m_listElement.push_back(std::make_shared<esvg::render::ElementLineTo>(_relative, _pos));
m_listElement.push_back(ememory::makeShared<esvg::render::ElementLineTo>(_relative, _pos));
}
void esvg::render::Path::lineToH(bool _relative, float _posX) {
m_listElement.push_back(std::make_shared<esvg::render::ElementLineToH>(_relative, _posX));
m_listElement.push_back(ememory::makeShared<esvg::render::ElementLineToH>(_relative, _posX));
}
void esvg::render::Path::lineToV(bool _relative, float _posY) {
m_listElement.push_back(std::make_shared<esvg::render::ElementLineToV>(_relative, _posY));
m_listElement.push_back(ememory::makeShared<esvg::render::ElementLineToV>(_relative, _posY));
}
void esvg::render::Path::curveTo(bool _relative, const vec2& _pos1, const vec2& _pos2, const vec2& _pos) {
m_listElement.push_back(std::make_shared<esvg::render::ElementCurveTo>(_relative, _pos1, _pos2, _pos));
m_listElement.push_back(ememory::makeShared<esvg::render::ElementCurveTo>(_relative, _pos1, _pos2, _pos));
}
void esvg::render::Path::smoothCurveTo(bool _relative, const vec2& _pos2, const vec2& _pos) {
m_listElement.push_back(std::make_shared<esvg::render::ElementSmoothCurveTo>(_relative, _pos2, _pos));
m_listElement.push_back(ememory::makeShared<esvg::render::ElementSmoothCurveTo>(_relative, _pos2, _pos));
}
void esvg::render::Path::bezierCurveTo(bool _relative, const vec2& _pos1, const vec2& _pos) {
m_listElement.push_back(std::make_shared<esvg::render::ElementBezierCurveTo>(_relative, _pos1, _pos));
m_listElement.push_back(ememory::makeShared<esvg::render::ElementBezierCurveTo>(_relative, _pos1, _pos));
}
void esvg::render::Path::bezierSmoothCurveTo(bool _relative, const vec2& _pos) {
m_listElement.push_back(std::make_shared<esvg::render::ElementBezierSmoothCurveTo>(_relative, _pos));
m_listElement.push_back(ememory::makeShared<esvg::render::ElementBezierSmoothCurveTo>(_relative, _pos));
}
void esvg::render::Path::ellipticTo(bool _relative,
@ -59,7 +59,7 @@ void esvg::render::Path::ellipticTo(bool _relative,
bool _largeArcFlag,
bool _sweepFlag,
const vec2& _pos) {
m_listElement.push_back(std::make_shared<esvg::render::ElementElliptic>(_relative, _radius, _angle, _largeArcFlag, _sweepFlag, _pos));
m_listElement.push_back(ememory::makeShared<esvg::render::ElementElliptic>(_relative, _radius, _angle, _largeArcFlag, _sweepFlag, _pos));
}
static const char* spacingDist(int32_t _spacing) {
@ -339,7 +339,7 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
}
{
std::shared_ptr<esvg::render::ElementElliptic> tmpIt(std::dynamic_pointer_cast<esvg::render::ElementElliptic>(it));
ememory::SharedPtr<esvg::render::ElementElliptic> tmpIt(ememory::dynamicPointerCast<esvg::render::ElementElliptic>(it));
float angle = tmpIt->m_angle * (M_PI / 180.0);
ESVG_TODO(spacingDist(_level+1) << " Elliptic arc: radius=" << tmpIt->getPos1());
ESVG_TODO(spacingDist(_level+1) << " angle=" << tmpIt->m_angle);

View File

@ -11,7 +11,7 @@
#include <etk/math/Vector2D.h>
#include <esvg/render/Element.h>
#include <esvg/render/PointList.h>
#include <memory>
#include <ememory/memory.h>
#ifdef DEBUG
#include <esvg/render/SegmentList.h>
#endif
@ -20,7 +20,7 @@ namespace esvg {
namespace render {
class Path {
public:
std::vector<std::shared_ptr<esvg::render::Element>> m_listElement;
std::vector<ememory::SharedPtr<esvg::render::Element>> m_listElement;
#ifdef DEBUG
esvg::render::SegmentList m_debugInformation;
#endif