File diff r20302:b2b3bcaa28d3 → r20303:6adbc75a1297
src/gfx.cpp
Show inline comments
 
@@ -1680,24 +1680,42 @@ byte GetCharacterWidth(FontSize size, WC
 
 * @param size  Font of the digit
 
 * @return Width of the digit.
 
 */
 
byte GetDigitWidth(FontSize size)
 
{
 
	byte width = 0;
 
	for (char c = '0'; c <= '9'; c++) {
 
		width = max(GetCharacterWidth(size, c), width);
 
	}
 
	return width;
 
}
 

	
 
/**
 
 * Return the digit with the biggest width.
 
 * @param size  Font of the digit
 
 * @return Broadest digit.
 
 */
 
uint GetBroadestDigit(FontSize size)
 
{
 
	uint digit = 0;
 
	byte width = 0;
 
	for (char c = '0'; c <= '9'; c++) {
 
		byte w = GetCharacterWidth(size, c);
 
		if (w > width) {
 
			width = w;
 
			digit = c - '0';
 
		}
 
	}
 
	return digit;
 
}
 

	
 
void ScreenSizeChanged()
 
{
 
	_dirty_bytes_per_line = CeilDiv(_screen.width, DIRTY_BLOCK_WIDTH);
 
	_dirty_blocks = ReallocT<byte>(_dirty_blocks, _dirty_bytes_per_line * CeilDiv(_screen.height, DIRTY_BLOCK_HEIGHT));
 

	
 
	/* check the dirty rect */
 
	if (_invalid_rect.right >= _screen.width) _invalid_rect.right = _screen.width;
 
	if (_invalid_rect.bottom >= _screen.height) _invalid_rect.bottom = _screen.height;
 

	
 
	/* screen size changed and the old bitmap is invalid now, so we don't want to undraw it */
 
	_cursor.visible = false;