}
}
-public:
RenderTaskScheduler()
{
for (unsigned n = 0; n != _count; ++n) {
}
}
+public:
+ static RenderTaskScheduler& instance()
+ {
+ static RenderTaskScheduler singleton;
+ return singleton;
+ }
+
~RenderTaskScheduler()
{
for (auto &e : _q) e.done();
return async(std::move(task));
}
};
-static RenderTaskScheduler render_scheduler;
/**
* \breif Brief abput the Api.
std::future<Surface> Animation::render(size_t frameNo, Surface surface)
{
- return render_scheduler.render(d.get(), frameNo, std::move(surface));
+ return RenderTaskScheduler::instance().render(d.get(), frameNo, std::move(surface));
}
void Animation::renderSync(size_t frameNo, Surface surface)
SW_FT_Stroker_Done(stroker);
}
-public:
RleTaskScheduler()
{
for (unsigned n = 0; n != _count; ++n) {
_threads.emplace_back([&, n] { run(n); });
}
}
+public:
+ static RleTaskScheduler& instance()
+ {
+ static RleTaskScheduler singleton;
+ return singleton;
+ }
~RleTaskScheduler()
{
}
};
-static RleTaskScheduler raster_scheduler;
-
void VRaster::generateFillInfo(RleShare &promise, VPath &&path, VRle &&rle,
FillRule fillRule, const VRect &clip)
{
promise->set_value(VRle());
return;
}
- return raster_scheduler.fillRle(promise, std::move(path), std::move(rle), fillRule, clip);
+ return RleTaskScheduler::instance().fillRle(promise, std::move(path), std::move(rle), fillRule, clip);
}
void VRaster::generateStrokeInfo(RleShare &promise, VPath &&path, VRle &&rle, CapStyle cap,
promise->set_value(VRle());
return;
}
- return raster_scheduler.strokeRle(promise, std::move(path), std::move(rle), cap, join, width, meterLimit, clip);
+ return RleTaskScheduler::instance().strokeRle(promise, std::move(path), std::move(rle), cap, join, width, meterLimit, clip);
}
V_END_NAMESPACE