diff options
author | Marc-André Moreau <marcandre.moreau@gmail.com> | 2011-04-10 02:00:25 +0400 |
---|---|---|
committer | Marc-André Moreau <marcandre.moreau@gmail.com> | 2011-04-10 02:00:25 +0400 |
commit | 2eea8762a45812982575739c3c24ac6f302bf481 (patch) | |
tree | ee1d2c65d7e9984dc8d6564900934f35ee35e268 | |
parent | 671c5caa83146c3a49118b39b4d75d63f3842edd (diff) |
Updated LineTo() test cases
-rw-r--r-- | GdiTest.userprefs | 6 | ||||
-rw-r--r-- | GdiTest/FreeRDPGDI.cs | 10 | ||||
-rw-r--r-- | GdiTest/GDI.cs | 2 | ||||
-rw-r--r-- | GdiTest/GdiTest.pidb | bin | 29449 -> 31459 bytes | |||
-rw-r--r-- | GdiTest/LineToDrawingArea.cs | 37 | ||||
-rw-r--r-- | GdiTest/Win32GDI.cs | 22 |
6 files changed, 63 insertions, 14 deletions
diff --git a/GdiTest.userprefs b/GdiTest.userprefs index a49c8eb..8a3f6bd 100644 --- a/GdiTest.userprefs +++ b/GdiTest.userprefs @@ -2,7 +2,11 @@ <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" /> <MonoDevelop.Ide.Workbench ActiveDocument="GdiTest\LineToDrawingArea.cs"> <Files> - <File FileName="GdiTest\LineToDrawingArea.cs" Line="107" Column="51" /> + <File FileName="GdiTest\MainWindow.cs" Line="24" Column="34" /> + <File FileName="GdiTest\LineToDrawingArea.cs" Line="35" Column="36" /> + <File FileName="GdiTest\GDI.cs" Line="71" Column="2" /> + <File FileName="GdiTest\Win32GDI.cs" Line="211" Column="53" /> + <File FileName="GdiTest\FreeRDPGDI.cs" Line="142" Column="13" /> </Files> </MonoDevelop.Ide.Workbench> <MonoDevelop.Ide.DebuggingService.Breakpoints> diff --git a/GdiTest/FreeRDPGDI.cs b/GdiTest/FreeRDPGDI.cs index fff0a49..833d5cf 100644 --- a/GdiTest/FreeRDPGDI.cs +++ b/GdiTest/FreeRDPGDI.cs @@ -132,6 +132,16 @@ namespace GdiTest return false; } + public override IntPtr CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) + { + return (IntPtr) null; + } + + public override int SelectClipRgn(IntPtr hdc, IntPtr hrgn) + { + return 0; + } + public override int BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, System.Int32 dwRop) { diff --git a/GdiTest/GDI.cs b/GdiTest/GDI.cs index df17f6e..6b2a39d 100644 --- a/GdiTest/GDI.cs +++ b/GdiTest/GDI.cs @@ -67,6 +67,8 @@ namespace GdiTest public abstract IntPtr CreateBitmap(int nWidth, int nHeight, uint cPlanes, uint cBitsPerPel, IntPtr lpvBits); public abstract bool Ellipse(IntPtr hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); public abstract bool Polygon(IntPtr hdc, POINT [] lpPoints, int nCount); + public abstract IntPtr CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); + public abstract int SelectClipRgn(IntPtr hdc, IntPtr hrgn); public abstract int BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, System.Int32 dwRop); } diff --git a/GdiTest/GdiTest.pidb b/GdiTest/GdiTest.pidb Binary files differindex 9ba924c..b27af99 100644 --- a/GdiTest/GdiTest.pidb +++ b/GdiTest/GdiTest.pidb diff --git a/GdiTest/LineToDrawingArea.cs b/GdiTest/LineToDrawingArea.cs index a926f5c..22a2253 100644 --- a/GdiTest/LineToDrawingArea.cs +++ b/GdiTest/LineToDrawingArea.cs @@ -5,13 +5,11 @@ using Gtk; namespace GdiTest { public class LineToDrawingArea : TestDrawingArea - { - private bool rendered; + { private String dumpText; public LineToDrawingArea() { - rendered = false; } protected override bool OnExposeEvent (Gdk.EventExpose args) @@ -29,7 +27,7 @@ namespace GdiTest IntPtr hdc = wg.GetHdc(); int i = 0; - int n = 10; + int n = 11; int w = 16; int h = 16; @@ -147,17 +145,30 @@ namespace GdiTest endp[i].Y = areas[i].Y + (h / 4); i++; + /* Test Case 11: (0,0) -> (+10,+10) */ + areas[i].X = areas[i - 1].X + areas[i - 1].W; + areas[i].Y = areas[i - 1].Y; + areas[i].W = w; + areas[i].H = h; + startp[i].X = areas[i].X; + startp[i].Y = areas[i].Y; + endp[i].X = areas[i].X + w + 10; + endp[i].Y = areas[i].Y + h + 10; + i++; + for (i = 0; i < n; i++) { - if (!rendered) - { - /* Fill Area with White */ - g.Color = new Color(255,255,255); - Rectangle rect = new Rectangle(areas[i].X, areas[i].Y, areas[i].W, areas[i].H); - g.Rectangle(rect); - g.Fill(); - g.Stroke(); - } + /* Set Clipping Region */ + IntPtr clippingRegion = GDI_Win32.CreateRectRgn(areas[i].X, areas[i].Y, areas[i].X + areas[i].W, areas[i].Y + areas[i].H); + GDI_Win32.SelectClipRgn(hdc, IntPtr.Zero); + GDI_Win32.SelectClipRgn(hdc, clippingRegion); + + /* Fill Area with White */ + g.Color = new Color(255,255,255); + Rectangle rect = new Rectangle(areas[i].X, areas[i].Y, areas[i].W, areas[i].H); + g.Rectangle(rect); + g.Fill(); + g.Stroke(); /* Render Test Case */ IntPtr pen = GDI_Win32.CreatePen(1, 1, 0); diff --git a/GdiTest/Win32GDI.cs b/GdiTest/Win32GDI.cs index d2d3526..38041e0 100644 --- a/GdiTest/Win32GDI.cs +++ b/GdiTest/Win32GDI.cs @@ -57,6 +57,12 @@ namespace GdiTest public static extern bool Polygon(IntPtr hdc, POINT [] lpPoints, int nCount); [DllImport("gdi32")] + public static extern IntPtr CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); + + [DllImport("gdi32")] + public static extern int SelectClipRgn(IntPtr hdc, IntPtr hrgn); + + [DllImport("gdi32")] public static extern int BitBlt( IntPtr hdcDest, int nXDest, @@ -207,6 +213,22 @@ namespace GdiTest return false; } + public override IntPtr CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) + { + if (available) + return Callbacks.CreateRectRgn(nLeftRect, nTopRect, nRightRect, nBottomRect); + else + return (IntPtr) null; + } + + public override int SelectClipRgn(IntPtr hdc, IntPtr hrgn) + { + if (available) + return Callbacks.SelectClipRgn(hdc, hrgn); + else + return 0; + } + public override IntPtr CreateSolidBrush(int crColor) { if (available) |