Пример #1
0
void CHTMLSectionCreator::AddDocument( CHTMLDocument *pDocument )
{
	m_cCharSet = pDocument->m_cCharSet;

	m_nLineWidth = GetCurrentWidth();

	//	Pointers used to process the anchor information
	CHTMLAnchor* pLastAnchor = NULL;
	const UINT uDocumentSize = pDocument->m_arrItems.GetSize();
	for( UINT n = 0; n < uDocumentSize; n++ )
	{
		CHTMLDocumentObject *pItem = pDocument->m_arrItems[ n ];
		switch( pItem->GetType() )
		{
		case CHTMLDocumentObject::knParagraph:
			{
				CHTMLParagraph *pPara = static_cast<CHTMLParagraph *>( pItem );
				if( pPara->IsEmpty() )
					continue;

				pPara->AddDisplayElements( this );

				NewParagraph( pPara->m_nSpaceAbove, pPara->m_nSpaceBelow, pPara->m_alg );

				const UINT uParagraphSize = pPara->m_arrItems.GetSize();
				for( UINT nItem = 0; nItem < uParagraphSize; nItem++ )
				{
					CHTMLParagraphObject *pParaObj = pPara->m_arrItems[ nItem ];

					// Update the Anchor status
					if (pParaObj->m_pAnchor == NULL || pParaObj->m_pAnchor != pLastAnchor)
						m_pCurrentLink = NULL;
		

					switch( pParaObj->GetType() )
					{
					case CHTMLParagraphObject::knAnchor:
						{
							pParaObj->AddDisplayElements( this );	

							CHTMLAnchor *pAnchor = static_cast<CHTMLAnchor *>( pParaObj );
							pLastAnchor = pAnchor;
						}
						break;

					default:
						pParaObj->AddDisplayElements( this );	
					}
				}
			}
			break;
		}
	}
	Finished();
}
Пример #2
0
void nuiGLPainter::SetViewport()
{
  //GetAngle(), GetCurrentWidth(), GetCurrentHeight(), mProjectionViewportStack.top(), mProjectionMatrixStack.top());
  GLuint Angle = GetAngle();
  GLuint Width = GetCurrentWidth();
  GLuint Height = GetCurrentHeight();
  const nuiRect& rViewport(mProjectionViewportStack.top());
  const nuiMatrix& rMatrix = mProjectionMatrixStack.top();
  
  uint32 x, y, w, h;
  
  nuiRect r(rViewport);
  if (Angle == 90 || Angle == 270)
  {
    uint32 tmp = Width;
    Width = Height;
    Height = tmp;
    r.Set(r.Top(), r.Left(), r.GetHeight(), r.GetWidth());
  }
  
  
  x = ToBelow(r.Left());
  w = ToBelow(r.GetWidth());
  y = Height - ToBelow(r.Bottom());
  h = ToBelow(r.GetHeight());
  
  //printf("set projection matrix (%d %d - %d %d)\n", x, y, w, h);
  glViewport(x * NUI_SCALE_FACTOR, y * NUI_SCALE_FACTOR, w * NUI_SCALE_FACTOR, h * NUI_SCALE_FACTOR);
  nuiCheckForGLErrors();
  
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  //glScalef(NUI_SCALE_FACTOR, NUI_SCALE_FACTOR, 1.0f);
  if (Angle != 0.0f)
  {
    glRotatef(Angle, 0.f,0.f,1.f);
    glMultMatrixf(rMatrix.Array);
  }
  else
  {
    glLoadMatrixf(rMatrix.Array);
  }
  
  nuiCheckForGLErrors();
  
  glMatrixMode (GL_MODELVIEW);
  nuiCheckForGLErrors();
}