-
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1699 from cwensley/curtis/wpf-graphics-on-bitmap-…
…is-slow Wpf: Fix huge performance penalty using Graphics on many Bitmaps
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using Eto.Drawing; | ||
using Eto.Test.UnitTests; | ||
using NUnit.Framework; | ||
|
||
namespace Eto.Test.Wpf.UnitTests | ||
{ | ||
[TestFixture] | ||
public class BitmapTests : TestBase | ||
{ | ||
[Test, Timeout(1000)] | ||
public void CreatingManySmallBitmapsShouldBeFast() | ||
{ | ||
var sw = new Stopwatch(); | ||
sw.Start(); | ||
for (int i = 0; i < 100; i++) | ||
{ | ||
var bmp = new Bitmap(20, 20, PixelFormat.Format32bppRgba); | ||
|
||
using (var g = new Graphics(bmp)) | ||
{ | ||
g.Clear(Colors.Blue); | ||
} | ||
} | ||
sw.Stop(); | ||
Console.WriteLine($"Total time: {sw.Elapsed}"); | ||
} | ||
|
||
} | ||
} |