mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-09 14:13:43 +00:00
common picture: +exception handling.
invalid arguments won't be allowed.
This commit is contained in:
parent
d78744bae3
commit
7c269a9f20
2 changed files with 6 additions and 4 deletions
|
@ -123,8 +123,11 @@ const uint32_t* Picture::data(uint32_t* w, uint32_t* h) const noexcept
|
||||||
|
|
||||||
Result Picture::mesh(const Polygon* triangles, const uint32_t triangleCnt) noexcept
|
Result Picture::mesh(const Polygon* triangles, const uint32_t triangleCnt) noexcept
|
||||||
{
|
{
|
||||||
if (pImpl->mesh(triangles, triangleCnt)) return Result::Success;
|
if (!triangles && triangleCnt > 0) return Result::InvalidArguments;
|
||||||
return Result::Unknown;
|
if (triangles && triangleCnt == 0) return Result::InvalidArguments;
|
||||||
|
|
||||||
|
pImpl->mesh(triangles, triangleCnt);
|
||||||
|
return Result::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,7 @@ struct Picture::Impl
|
||||||
return Result::Success;
|
return Result::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mesh(const Polygon* triangles, const uint32_t triangleCnt)
|
void mesh(const Polygon* triangles, const uint32_t triangleCnt)
|
||||||
{
|
{
|
||||||
if (triangles && triangleCnt > 0) {
|
if (triangles && triangleCnt > 0) {
|
||||||
this->triangleCnt = triangleCnt;
|
this->triangleCnt = triangleCnt;
|
||||||
|
@ -263,7 +263,6 @@ struct Picture::Impl
|
||||||
this->triangles = nullptr;
|
this->triangles = nullptr;
|
||||||
this->triangleCnt = 0;
|
this->triangleCnt = 0;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Paint* duplicate()
|
Paint* duplicate()
|
||||||
|
|
Loading…
Add table
Reference in a new issue