コード例 #1
0
ファイル: Renderer.cpp プロジェクト: juliendehos/librarium.so
	void Renderer::SetupUi(Ui* pUiPtr)
	{
		UnloadAssets();

		_uiPtr = pUiPtr;
		for (UiElement* elem : _uiPtr->GetElements())
		{
			ProcessElement(elem);
		}

		if(_menuPtr != nullptr)
			ProcessElement(_menuPtr);

		CheckGLError();
	}
コード例 #2
0
LayoutStatus CPDF_LayoutProvider_TaggedPDF::StartLoad(IFX_Pause* pPause)
{
    m_pPause = pPause;
    if(m_pPage->m_pDocument && m_pPage->m_pFormDict) {
        m_pPageTree = CPDF_StructTree::LoadPage(m_pPage->m_pDocument, m_pPage->m_pFormDict);
    }
    if(!m_pPageTree) {
        m_Status = LayoutError;
        return LayoutError;
    }
    int count = m_pPageTree->CountTopElements();
    if(count == 0) {
        m_Status = LayoutError;
        return LayoutError;
    }
    m_pRoot = FX_NEW CPDF_LayoutElement;
    if (!m_pRoot) {
        m_Status = LayoutError;
        return LayoutError;
    }
    for(int i = 0; i < count; i++) {
        CPDF_StructElement* pElement = m_pPageTree->GetTopElement(i);
        if(pElement) {
            ProcessElement(m_pRoot, pElement);
            if(m_Status != LayoutReady) {
                return m_Status;
            }
        }
    }
    m_pCurTaggedElement = NULL;
    m_Status = LayoutFinished;
    return LayoutFinished;
}
コード例 #3
0
ファイル: Renderer.cpp プロジェクト: juliendehos/librarium.so
	void Renderer::ProcessElement(UiElement* pElemPtr)
	{
		for (UiElement* elPtr : pElemPtr->GetChildren())
			ProcessElement(elPtr);

		for (UiResource rs : pElemPtr->GetResources())
		{
			switch (rs.Type)
			{
			case UiResourceType::Texture:
				if (_userTextures.find(rs.Id) == _userTextures.end())
					_userTextures[rs.Id] = new Texture(dynamic_cast<TextureData*>(rs.RsData)->Path);
				break;
			case UiResourceType::Text:
				LoadTextTexture(rs);
				break;
			case UiResourceType::UserShader:
				LoadShaderToyProgram(rs);
				break;
			default:
				break;
			}
		}

		if (pElemPtr->IsDynamic())
			_dynamicElements.push_back(pElemPtr);

		pElemPtr->UiElementLoaded(this);
	}
コード例 #4
0
void udCPPClassElementProcessor::ProcessElement(wxSFShapeBase *element)
{	
    // check existing parent generator
    wxASSERT(m_pParentGenerator);
    if(!m_pParentGenerator) return;
	
	wxASSERT(element);
	if(!element) return;
	
	udClassElementItem *pClass = (udClassElementItem*) udPROJECT::GetDiagramElement( element, udfOMIT_LINKS );
	if( !pClass || !pClass->IsGenerated() ) return;
	
	udClassAlgorithm *pAlg = (udClassAlgorithm*) m_pParentGenerator->GetActiveAlgorithm();
	
	// check whether the class is already processed
    if( pAlg->GetProcessedElements().IndexOf(element) != wxNOT_FOUND ) return;
	
	// process child classes recursivelly first
	ShapeList lstBases;
	umlClassDiagram::GetOuterClasses( (umlClassItem*)element, lstBases );

	for( ShapeList::iterator it = lstBases.begin(); it != lstBases.end(); ++it )
	{
		ProcessElement( *it );
	}

	switch( pAlg->GetGenMode() )
	{
		case udGenerator::genDECLARATION:
			ProcessClassDeclaration( element );
			break;
			
		case udGenerator::genDEFINITION:
			ProcessClassDefinition( element );
			break;
			
		default:
			break;
	}
	
	// process template bindings
	ShapeList lstConnections;
	element->GetShapeManager()->GetAssignedConnections( element, CLASSINFO(umlTemplateBindItem), wxSFShapeBase::lineSTARTING, lstConnections );
	
	for( ShapeList::iterator it = lstConnections.begin(); it != lstConnections.end(); ++it )
	{
		udElementProcessor *pProcessor = pAlg->GetElementProcessor((*it)->GetClassInfo()->GetClassName());
		if(pProcessor)
		{
			pProcessor->ProcessElement(*it);
		}
	}

    // set the state as processes
	pAlg->GetProcessedElements().Append(element);
}
コード例 #5
0
void CPDF_LayoutProvider_TaggedPDF::ProcessElement(CPDF_LayoutElement*pParent, CPDF_StructElement* pTaggedElement)
{
    if(!pTaggedElement) {
        return;
    }
    if(!pParent) {
        m_Status = LayoutError;
        return;
    }
    CPDF_LayoutElement* pElement = FX_NEW CPDF_LayoutElement;
    if (!pElement) {
        m_Status = LayoutError;
        return;
    }
    pElement->m_pParentElement = pParent;
    pElement->m_pTaggedElement = pTaggedElement;
    pParent->m_ChildArray.Add(pElement);
    int count = pTaggedElement->CountKids();
    for(int i = 0; i < count; i++) {
        CPDF_StructKid Kid = pTaggedElement->GetKid(i);
        switch(Kid.m_Type) {
            case CPDF_StructKid::Element: {
                    ProcessElement(pElement, Kid.m_Element.m_pElement);
                    if(m_Status != LayoutReady) {
                        return ;
                    }
                }
                break;
            case CPDF_StructKid::PageContent: {
                    int count = m_pPage->CountObjects();
                    FX_POSITION pos = m_pPage->GetFirstObjectPosition();
                    if(!pos) {
                        m_Status = LayoutError;
                        return ;
                    }
                    while (pos) {
                        CPDF_PageObject* pObj = m_pPage->GetNextObject(pos);
                        int pbjMCID = pObj->m_ContentMark.GetMCID();
                        if((FX_DWORD)(pObj->m_ContentMark.GetMCID()) == Kid.m_PageContent.m_ContentId) {
                            pElement->AddObject(pObj);
                        }
                    }
                }
                break;
            case CPDF_StructKid::StreamContent:
            case CPDF_StructKid::Object:
            default:
                break;
        }
    }
}
コード例 #6
0
	virtual RM_RETURN_CODE UseStagingMemory(char* pStagingSegmentMemory)
	{
		u_int uOriginalSegmentIndex = m_xStagingContext.GetCurrentWriteSegment();
		
		RM_SharedBuffer* pxSharedBuffer = m_xContext.GetDuplicateBuffer();
		if (!pxSharedBuffer) return RM_CUSTOM_ERR1;

		char* pOutputData = pxSharedBuffer->GetSegmentForWriting(uOriginalSegmentIndex);
		if (!pOutputData)
		{
			pxSharedBuffer->SetFinishedWriting(m_xStagingContext.GetWriteTag(), uOriginalSegmentIndex);
			return RM_CUSTOM_ERR2;
		}

		//transform elements
		for (u_int u = 0; u < SEGMENT_SIZE; ++u)
		{
			pOutputData[u] = ProcessElement(u, pStagingSegmentMemory);
		}
		printf(" Writing to segment %d [%c%c%c...] \n", uOriginalSegmentIndex, pOutputData[0], pOutputData[1], pOutputData[2]);

		pxSharedBuffer->SetFinishedWriting(m_xStagingContext.GetWriteTag(), uOriginalSegmentIndex);


		//send message to all processes that I've written to the duplicate buffer
		RM_WToRMessageData xMessage = { m_xStagingContext.GetWriteTag(), uOriginalSegmentIndex };
		RM_RETURN_CODE xResult = m_xContext.GetMessageManager()->SendMessage(-1, m_xContext.GetProcessIndex(), &xMessage);
		if (xResult != RM_SUCCESS)
		{
			//wait a little and try again for a few times (say 10 times, this param can be exposed)
			for (u_int u = 0; u < 10; ++u)
			{
				Sleep(5);
				xResult = m_xContext.GetMessageManager()->SendMessage(-1, m_xContext.GetProcessIndex(), &xMessage);
				if (xResult == RM_SUCCESS) break;
			}
			if (xResult != RM_SUCCESS)
			{
				printf("Failed to send message. The written data will never be read!");
				//TODO: could try looking for new readers, or we could increase buffer sizes - 
				//maybe the readers are too slow and fill up all the space?!
			}
		}

		return RM_SUCCESS;
	}
コード例 #7
0
LayoutStatus CPDF_LayoutProvider_TaggedPDF::Continue()
{
    if(!m_pCurTaggedElement) {
        return LayoutError;
    }
    if(m_Status != LayoutToBeContinued) {
        return LayoutError;
    }
    m_Status = LayoutReady;
    int count = m_pPageTree->CountTopElements();
    for(int i = 0; i < count; i++) {
        CPDF_StructElement* pElement = m_pPageTree->GetTopElement(i);
        if(pElement) {
            ProcessElement(m_pRoot, pElement);
            if(m_Status != LayoutReady) {
                return m_Status;
            }
        }
    }
    m_pCurTaggedElement = NULL;
    m_Status = LayoutFinished;
    return LayoutFinished;
}