Esempio n. 1
0
// Renders any debug elements in the debug context.
void Plugin::Render()
{
	// Render the outlines of the debug context's elements.
	if (render_outlines &&
		debug_context != NULL)
	{
		for (int i = 0; i < debug_context->GetNumDocuments(); ++i)
		{
			Core::ElementDocument* document = debug_context->GetDocument(i);
			if (document->GetId().Find("rkt-debug-") == 0)
				continue;

			std::stack< Core::Element* > element_stack;
			element_stack.push(document);

			while (!element_stack.empty())
			{
				Core::Element* element = element_stack.top();
				element_stack.pop();
				if (element->IsVisible())
				{
					for (int j = 0; j < element->GetNumBoxes(); ++j)
					{
						const Core::Box& box = element->GetBox(j);
						Geometry::RenderOutline(element->GetAbsoluteOffset(Core::Box::BORDER) + box.GetPosition(Core::Box::BORDER), box.GetSize(Core::Box::BORDER), Core::Colourb(255, 0, 0, 128), 1);
					}

					for (int j = 0; j < element->GetNumChildren(); ++j)
						element_stack.push(element->GetChild(j));
				}
			}
		}
	}

	// Render the info element's boxes.
	if (info_element != NULL &&
		info_element->IsVisible())
	{
		info_element->RenderHoverElement();
		info_element->RenderSourceElement();
	}
}