mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43: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
|
||||
{
|
||||
if (pImpl->mesh(triangles, triangleCnt)) return Result::Success;
|
||||
return Result::Unknown;
|
||||
if (!triangles && triangleCnt > 0) return Result::InvalidArguments;
|
||||
if (triangles && triangleCnt == 0) return Result::InvalidArguments;
|
||||
|
||||
pImpl->mesh(triangles, triangleCnt);
|
||||
return Result::Success;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ struct Picture::Impl
|
|||
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) {
|
||||
this->triangleCnt = triangleCnt;
|
||||
|
@ -263,7 +263,6 @@ struct Picture::Impl
|
|||
this->triangles = nullptr;
|
||||
this->triangleCnt = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Paint* duplicate()
|
||||
|
|
Loading…
Add table
Reference in a new issue