renderer: minor optimization.

reduce the binary size.
This commit is contained in:
Hermet Park 2023-12-19 11:37:01 +09:00
parent c8833e970d
commit 2efdae710d
3 changed files with 13 additions and 12 deletions

View file

@ -196,13 +196,15 @@ struct Picture::Impl
{
load();
auto ret = Picture::gen();
auto ret = Picture::gen().release();
auto dup = ret->pImpl;
auto dup = ret.get()->pImpl;
if (paint) dup->paint = paint->duplicate();
dup->loader = loader;
++dup->loader->sharing;
if (loader) {
dup->loader = loader;
++dup->loader->sharing;
}
if (surface) {
dup->surface = new Surface;
@ -219,7 +221,7 @@ struct Picture::Impl
memcpy(dup->rm.triangles, rm.triangles, sizeof(Polygon) * rm.triangleCnt);
}
return ret.release();
return ret;
}
Iterator* iterator()

View file

@ -212,9 +212,8 @@ struct Scene::Impl
Paint* duplicate()
{
auto ret = Scene::gen();
auto dup = ret.get()->pImpl;
auto ret = Scene::gen().release();
auto dup = ret->pImpl;
for (auto paint : paints) {
auto cdup = paint->duplicate();
@ -222,7 +221,7 @@ struct Scene::Impl
dup->paints.push_back(cdup);
}
return ret.release();
return ret;
}
void clear(bool free)

View file

@ -338,9 +338,9 @@ struct Shape::Impl
Paint* duplicate()
{
auto ret = Shape::gen();
auto ret = Shape::gen().release();
auto dup = ret->pImpl;
auto dup = ret.get()->pImpl;
dup->rs.rule = rs.rule;
//Color
@ -376,7 +376,7 @@ struct Shape::Impl
dup->flag |= RenderUpdateFlag::Gradient;
}
return ret.release();
return ret;
}
Iterator* iterator()