Result reserve(uint32_t n) noexcept;
virtual Result push(std::unique_ptr<Paint> paint) noexcept;
- virtual Result clear() noexcept;
+ virtual Result clear(bool free = true) noexcept;
virtual Result update(Paint* paint) noexcept;
virtual Result draw() noexcept;
virtual Result sync() noexcept;
~Impl()
{
- clear();
+ clear(true);
delete(renderer);
}
return update(p);
}
- Result clear()
+ Result clear(bool free)
{
if (!renderer) return Result::InsufficientCondition;
//Clear render target before drawing
if (!renderer->clear()) return Result::InsufficientCondition;
- for (auto paint : paints) {
- paint->pImpl->dispose(*renderer);
- delete(paint);
+ //free paints
+ if (free) {
+ for (auto paint : paints) {
+ paint->pImpl->dispose(*renderer);
+ delete(paint);
+ }
}
paints.clear();
//Update single paint node
if (paint) {
paint->pImpl->update(*renderer, nullptr, compList, RenderUpdateFlag::None);
- //Update retained all paint nodes
+ //Update all retained paint nodes
} else {
for (auto paint: paints) {
paint->pImpl->update(*renderer, nullptr, compList, RenderUpdateFlag::None);
bool dispose(RenderMethod& renderer)
{
- if (this->compTarget) this->compTarget->pImpl->dispose(renderer);
+ if (compTarget) compTarget->pImpl->dispose(renderer);
return smethod->dispose(renderer);
}