Example #1
0
Display *Display::getDisplay(EGLNativeDisplayType displayId, const AttributeMap &attribMap)
{
    // Initialize the global platform if not already
    InitDefaultPlatformImpl();

    Display *display = NULL;

    DisplayMap *displays = GetDisplayMap();
    DisplayMap::const_iterator iter = displays->find(displayId);
    if (iter != displays->end())
    {
        display = iter->second;
    }

    if (display == nullptr)
    {
        // Validate the native display
        if (!Display::isValidNativeDisplay(displayId))
        {
            return NULL;
        }

        display = new Display(displayId);
        displays->insert(std::make_pair(displayId, display));
    }

    // Apply new attributes if the display is not initialized yet.
    if (!display->isInitialized())
    {
        rx::DisplayImpl* impl = CreateDisplayImpl(attribMap);
        display->setAttributes(impl, attribMap);
    }

    return display;
}
Example #2
0
Display::~Display()
{
    terminate();

    DisplayMap *displays = GetDisplayMap();
    DisplayMap::iterator iter = displays->find(mDisplayId);
    if (iter != displays->end())
    {
        displays->erase(iter);
    }
}
Example #3
0
bool Display::isValidDisplay(const egl::Display *display)
{
    const DisplayMap *displayMap = GetDisplayMap();
    for (const auto &displayPair : *displayMap)
    {
        if (displayPair.second == display)
        {
            return true;
        }
    }

    return false;
}
Example #4
0
Display::~Display()
{
    terminate();

    DisplayMap *displays = GetDisplayMap();
    DisplayMap::iterator iter = displays->find(mDisplayId);
    if (iter != displays->end())
    {
        displays->erase(iter);
    }

    SafeDelete(mDevice);
    SafeDelete(mImplementation);
}
Example #5
0
egl::Display *Display::getDisplay(EGLNativeDisplayType displayId, EGLint displayType)
{
    DisplayMap *displays = GetDisplayMap();
    DisplayMap::const_iterator iter = displays->find(displayId);
    if (iter != displays->end())
    {
        return iter->second;
    }
    
    // FIXME: Check if displayId is a valid display device context

    egl::Display *display = new egl::Display(displayId, displayType);
    displays->insert(std::make_pair(displayId, display));

    return display;
}
Example #6
0
ALERROR CSystemMap::AddFixedTopology (CTopology &Topology, CString *retsError)

//	AddFixedTopology
//
//	Adds all the nodes in its fixed topology

	{
	ALERROR error;
	int i;

	//	If we already added this map, then we're done

	if (m_bAdded)
		return NOERROR;

	//	Mark this map as added so we don't recurse back here when we
	//	process all the Uses statments.

	m_bAdded = true;

	//	Load all the maps that this map requires

	for (i = 0; i < m_Uses.GetCount(); i++)
		{
		if (error = m_Uses[i]->AddFixedTopology(Topology, retsError))
			return error;
		}

	//	Iterate over all creators and execute them

	CTopologyNodeList NodesAdded;
	STopologyCreateCtx Ctx;
	Ctx.pMap = GetDisplayMap();
	Ctx.pNodesAdded = &NodesAdded;

	//	We need to include any maps that we use.

	Ctx.Tables.Insert(&m_FixedTopology);
	for (i = 0; i < m_Uses.GetCount(); i++)
		Ctx.Tables.Insert(&m_Uses[i]->m_FixedTopology);

	for (i = 0; i < m_Creators.GetCount(); i++)
		{
		if (error = ExecuteCreator(Ctx, Topology, m_Creators[i]))
			{
			*retsError = strPatternSubst(CONSTLIT("SystemMap (%x): %s"), GetUNID(), Ctx.sError);
			return error;
			}
		}

	//	Add any additional nodes marked as "root" (this is here only for backwards compatibility)
	//	NOTE: This call only worries about the first table (Ctx.Tables[0])

	if (error = Topology.AddTopology(Ctx))
		{
		*retsError = strPatternSubst(CONSTLIT("SystemMap (%x): %s"), GetUNID(), Ctx.sError);
		return error;
		}

	//	Apply any topology processors (in order) on all the newly added nodes

	for (i = 0; i < m_Processors.GetCount(); i++)
		{
		//	Make a copy of the node list because each call will destroy it

		CTopologyNodeList NodeList = NodesAdded;

		//	Process

		if (error = m_Processors[i]->Process(this, Topology, NodeList, retsError))
			{
			*retsError = strPatternSubst(CONSTLIT("SystemMap (%x): %s"), GetUNID(), *retsError);
			return error;
			}
		}

	//	Make sure every node added has a system UNID

	for (i = 0; i < NodesAdded.GetCount(); i++)
		if (NodesAdded[i]->GetSystemDescUNID() == 0)
			{
			*retsError = strPatternSubst(CONSTLIT("SystemMap (%x): NodeID %s: No system specified"), GetUNID(), NodesAdded[i]->GetID());
			return ERR_FAIL;
			}

	return NOERROR;
	}