Ejemplo n.º 1
0
void Base::DoRender( Gwen::Skin::Base* skin )
{
	// If this control has a different skin, 
	// then so does its children.
	if ( m_Skin ) 
		skin = m_Skin;

	// Do think
	Think();

	Gwen::Renderer::Base* render = skin->GetRender();

	if ( render->GetCTT() && ShouldCacheToTexture() )
	{
		DoCacheRender( skin, this );
		return;
	}

	Gwen::Point pOldRenderOffset = render->GetRenderOffset();

	render->AddRenderOffset( GetBounds() );

	RenderUnder( skin );
	
	Gwen::Rect rOldRegion = render->ClipRegion();
	render->AddClipRegion( GetBounds() );

	if ( render->ClipRegionVisible() )
	{
		render->StartClip();
		
		//Render myself first
 		Render( skin );

		if ( !Children.empty() )
		{
			//Now render my kids
			for (Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter)
			{
				Base* pChild = *iter;
				if ( pChild->Hidden() ) continue;

				pChild->DoRender( skin );
			}		
		}

		render->SetClipRegion( rOldRegion );
		render->StartClip();

		RenderOver( skin );
	}
	else
	{
		render->SetClipRegion( rOldRegion );
	}

	RenderFocus( skin );

	render->SetRenderOffset( pOldRenderOffset );
}
Ejemplo n.º 2
0
void Base::DoCacheRender( Gwen::Skin::Base* skin, Gwen::Controls::Base* pMaster )
{
	Gwen::Renderer::Base* render = skin->GetRender();
	Gwen::Renderer::ICacheToTexture* cache = render->GetCTT();

	if ( !cache ) return;

	Gwen::Point pOldRenderOffset = render->GetRenderOffset();

	Gwen::Rect rOldRegion = render->ClipRegion();
	
	if ( this != pMaster )
	{
		render->AddRenderOffset( GetBounds() );
		render->AddClipRegion( GetBounds() );
	}
	else
	{
		render->SetRenderOffset( Gwen::Point( 0, 0 ) );
		render->SetClipRegion( GetBounds() );
	}

	if ( m_bCacheTextureDirty && render->ClipRegionVisible() )
	{
		render->StartClip();

		if ( ShouldCacheToTexture() )
			cache->SetupCacheTexture( this );

		//Render myself first
		Render( skin );

		if ( !Children.empty() )
		{
			//Now render my kids
			for (Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter)
			{
				Base* pChild = *iter;
				if ( pChild->Hidden() ) continue;

				pChild->DoCacheRender( skin, pMaster );
			}		
		}

		if ( ShouldCacheToTexture() )
		{
			cache->FinishCacheTexture( this );
			m_bCacheTextureDirty = false;
		}
	}

	render->SetClipRegion( rOldRegion );
	render->StartClip();
	render->SetRenderOffset( pOldRenderOffset );
	cache->DrawCachedControlTexture( this );
}
Ejemplo n.º 3
0
Archivo: Base.cpp Proyecto: darkf/gwen
void Base::DoRender( Gwen::Skin::Base* skin )
{
	// If this control has a different skin,
	// then so does its children.
	if ( m_Skin )
	{ skin = m_Skin; }

	// Do think
	Think();
	Gwen::Renderer::Base* render = skin->GetRender();

	if ( render->GetCTT() && ShouldCacheToTexture() )
	{
		DoCacheRender( skin, this );
		return;
	}

	RenderRecursive( skin, GetBounds() );
}
Ejemplo n.º 4
0
Archivo: Base.cpp Proyecto: craley/Poky
void Base::DoCacheRender(Gwen::Skin::Base* skin, Gwen::Controls::Base* pMaster)
{
    Gwen::Renderer::Base* render = skin->GetRender();
    Gwen::Renderer::ICacheToTexture* cache = render->GetCTT();

    if (!cache)
        return;

    Gwen::Point pOldRenderOffset = render->GetRenderOffset();
    Gwen::Rect rOldRegion = render->ClipRegion();

    if (this != pMaster)
    {
        render->AddRenderOffset(GetBounds());
        render->AddClipRegion(GetBounds());
    }
    else
    {
        render->SetRenderOffset(Gwen::Point(0, 0));
        render->SetClipRegion(GetBounds());
    }

    // See if we need to update the cached texture. Dirty?
    if (m_bCacheTextureDirty && render->ClipRegionVisible())
    {
        render->StartClip();
        {
            if (IsCachedToTexture())
                cache->SetupCacheTexture(this);

            // Render myself first
            Render(skin);

            if (!Children.empty())
            {
                // Now render my kids
                for (Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter)
                {
                    Base* pChild = *iter;

                    if (!pChild->Hidden())
                    {
                        // Draw child control using normal render. If it is cached it will
                        // be handled in the same way as this one.
                        pChild->DoRender(skin);
                    }
                }
            }

            if (IsCachedToTexture())
            {
                cache->FinishCacheTexture(this);
                m_bCacheTextureDirty = false;
            }
        }
        render->EndClip();
    }

    // Draw the cached texture.
    render->SetClipRegion(rOldRegion);
    render->StartClip();
    {
        render->SetRenderOffset(pOldRenderOffset);
        cache->DrawCachedControlTexture(this);
    }
    render->EndClip();
}