mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-22 18:02:16 +00:00
Possibly fix desktop backgrounds I think
This commit is contained in:
parent
15b3b356b0
commit
70f56a5f2f
1 changed files with 17 additions and 3 deletions
|
@ -83,6 +83,8 @@ namespace ShiftOS.Frontend.GraphicsSubsystem
|
|||
FocusedControl?.ProcessKeyEvent(e);
|
||||
}
|
||||
|
||||
private static Texture2D DesktopBackground = null;
|
||||
|
||||
public static void DrawBackgroundLayer(GraphicsDevice graphics, SpriteBatch batch, int width, int height)
|
||||
{
|
||||
if (SkinEngine.LoadedSkin == null)
|
||||
|
@ -91,9 +93,21 @@ namespace ShiftOS.Frontend.GraphicsSubsystem
|
|||
var desktopbg = SkinEngine.GetImage("desktopbackground");
|
||||
if(desktopbg != null)
|
||||
{
|
||||
var tex2 = new Texture2D(graphics, desktopbg.Width, desktopbg.Height);
|
||||
tex2.SetData<byte>(SkinEngine.LoadedSkin.DesktopBackgroundImage);
|
||||
batch.Draw(tex2, new Rectangle(0, 0, width, height), Color.White);
|
||||
var bmp = (System.Drawing.Bitmap)SkinEngine.GetImage("desktopbackground");
|
||||
GUI.Control.ResizeImage(bmp, width, height);
|
||||
var _lock = bmp.LockBits(new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
var rgb = new byte[Math.Abs(_lock.Stride) * _lock.Height];
|
||||
Marshal.Copy(_lock.Scan0, rgb, 0, rgb.Length);
|
||||
bmp.UnlockBits(_lock);
|
||||
bmp.Dispose();
|
||||
if(DesktopBackground == null)
|
||||
{
|
||||
DesktopBackground = new Texture2D(graphics, width, height);
|
||||
}
|
||||
|
||||
DesktopBackground.SetData<byte>(rgb);
|
||||
|
||||
batch.Draw(DesktopBackground, new Rectangle(0, 0, width, height), Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue