DrawableUbuntu::DrawableUbuntu()
: mAdded(false),
- mChanged(false)
+ mChanged(false),
+ mType(Drawable::Types::NONE)
#ifdef THORVG_SUPPORT
,
mTvgPaint(nullptr)
DrawableUbuntu::~DrawableUbuntu()
{
#ifdef THORVG_SUPPORT
- if(mTvgPaint && !mAdded)
+ if(mTvgPaint)
{
delete mTvgPaint;
}
#endif
}
-void DrawableUbuntu::SetDrawableAdded(bool added)
+Rect<float> DrawableUbuntu::GetBoundingBox() const
+{
+#ifdef THORVG_SUPPORT
+ if(!mTvgPaint)
+ {
+ DALI_LOG_ERROR("Drawable is null\n");
+ return Rect<float>(0, 0, 0, 0);
+ }
+
+ float x, y, width, height;
+ x = y = width = height = 0;
+
+ if(mTvgPaint->bounds(&x, &y, &width, &height) != tvg::Result::Success)
+ {
+ DALI_LOG_ERROR("Get bounds fail.\n");
+ return Rect<float>(0, 0, 0, 0);
+ }
+ return Rect<float>(x, y, width, height);
+#else
+ return Rect<float>(0, 0, 0, 0);
+#endif
+}
+
+void DrawableUbuntu::SetAdded(bool added)
{
mAdded = !!added;
}
+bool DrawableUbuntu::IsAdded() const
+{
+ return mAdded;
+}
+
void* DrawableUbuntu::GetObject() const
{
#ifdef THORVG_SUPPORT
{
mTvgPaint = static_cast<tvg::Paint*>((void*)object);
}
- else
- {
- if(mAdded)
- {
- mTvgPaint = nullptr;
- }
- if(mTvgPaint)
- {
- delete mTvgPaint;
- }
- }
#endif
}
{
return mChanged;
}
+
+void DrawableUbuntu::SetType(Drawable::Types type)
+{
+ mType = type;
+}
+
+Drawable::Types DrawableUbuntu::GetType() const
+{
+ return mType;
+}
} // namespace Adaptor
} // namespace Internal