common shape: fix reset() bug. (#99)

Previous reset() doesn't implemented properly.
It resets only path data.

Now Shape resets all drawing properties.
This commit is contained in:
Hermet Park 2020-10-08 16:37:39 +09:00 committed by GitHub
parent 24a0a2554d
commit db367d0c14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 3 deletions

View file

@ -51,9 +51,7 @@ unique_ptr<Shape> Shape::gen() noexcept
Result Shape::reset() noexcept Result Shape::reset() noexcept
{ {
pImpl->path->reset(); pImpl->reset();
pImpl->flag |= RenderUpdateFlag::Path;
return Result::Success; return Result::Success;
} }

View file

@ -305,6 +305,24 @@ struct Shape::Impl
return true; return true;
} }
void reset()
{
path->reset();
if (fill) {
delete(fill);
fill = nullptr;
}
if (stroke) {
delete(stroke);
stroke = nullptr;
}
color[0] = color[1] = color[2] = color[3] = 0;
flag = RenderUpdateFlag::All;
}
Paint* duplicate() Paint* duplicate()
{ {
auto ret = Shape::gen(); auto ret = Shape::gen();