Example #1
0
	void Canvas::validate( int & _width, int & _height, Ogre::TextureUsage & _usage, Ogre::PixelFormat & _format ) const
	{
		validateSize( _width, _height );

		// restore usage and format
		if( ! mTexPtr.isNull() )
		{
			if( _usage == getDefaultTextureUsage() )
				_usage = (Ogre::TextureUsage) mTexPtr->getUsage();

			if( _format == getDefaultTextureFormat() )
				_format = mTexPtr->getFormat();
		}
	}
Example #2
0
    void Canvas::validate( int& _width, int& _height, TextureUsage& _usage, PixelFormat& _format ) const
    {
        _width = std::max(1, _width);
        _height = std::max(1, _height);

        _width = Bitwise::firstPO2From(_width);
        _height = Bitwise::firstPO2From(_height);

        // restore usage and format
        if ( mTexture != nullptr )
        {
            if ( _usage == getDefaultTextureUsage() )
                _usage = mTexture->getUsage();

            if ( _format == getDefaultTextureFormat() )
                _format = mTexture->getFormat();
        }
    }