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-30 09:13:58 +0400
committerMarc-André Moreau <marcandre.moreau@gmail.com>2011-03-30 09:13:58 +0400
commitb6698138f854d67a625368cb2e93f4f615a9351f (patch)
tree813be5d975d5abd8e768e5b84e9bd5e175f7b51f
parente37fc68b6a6d5fbea87554094cfb075a5aa7afb5 (diff)
Added BitBlt() test cases
-rw-r--r--GdiTest/BitBltDrawingArea.cs144
1 files changed, 137 insertions, 7 deletions
diff --git a/GdiTest/BitBltDrawingArea.cs b/GdiTest/BitBltDrawingArea.cs
index 6c61180..39db5a6 100644
--- a/GdiTest/BitBltDrawingArea.cs
+++ b/GdiTest/BitBltDrawingArea.cs
@@ -31,20 +31,150 @@ namespace GdiTest
System.Drawing.Graphics wg = Gtk.DotNet.Graphics.FromDrawable(this.GdkWindow, true);
IntPtr hdc = wg.GetHdc();
- drawBitmap(hdc, 0, 0, bmp_SRC);
- drawBitmap(hdc, 16, 0, bmp_DST);
- drawBitmap(hdc, 32, 0, bmp_PAT);
+ Area aSrc = new Area();
+ Area aDst = new Area();
+ Area aPat = new Area();
+
+ aSrc.X = 0;
+ aSrc.Y = 0;
+ aSrc.W = 16;
+ aSrc.H = 16;
+
+ aDst.X = 16;
+ aDst.Y = 0;
+ aDst.W = 16;
+ aDst.H = 16;
+
+ aPat.X = 32;
+ aPat.Y = 0;
+ aPat.W = 8;
+ aPat.H = 8;
+
+ drawBitmap(hdc, aSrc.X, aSrc.Y, bmp_SRC);
+ drawBitmap(hdc, aDst.X, aDst.Y, bmp_DST);
+ drawBitmap(hdc, aPat.X, aPat.Y, bmp_PAT);
dumpText += "unsigned char bmp_SRC[" + bmp_SRC.Width * bmp_SRC.Height + "] = \n";
- dumpText += dumpPixelArea(GDI_Win32, hdc, 0, 0, bmp_SRC.Width, bmp_SRC.Height) + "\n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, aSrc.X, aSrc.Y, bmp_SRC.Width, bmp_SRC.Height) + "\n";
dumpText += "unsigned char bmp_DST[" + bmp_DST.Width * bmp_DST.Height + "] = \n";
- dumpText += dumpPixelArea(GDI_Win32, hdc, 16, 0, bmp_DST.Width, bmp_DST.Height) + "\n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, aDst.X, aDst.Y, bmp_DST.Width, bmp_DST.Height) + "\n";
dumpText += "unsigned char bmp_PAT[" + bmp_PAT.Width * bmp_PAT.Height + "] = \n";
- dumpText += dumpPixelArea(GDI_Win32, hdc, 32, 0, bmp_PAT.Width, bmp_PAT.Height) + "\n";
+ dumpText += dumpPixelArea(GDI_Win32, hdc, aPat.X, aPat.Y, bmp_PAT.Width, bmp_PAT.Height) + "\n";
+
+ int i = 0;
+ int n = 11;
+ int w = 16;
+ int h = 16;
+
+ /* Fill Area with White */
+ cg.Color = new Cairo.Color(255,255,255);
+ Cairo.Rectangle rect = new Cairo.Rectangle(0, 32, n * w, h);
+ cg.Rectangle(rect);
+ cg.Fill();
+ cg.Stroke();
+
+ Area[] areas = new Area[n];
+
+ /* Test Case 1: SRCCOPY */
+ areas[i].X = 0;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ 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);
+ i++;
+
+ /* Test Case 2: BLACKNESS */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ 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);
+ i++;
+
+ /* Test Case 3: WHITENESS */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ 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);
+ i++;
+
+ /* Test Case 4: SRCAND */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ 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);
+ i++;
+
+ /* Test Case 5: SRCPAINT */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ 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);
+ i++;
+
+ /* Test Case 6: SRCINVERT */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ 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);
+ i++;
+
+ /* Test Case 7: SRCERASE */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ 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);
+ i++;
+
+ /* Test Case 8: NOTSRCCOPY */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ 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);
+ i++;
+
+ /* Test Case 9: NOTSRCERASE */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ 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);
+ i++;
+
+ /* Test Case 10: DSTINVERT */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ 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.DSTINVERT);
+ i++;
- //GDI_Win32.BitBlt(dc, 70, 0, 60, 60, dc, 0, 0, GDI.SRCCOPY);
+ /* Test Case 11: SPna */
+ areas[i].X = areas[i - 1].X + w;
+ areas[i].Y = 32;
+ areas[i].W = w;
+ 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.SPna);
+ i++;
}
}
return true;