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(); 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(); if (paint) dup->paint = paint->duplicate();
dup->loader = loader; if (loader) {
++dup->loader->sharing; dup->loader = loader;
++dup->loader->sharing;
}
if (surface) { if (surface) {
dup->surface = new Surface; dup->surface = new Surface;
@ -219,7 +221,7 @@ struct Picture::Impl
memcpy(dup->rm.triangles, rm.triangles, sizeof(Polygon) * rm.triangleCnt); memcpy(dup->rm.triangles, rm.triangles, sizeof(Polygon) * rm.triangleCnt);
} }
return ret.release(); return ret;
} }
Iterator* iterator() Iterator* iterator()

View file

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

View file

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