Exemplo n.º 1
0
			bool render(core_window_t * wd)
			{
				bool rendered = false;
				core_window_t * root_wd = wd->root_widget;
				if(root_wd->other.attribute.root->effects_edge_nimbus.size())
				{
					core_window_t * focused = root_wd->other.attribute.root->focus;
					native_window_type native = root_wd->root;
					std::size_t pixels = weight();

					nana::paint::graphics * graph = root_wd->root_graph;

					std::vector<core_window_t*> erase;
					std::vector<nana::rectangle>	r_set;
					nana::rectangle r;
					typename core_window_t::edge_nimbus_container & cont = root_wd->other.attribute.root->effects_edge_nimbus;
					for(typename core_window_t::edge_nimbus_container::iterator i = cont.begin(); i != cont.end(); ++i)
					{
						typename core_window_t::edge_nimbus_action & ena = *i;
						if(_m_edge_nimbus(focused, ena.window) && window_layer::read_visual_rectangle(ena.window, r))
						{
							if(ena.window == wd)
								rendered = true;

							r_set.push_back(r);
							ena.rendered = true;
						}
						else if(ena.rendered)
						{
							ena.rendered = false;
							erase.push_back(ena.window);
						}
					}

					//Erase
					for(typename std::vector<core_window_t*>::iterator i = erase.begin(); i != erase.end(); ++i)
					{
						core_window_t * el = *i;
						if(el == wd)
							rendered = true;

						r.x = el->pos_root.x - static_cast<int>(pixels);
						r.y = el->pos_root.y - static_cast<int>(pixels);
						r.width = static_cast<unsigned>(el->dimension.width + (pixels << 1));
						r.height = static_cast<unsigned>(el->dimension.height + (pixels << 1));
						graph->paste(native, r, r.x, r.y);
					}

					std::vector<nana::rectangle>::iterator visual_iterator = r_set.begin();
					//Render
					for(typename core_window_t::edge_nimbus_container::iterator i = cont.begin(); i != cont.end(); ++i)
					{
						if(i->rendered)
							_m_render_edge_nimbus(i->window, *(visual_iterator++));
					}
				}
				return rendered;
			}
Exemplo n.º 2
0
			void render(core_window_t * wd, bool forced, const rectangle* update_area = nullptr)
			{
				bool copy_separately = true;
				std::vector<std::pair<rectangle, core_window_t*>>	rd_set;

				if (wd->root_widget->other.attribute.root->effects_edge_nimbus.size())
				{
					auto root_wd = wd->root_widget;

					auto & nimbus = root_wd->other.attribute.root->effects_edge_nimbus;

					auto focused = root_wd->other.attribute.root->focus;

					const unsigned pixels = weight();

					auto graph = root_wd->root_graph;

					nana::rectangle r;
					for(auto & action : nimbus)
					{
						if(_m_edge_nimbus(focused, action.window) && window_layer::read_visual_rectangle(action.window, r))
						{
							if (action.window == wd)
							{
								if (update_area)
									::nana::overlap(*update_area, rectangle(r), r);
								copy_separately = false;
							}

							//Avoiding duplicated rendering. If the window is declared to lazy refresh, it should be rendered.
							if ((forced && (action.window == wd)) || (focused == action.window) || !action.rendered || (action.window->other.upd_state == core_window_t::update_state::refresh))
							{
								rd_set.emplace_back(r, action.window);
								action.rendered = true;
							}
						}
						else if(action.rendered)
						{
							action.rendered = false;

							if (action.window == wd)
								copy_separately = false;

							::nana::rectangle erase_r(
									action.window->pos_root.x - static_cast<int>(pixels),
									action.window->pos_root.y - static_cast<int>(pixels),
									static_cast<unsigned>(action.window->dimension.width + (pixels << 1)),
									static_cast<unsigned>(action.window->dimension.height + (pixels << 1))
								);

							graph->paste(root_wd->root, erase_r, erase_r.x, erase_r.y);
						}
					}
				}

				if (copy_separately)
				{
					rectangle vr;
					if (window_layer::read_visual_rectangle(wd, vr))
					{
						if (update_area)
							::nana::overlap(*update_area, rectangle(vr), vr);
						wd->root_graph->paste(wd->root, vr, vr.x, vr.y);
					}
				}

				//Render
				for (auto & rd : rd_set)
					_m_render_edge_nimbus(rd.second, rd.first);
			}