Disable alpha and don't add text to tainted area
While definitely not recommendable, this improves performance drastically while rendering text on many devices, especially when lots of text is render one character at a time.
This commit is contained in:
		
							parent
							
								
									290833c94f
								
							
						
					
					
						commit
						98e3005616
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -1079,7 +1079,8 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
 | 
				
			||||||
	Vec2i gpTexSize;
 | 
						Vec2i gpTexSize;
 | 
				
			||||||
	shState->ensureTexSize(txtSurf->w, txtSurf->h, gpTexSize);
 | 
						shState->ensureTexSize(txtSurf->w, txtSurf->h, gpTexSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool fastBlit = !p->touchesTaintedArea(posRect) && txtAlpha == 1.0f;
 | 
						/* Disable alpha for more performance*/
 | 
				
			||||||
 | 
						bool fastBlit = !p->touchesTaintedArea(posRect); //&& txtAlpha == 1.0f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (fastBlit)
 | 
						if (fastBlit)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					@ -1196,7 +1197,8 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SDL_FreeSurface(txtSurf);
 | 
						SDL_FreeSurface(txtSurf);
 | 
				
			||||||
	p->addTaintedArea(posRect);
 | 
						/* Remove this for a performance advantage, with a risk */
 | 
				
			||||||
 | 
						/* p->addTaintedArea(posRect); */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p->onModified();
 | 
						p->onModified();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue