mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
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:
parent
24a0a2554d
commit
db367d0c14
2 changed files with 19 additions and 3 deletions
|
@ -51,9 +51,7 @@ unique_ptr<Shape> Shape::gen() noexcept
|
|||
|
||||
Result Shape::reset() noexcept
|
||||
{
|
||||
pImpl->path->reset();
|
||||
|
||||
pImpl->flag |= RenderUpdateFlag::Path;
|
||||
pImpl->reset();
|
||||
|
||||
return Result::Success;
|
||||
}
|
||||
|
|
|
@ -305,6 +305,24 @@ struct Shape::Impl
|
|||
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()
|
||||
{
|
||||
auto ret = Shape::gen();
|
||||
|
|
Loading…
Add table
Reference in a new issue