| 106 | } |
| 107 | |
| 108 | void Tr2Sprite2dContainer::GatherSprites( Tr2Sprite2dScene* renderer ) |
| 109 | { |
| 110 | if( !m_display || ( m_children.empty() && m_background.empty() ) ) |
| 111 | { |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | if( m_displayWidth <= 0.0f || m_displayHeight <= 0.0f ) |
| 116 | { |
| 117 | return; |
| 118 | } |
| 119 | |
| 120 | if( m_cacheContentsHint ) |
| 121 | { |
| 122 | if( m_isDirty ) |
| 123 | { |
| 124 | m_cleanFrameCount = 0; |
| 125 | if( m_dirtyFrameCount > 10 ) |
| 126 | { |
| 127 | m_cacheContents = false; |
| 128 | if( m_cachedDisplayList ) |
| 129 | { |
| 130 | CCP_DELETE m_cachedDisplayList; |
| 131 | m_cachedDisplayList = nullptr; |
| 132 | } |
| 133 | } |
| 134 | else |
| 135 | { |
| 136 | m_dirtyFrameCount++; |
| 137 | } |
| 138 | } |
| 139 | else |
| 140 | { |
| 141 | m_dirtyFrameCount = 0; |
| 142 | if( m_cleanFrameCount > 3 ) |
| 143 | { |
| 144 | m_cacheContents = true; |
| 145 | } |
| 146 | else |
| 147 | { |
| 148 | m_cleanFrameCount++; |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | else |
| 153 | { |
| 154 | m_dirtyFrameCount = 0; |
| 155 | m_cleanFrameCount = 0; |
| 156 | m_cacheContents = false; |
| 157 | if( m_cachedDisplayList ) |
| 158 | { |
| 159 | CCP_DELETE m_cachedDisplayList; |
| 160 | m_cachedDisplayList = nullptr; |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | if( m_cacheContents && !renderer->IsCapturing() ) |
| 165 | { |
no test coverage detected