Skip to content

Commit

Permalink
Fix: Core: WoWScreenDXGI: Issue while Configuring frames.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xian55 committed Oct 25, 2023
1 parent 7dc6f63 commit a6678d9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Core/WoWScreen/WowScreenDXGI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ public WowScreenDXGI(ILogger<WowScreenDXGI> logger,

public void Dispose()
{
duplication.ReleaseFrame();
duplication.Dispose();
duplication?.ReleaseFrame();
duplication?.Dispose();

minimapTexture.Dispose();
addonTexture.Dispose();
Expand Down Expand Up @@ -263,7 +263,8 @@ public void Update()
//bitmap.Save($"bitmap.bmp", ImageFormat.Bmp);
//System.Threading.Thread.Sleep(1000);

IAddonDataProvider.InternalUpdate(bdAddon, frames, Data);
if (frames.Length > 0)
IAddonDataProvider.InternalUpdate(bdAddon, frames, Data);

addonBitmap.UnlockBits(bdAddon);

Expand Down Expand Up @@ -349,11 +350,16 @@ public void GetRectangle(out Rectangle rect)

public Bitmap GetBitmap(int width, int height)
{
Update();

Bitmap bitmap = new(width, height);
Rectangle sourceRect = new(0, 0, width, height);

using Graphics graphics = Graphics.FromImage(bitmap);
graphics.DrawImage(Bitmap, 0, 0, sourceRect, GraphicsUnit.Pixel);
lock (Lock)
{
graphics.DrawImage(Bitmap, 0, 0, sourceRect, GraphicsUnit.Pixel);
}

return bitmap;
}
Expand Down

0 comments on commit a6678d9

Please sign in to comment.