\r
#include <boost/foreach.hpp>\r
\r
+#include <tbb/parallel_for_each.h>\r
+\r
#include <map>\r
#include <set>\r
\r
\r
struct stage::implementation : boost::noncopyable\r
{ \r
- std::map<int, layer> layers_; \r
+ std::map<int, layer> layers_; \r
video_channel_context& channel_;\r
public:\r
implementation(video_channel_context& video_channel) \r
\r
try\r
{\r
- BOOST_FOREACH(auto& layer, layers_)\r
+ // Allocate placeholders.\r
+ BOOST_FOREACH(auto layer, layers_)\r
+ frames[layer.first] = basic_frame::empty();\r
+\r
+ // Render layers\r
+ tbb::parallel_for_each(layers_.begin(), layers_.end(), [&](std::map<int, layer>::value_type& layer)\r
+ {\r
frames[layer.first] = layer.second.receive();\r
+ });\r
}\r
catch(...)\r
{\r