From eb081bca76ef4ff8c3ee65accf765777c11d0217 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 4 Apr 2016 12:24:56 +1000 Subject: [PATCH] Precompute dirt texture too for the launcher, also fix 'selected entry' in the servers list in the launcher drawing over other widgets when it is the last element in the list and the user scrolls back up. (Thanks Lemon) --- .../TableWidget/LauncherTableWidget.Drawing.cs | 7 +++++-- Launcher2/LauncherWindow.Background.cs | 17 ++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Launcher2/Gui/TableWidget/LauncherTableWidget.Drawing.cs b/Launcher2/Gui/TableWidget/LauncherTableWidget.Drawing.cs index 144ec7d54..d2ba9cdc8 100644 --- a/Launcher2/Gui/TableWidget/LauncherTableWidget.Drawing.cs +++ b/Launcher2/Gui/TableWidget/LauncherTableWidget.Drawing.cs @@ -87,8 +87,11 @@ namespace Launcher { for( int i = CurrentIndex; i < Count; i++ ) { args = new DrawTextArgs( filter( usedEntries[i] ), font, true ); - if( i == SelectedIndex && !separator ) - drawer.Clear( foreGridCol, X, y - 3, Width, defaultInputHeight + 4 ); + if( i == SelectedIndex && !separator ) { + int startY = y - 3; + int height = Math.Min( startY + (defaultInputHeight + 4), Y + Height ) - startY; + drawer.Clear( foreGridCol, X, startY, Width, height ); + } if( !DrawColumnEntry( drawer, ref args, maxWidth, x, ref y, ref usedEntries[i] ) ) { maxIndex = i; break; diff --git a/Launcher2/LauncherWindow.Background.cs b/Launcher2/LauncherWindow.Background.cs index 3976b2fd8..690029945 100644 --- a/Launcher2/LauncherWindow.Background.cs +++ b/Launcher2/LauncherWindow.Background.cs @@ -65,7 +65,7 @@ namespace Launcher { using( FastBitmap src = new FastBitmap( bmp, true ) ) { Drawer2DExt.DrawScaledPixels( src, terrainPixels, size, new Rectangle( 2 * elemSize, 0, elemSize, elemSize ), - new Rectangle( tileSize, 0, tileSize, tileSize ), 255, 255 ); + new Rectangle( tileSize, 0, tileSize, tileSize ), 128, 64 ); Drawer2DExt.DrawScaledPixels( src, terrainPixels, size, new Rectangle( 1 * elemSize, 0, elemSize, elemSize ), new Rectangle( 0, 0, tileSize, tileSize ), 96, 96 ); @@ -81,8 +81,8 @@ namespace Launcher { if( ClassicBackground ) { using( FastBitmap dst = new FastBitmap( Framebuffer, true ) ) { - ClearTile( 0, 0, Width, 48, tileSize, 128, 64, dst, true ); - ClearTile( 0, 48, Width, Height - 48, 0, 96, 96, dst, false ); + ClearTile( 0, 0, Width, 48, tileSize, dst ); + ClearTile( 0, 48, Width, Height - 48, 0, dst ); } } else { ClearArea( 0, 0, Width, Height ); @@ -112,26 +112,21 @@ namespace Launcher { public void ClearArea( int x, int y, int width, int height, FastBitmap dst ) { if( ClassicBackground ) { - ClearTile( x, y, width, height, 0, 96, 96, dst, false ); + ClearTile( x, y, width, height, 0, dst ); } else { FastColour col = LauncherSkin.BackgroundCol; Drawer2DExt.DrawNoise( dst, new Rectangle( x, y, width, height ), col, 6 ); } } - void ClearTile( int x, int y, int width, int height, int srcX, - byte scaleA, byte scaleB, FastBitmap dst, bool scale ) { + void ClearTile( int x, int y, int width, int height, int srcX, FastBitmap dst ) { if( x >= Width || y >= Height ) return; Rectangle srcRect = new Rectangle( srcX, 0, tileSize, tileSize ); Size size = new Size( tileSize, tileSize ); Rectangle area = new Rectangle( x, y, width, height ); area.Width = Math.Min( area.X + area.Width, dst.Width ) - area.X; area.Height = Math.Min( area.Y + area.Height, dst.Height ) - area.Y; - - if( scale ) - Drawer2DExt.DrawScaledPixels( terrainPixels, dst, size, srcRect, area, scaleA, scaleB ); - else - Drawer2DExt.DrawTiledPixels( terrainPixels, dst, srcRect, area ); + Drawer2DExt.DrawTiledPixels( terrainPixels, dst, srcRect, area ); } } }