2 using System.Drawing;
\r
3 using System.Drawing.Imaging;
\r
4 using System.Diagnostics;
\r
5 using System.Windows.Forms;
\r
6 using D2DBench.Properties;
\r
8 using SharpDX.Direct2D1;
\r
9 using SharpDX.DirectWrite;
\r
10 using System.Runtime.InteropServices;
\r
12 using D2D1 = SharpDX.Direct2D1;
\r
13 using DW = SharpDX.DirectWrite;
\r
14 using Drawing = System.Drawing;
\r
18 class Method4 : IBench
\r
20 public int fillAreaSize { get { return bmp.Width * bmp.Height * this.loopCount; } }
\r
21 public string methodName { get { return "D2DBitBlt"; } }
\r
22 public int loopCount { get; set; }
\r
24 Drawing.Size ClientSize;
\r
29 public void Init(Control ctrl, bool antialias, RenderMethod method)
\r
31 ClientSize = ctrl.ClientSize;
\r
32 if (method == RenderMethod.Direct2D)
\r
33 this.d2d = new Direct2D(ctrl, ClientSize, antialias);
\r
35 this.d2d = new GDI(ctrl);
\r
36 this.bmp = this.d2d.Load(Resources.image);
\r
40 public void Dispose()
\r
42 this.d2d.UnLoad(this.bmp);
\r
48 this.d2d.BeginDraw();
\r
49 for (int i = 0; i < this.loopCount; i++)
\r
51 int left = rnd.Next(ClientSize.Width);
\r
52 int top = rnd.Next(ClientSize.Height);
\r
53 this.d2d.DrawBitmap(bmp,
\r