removed unique_ptr in the interface because it's hard to get polymorphism benefits in programming perspective.
Change-Id: I1c1fc0a0b5047f365efb17ece3645291a4719224
uint32_t colorStops(const ColorStop** colorStops) const noexcept;
FillSpread spread() const noexcept;
- std::unique_ptr<Fill> duplicate() const noexcept;
+ Fill* duplicate() const noexcept;
_TVG_DECALRE_IDENTIFIER();
_TVG_DECLARE_PRIVATE(Fill);
}
-unique_ptr<Fill> Fill::duplicate() const noexcept
+Fill* Fill::duplicate() const noexcept
{
return pImpl->duplicate();
}
struct DuplicateMethod
{
virtual ~DuplicateMethod(){}
- virtual unique_ptr<T> duplicate() = 0;
+ virtual T* duplicate() = 0;
};
template<class T>
FillDup(T* _inst) : inst(_inst) {}
~FillDup(){}
- unique_ptr<Fill> duplicate() override
+ Fill* duplicate() override
{
return inst->duplicate();
}
this->dup = dup;
}
- unique_ptr<Fill> duplicate()
+ Fill* duplicate()
{
auto ret = dup->duplicate();
if (!ret) return nullptr;
float x2 = 0;
float y2 = 0;
- unique_ptr<Fill> duplicate()
+ Fill* duplicate()
{
auto ret = LinearGradient::gen();
if (!ret) return nullptr;
ret->pImpl->x2 = x2;
ret->pImpl->y2 = y2;
- return ret;
+ return ret.release();
}
};
virtual bool update(RenderMethod& renderer, const RenderTransform* transform, RenderUpdateFlag pFlag) = 0;
virtual bool render(RenderMethod& renderer) = 0;
virtual bool bounds(float* x, float* y, float* w, float* h) const = 0;
- virtual unique_ptr<Paint> duplicate() = 0;
+ virtual Paint* duplicate() = 0;
};
struct Paint::Impl
Paint* duplicate()
{
- return smethod->duplicate().release();
+ return smethod->duplicate();
}
};
return inst->render(renderer);
}
- unique_ptr<Paint> duplicate() override
+ Paint* duplicate() override
{
return inst->duplicate();
}
return Result::Success;
}
- unique_ptr<Paint> duplicate()
+ Paint* duplicate()
{
//TODO:
return nullptr;
float cy = 0;
float radius = 0;
- unique_ptr<Fill> duplicate()
+ Fill* duplicate()
{
auto ret = RadialGradient::gen();
if (!ret) return nullptr;
ret->pImpl->cy = cy;
ret->pImpl->radius = radius;
- return ret;
+ return ret.release();
}
};
return true;
}
- unique_ptr<Paint> duplicate()
+ Paint* duplicate()
{
//TODO:
return nullptr;
return true;
}
- unique_ptr<Paint> duplicate()
+ Paint* duplicate()
{
auto ret = Shape::gen();
if (!ret) return nullptr;
}
if (fill) {
- dup->fill = fill->duplicate().release();
+ dup->fill = fill->duplicate();
dup->flag |= RenderUpdateFlag::Gradient;
}
- return ret;
+ return ret.release();
}
};