mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
common scene: code refactoring.
keep it clean and less LOC.
This commit is contained in:
parent
b791924983
commit
39bf94e506
2 changed files with 6 additions and 12 deletions
|
@ -67,4 +67,4 @@ Result Scene::clear(bool free) noexcept
|
|||
pImpl->clear(free);
|
||||
|
||||
return Result::Success;
|
||||
}
|
||||
}
|
|
@ -172,19 +172,13 @@ struct Scene::Impl
|
|||
|
||||
void clear(bool free)
|
||||
{
|
||||
//Clear render target before drawing
|
||||
if (renderer && renderer->clear()) {
|
||||
for (auto paint = paints.data; paint < (paints.data + paints.count); ++paint) {
|
||||
(*paint)->pImpl->dispose(*renderer);
|
||||
}
|
||||
auto dispose = renderer ? true : false;
|
||||
|
||||
for (auto paint = paints.data; paint < (paints.data + paints.count); ++paint) {
|
||||
if (dispose) (*paint)->pImpl->dispose(*renderer);
|
||||
if (free) delete(*paint);
|
||||
renderer = nullptr;
|
||||
}
|
||||
//free paints
|
||||
if (free) {
|
||||
for (auto paint = paints.data; paint < (paints.data + paints.count); ++paint) {
|
||||
delete(*paint);
|
||||
}
|
||||
}
|
||||
paints.clear();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue