Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FreeRDP/GdiTest.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Moreau <marcandre.moreau@gmail.com>2011-03-31 07:45:24 +0400
committerMarc-André Moreau <marcandre.moreau@gmail.com>2011-03-31 07:45:24 +0400
commit4caf717e6d5213270047d1508f02beb5a57161ae (patch)
treecea3666b34e8a7f51636b7234c11956b8356645c
parentb6698138f854d67a625368cb2e93f4f615a9351f (diff)
Added missing BitBlt test cases, including pattern blits
-rw-r--r--GdiTest.userprefs16
-rw-r--r--GdiTest/BitBltDrawingArea.cs89
-rw-r--r--GdiTest/FreeRDPGDI.cs10
-rw-r--r--GdiTest/GDI.cs2
-rw-r--r--GdiTest/GdiTest.pidbbin21842 -> 27508 bytes
-rw-r--r--GdiTest/Win32GDI.cs22
6 files changed, 130 insertions, 9 deletions
diff --git a/GdiTest.userprefs b/GdiTest.userprefs
index 321859a..8b8d512 100644
--- a/GdiTest.userprefs
+++ b/GdiTest.userprefs
@@ -2,14 +2,14 @@
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
<MonoDevelop.Ide.Workbench ActiveDocument="GdiTest\BitBltDrawingArea.cs">
<Files>
- <File FileName="GdiTest\Win32GDI.cs" Line="30" Column="72" />
- <File FileName="GdiTest\MainWindow.cs" Line="40" Column="38" />
- <File FileName="GdiTest\Main.cs" Line="12" Column="37" />
- <File FileName="GdiTest\LineToDrawingArea.cs" Line="186" Column="1" />
- <File FileName="GdiTest\TestDrawingArea.cs" Line="7" Column="18" />
- <File FileName="GdiTest\BitBltDrawingArea.cs" Line="12" Column="4" />
- <File FileName="GdiTest\GDI.cs" Line="37" Column="60" />
- <File FileName="c:\Users\awake\Documents\GdiTest\GdiTest\FreeRDPGDI.cs" Line="74" Column="3" />
+ <File FileName="GdiTest\MainWindow.cs" Line="21" Column="49" />
+ <File FileName="c:\Users\awake\Documents\GdiTest\GdiTest\Win32GDI.cs" Line="31" Column="4" />
+ <File FileName="GdiTest\GDI.cs" Line="1" Column="1" />
+ <File FileName="GdiTest\BitBltDrawingArea.cs" Line="46" Column="18" />
+ <File FileName="GdiTest\LineToDrawingArea.cs" Line="34" Column="17" />
+ <File FileName="GdiTest\PolygonDrawingArea.cs" Line="1" Column="1" />
+ <File FileName="GdiTest\PolylineToDrawingArea.cs" Line="1" Column="1" />
+ <File FileName="GdiTest\EllipseDrawingArea.cs" Line="41" Column="1" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>
diff --git a/GdiTest/BitBltDrawingArea.cs b/GdiTest/BitBltDrawingArea.cs
index 39db5a6..b55a035 100644
--- a/GdiTest/BitBltDrawingArea.cs
+++ b/GdiTest/BitBltDrawingArea.cs
@@ -63,8 +63,11 @@ namespace GdiTest
dumpText += "unsigned char bmp_PAT[" + bmp_PAT.Width * bmp_PAT.Height + "] = \n";
dumpText += dumpPixelArea(GDI_Win32, hdc, aPat.X, aPat.Y, bmp_PAT.Width, bmp_PAT.Height) + "\n";
+ IntPtr hBrushOld;
+ IntPtr hBrush = GDI_Win32.CreatePatternBrush(bmp_PAT.GetHbitmap());
+
int i = 0;
- int n = 11;
+ int n = 16;
int w = 16;
int h = 16;
@@ -84,6 +87,8 @@ namespace GdiTest
areas[i].H = h;
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.SRCCOPY);
+ dumpText += "unsigned char bmp_SRCCOPY[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
i++;
/* Test Case 2: BLACKNESS */
@@ -93,6 +98,8 @@ namespace GdiTest
areas[i].H = h;
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.BLACKNESS);
+ dumpText += "unsigned char bmp_BLACKNESS[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
i++;
/* Test Case 3: WHITENESS */
@@ -102,6 +109,8 @@ namespace GdiTest
areas[i].H = h;
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.WHITENESS);
+ dumpText += "unsigned char bmp_WHITENESS[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
i++;
/* Test Case 4: SRCAND */
@@ -111,6 +120,8 @@ namespace GdiTest
areas[i].H = h;
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.SRCAND);
+ dumpText += "unsigned char bmp_SRCAND[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
i++;
/* Test Case 5: SRCPAINT */
@@ -120,6 +131,8 @@ namespace GdiTest
areas[i].H = h;
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.SRCPAINT);
+ dumpText += "unsigned char bmp_SRCPAINT[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
i++;
/* Test Case 6: SRCINVERT */
@@ -129,6 +142,8 @@ namespace GdiTest
areas[i].H = h;
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.SRCINVERT);
+ dumpText += "unsigned char bmp_SRCINVERT[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
i++;
/* Test Case 7: SRCERASE */
@@ -138,6 +153,8 @@ namespace GdiTest
areas[i].H = h;
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.SRCERASE);
+ dumpText += "unsigned char bmp_SRCERASE[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
i++;
/* Test Case 8: NOTSRCCOPY */
@@ -147,6 +164,8 @@ namespace GdiTest
areas[i].H = h;
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.NOTSRCCOPY);
+ dumpText += "unsigned char bmp_NOTSRCCOPY[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
i++;
/* Test Case 9: NOTSRCERASE */
@@ -156,6 +175,8 @@ namespace GdiTest
areas[i].H = h;
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.NOTSRCERASE);
+ dumpText += "unsigned char bmp_NOTSRCERASE[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
i++;
/* Test Case 10: DSTINVERT */
@@ -163,8 +184,11 @@ namespace GdiTest
areas[i].Y = 32;
areas[i].W = w;
areas[i].H = h;
+ hBrushOld = GDI_Win32.SelectObject(hdc, hBrush);
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.DSTINVERT);
+ dumpText += "unsigned char bmp_DSTINVERT[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
i++;
/* Test Case 11: SPna */
@@ -172,8 +196,71 @@ namespace GdiTest
areas[i].Y = 32;
areas[i].W = w;
areas[i].H = h;
+ hBrushOld = GDI_Win32.SelectObject(hdc, hBrush);
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.SPna);
+ dumpText += "unsigned char bmp_SPna[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
+ i++;
+
+ /* Test Case 12: MERGEPAINT */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ areas[i].H = h;
+ hBrushOld = GDI_Win32.SelectObject(hdc, hBrush);
+ GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
+ GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.MERGEPAINT);
+ dumpText += "unsigned char bmp_MERGEPAINT[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
+ i++;
+
+ /* Test Case 13: MERGECOPY */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ areas[i].H = h;
+ hBrushOld = GDI_Win32.SelectObject(hdc, hBrush);
+ GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
+ GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.MERGECOPY);
+ dumpText += "unsigned char bmp_MERGECOPY[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
+ i++;
+
+ /* Test Case 14: PATPAINT */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ areas[i].H = h;
+ hBrushOld = GDI_Win32.SelectObject(hdc, hBrush);
+ GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
+ GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.PATPAINT);
+ dumpText += "unsigned char bmp_PATPAINT[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
+ i++;
+
+ /* Test Case 15: PATCOPY */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ areas[i].H = h;
+ hBrushOld = GDI_Win32.SelectObject(hdc, hBrush);
+ GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
+ GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.PATCOPY);
+ dumpText += "unsigned char bmp_PATCOPY[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
+ i++;
+
+ /* Test Case 16: PATINVERT */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ areas[i].H = h;
+ hBrushOld = GDI_Win32.SelectObject(hdc, hBrush);
+ GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aDst.X, aDst.Y, GDI.SRCCOPY);
+ GDI_Win32.BitBlt(hdc, areas[i].X, areas[i].Y, aSrc.W, aSrc.H, hdc, aSrc.X, aSrc.Y, GDI.PATINVERT);
+ dumpText += "unsigned char bmp_PATINVERT[" + areas[i].W * areas[i].H + "] = \n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, areas[i].X, areas[i].Y, areas[i].W, areas[i].H) + "\n";
i++;
}
}
diff --git a/GdiTest/FreeRDPGDI.cs b/GdiTest/FreeRDPGDI.cs
index 515ec84..8e8c82f 100644
--- a/GdiTest/FreeRDPGDI.cs
+++ b/GdiTest/FreeRDPGDI.cs
@@ -112,6 +112,16 @@ namespace GdiTest
return (IntPtr) null;
}
+ public override IntPtr CreatePatternBrush(IntPtr hbmp)
+ {
+ return (IntPtr) null;
+ }
+
+ public override IntPtr CreateBitmap(int nWidth, int nHeight, uint cPlanes, uint cBitsPerPel, IntPtr lpvBits)
+ {
+ return (IntPtr) null;
+ }
+
public override bool Ellipse(IntPtr hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
{
return false;
diff --git a/GdiTest/GDI.cs b/GdiTest/GDI.cs
index 839615a..fc99058 100644
--- a/GdiTest/GDI.cs
+++ b/GdiTest/GDI.cs
@@ -63,6 +63,8 @@ namespace GdiTest
public abstract bool PolylineTo(IntPtr hdc, POINT [] lppt, uint cCount);
public abstract IntPtr CreatePen(int fnPenStyle, int nWidth, int crColor);
public abstract IntPtr CreateSolidBrush(int crColor);
+ public abstract IntPtr CreatePatternBrush(IntPtr hbmp);
+ 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 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
index 9bd066c..8bd50c5 100644
--- a/GdiTest/GdiTest.pidb
+++ b/GdiTest/GdiTest.pidb
Binary files differ
diff --git a/GdiTest/Win32GDI.cs b/GdiTest/Win32GDI.cs
index 0532b48..ff1157b 100644
--- a/GdiTest/Win32GDI.cs
+++ b/GdiTest/Win32GDI.cs
@@ -45,6 +45,12 @@ namespace GdiTest
public static extern IntPtr CreateSolidBrush(int crColor);
[DllImport("gdi32")]
+ public static extern IntPtr CreatePatternBrush(IntPtr hbmp);
+
+ [DllImport("gdi32")]
+ public static extern IntPtr CreateBitmap(int nWidth, int nHeight, uint cPlanes, uint cBitsPerPel, IntPtr lpvBits);
+
+ [DllImport("gdi32")]
public static extern bool Ellipse(IntPtr hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
[DllImport("gdi32")]
@@ -201,6 +207,22 @@ namespace GdiTest
return (IntPtr) null;
}
+ public override IntPtr CreatePatternBrush(IntPtr hbmp)
+ {
+ if (available)
+ return Callbacks.CreatePatternBrush(hbmp);
+ else
+ return (IntPtr) null;
+ }
+
+ public override IntPtr CreateBitmap(int nWidth, int nHeight, uint cPlanes, uint cBitsPerPel, IntPtr lpvBits)
+ {
+ if (available)
+ return Callbacks.CreateBitmap(nWidth, nHeight, cPlanes, cBitsPerPel, lpvBits);
+ else
+ return (IntPtr) null;
+ }
+
public override int BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,
IntPtr hdcSrc, int nXSrc, int nYSrc, System.Int32 dwRop)
{