Author: gschneider
Date: Mon Nov 17 09:05:02 2008
New Revision: 37407
URL:
http://svn.reactos.org/svn/reactos?rev=37407&view=rev
Log:
- Add new directory for some dib related test restructuring, including two new tests:
- bltrop test for well known BitBlt ROPs, highlighted bugs were processed in r37268,
r37269, r37372
- vbltest for testing several blit and blend functions, highlighted bugs fixed in r37139,
r37168 and some overlay issues still tbd
Added:
trunk/rostests/dibtests/
trunk/rostests/dibtests/bltrop/
trunk/rostests/dibtests/bltrop/bltrop.c (with props)
trunk/rostests/dibtests/bltrop/bltrop.rbuild (with props)
trunk/rostests/dibtests/bltrop/bltrop.rc (with props)
trunk/rostests/dibtests/bltrop/mars.bmp (with props)
trunk/rostests/dibtests/directory.rbuild (with props)
trunk/rostests/dibtests/vbltest/
trunk/rostests/dibtests/vbltest/test_inv01.bmp (with props)
trunk/rostests/dibtests/vbltest/test_inv04.bmp (with props)
trunk/rostests/dibtests/vbltest/test_inv08.bmp (with props)
trunk/rostests/dibtests/vbltest/test_inv24.bmp (with props)
trunk/rostests/dibtests/vbltest/vbltest.c (with props)
trunk/rostests/dibtests/vbltest/vbltest.rbuild (with props)
trunk/rostests/dibtests/vbltest/vbltest.rc (with props)
Added: trunk/rostests/dibtests/bltrop/bltrop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/bltrop/bltrop.c?…
==============================================================================
--- trunk/rostests/dibtests/bltrop/bltrop.c (added)
+++ trunk/rostests/dibtests/bltrop/bltrop.c [iso-8859-1] Mon Nov 17 09:05:02 2008
@@ -1,0 +1,163 @@
+/*
+ * Shows the 15 well known BitBlt raster operations
+ * using src, dest, pattern, a background brush and color.
+ *
+ * Created by Gregor Schneider <grschneider AT gmail DOT com>, November 2008
+*/
+
+#include <windows.h>
+#include <tchar.h>
+
+HINSTANCE hInst;
+TCHAR szWindowClass[] = _T("testclass");
+
+static LRESULT CALLBACK
+WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ static HBITMAP hBmpTest;
+
+ switch (message)
+ {
+ case WM_CREATE:
+ {
+ hBmpTest = (HBITMAP)LoadImage(hInst, MAKEINTRESOURCE(100), IMAGE_BITMAP, 0,
0, LR_DEFAULTCOLOR);
+ break;
+ }
+
+ case WM_PAINT:
+ {
+ PAINTSTRUCT ps;
+ HDC hdc, hdcMem;
+ BITMAP bitmap;
+ HBRUSH brush, brush2;
+
+ hdc = BeginPaint(hWnd, &ps);
+ hdcMem = CreateCompatibleDC(hdc);
+
+ GetObject(hBmpTest, sizeof(BITMAP), &bitmap);
+
+ /* fill destination with brush */
+ brush = CreateHatchBrush(HS_DIAGCROSS, RGB(255,0,0));
+ SelectObject(hdc, brush);
+ PatBlt(hdc, 0, 0, 4*bitmap.bmWidth, 4*bitmap.bmHeight, PATCOPY);
+ /* set up a second brush */
+ brush2 = CreateHatchBrush(HS_VERTICAL, RGB(127,127,127));
+
+ /* first select brush, then set bk color */
+ SelectObject(hdc, brush2);
+ SetBkColor(hdc, RGB(0, 255, 0));
+
+ /* 15 blt op's */
+ SelectObject(hdcMem, hBmpTest);
+ BitBlt(hdc, 0, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY);
+ BitBlt(hdc, 100, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
DSTINVERT);
+ BitBlt(hdc, 200, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
MERGECOPY);
+ BitBlt(hdc, 300, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
MERGEPAINT);
+
+ BitBlt(hdc, 0, 100, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
NOTSRCCOPY);
+ BitBlt(hdc, 100, 100, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
NOTSRCERASE);
+ BitBlt(hdc, 200, 100, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
PATCOPY);
+ BitBlt(hdc, 300, 100, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
PATINVERT);
+
+ BitBlt(hdc, 0, 200, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
PATPAINT);
+ BitBlt(hdc, 100, 200, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
SRCAND);
+ BitBlt(hdc, 200, 200, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
SRCERASE);
+ BitBlt(hdc, 300, 200, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
SRCINVERT);
+
+ BitBlt(hdc, 0, 300, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
BLACKNESS);
+ BitBlt(hdc, 100, 300, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
SRCPAINT);
+ BitBlt(hdc, 200, 300, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
WHITENESS);
+
+ DeleteDC(hdcMem);
+ EndPaint(hWnd, &ps);
+ break;
+ }
+
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ break;
+ default:
+ return DefWindowProc(hWnd, message, wParam, lParam);
+ }
+ return 0;
+}
+
+
+static ATOM
+MyRegisterClass(HINSTANCE hInstance)
+{
+ WNDCLASSEX wcex;
+
+ wcex.cbSize = sizeof(WNDCLASSEX);
+
+ wcex.style = CS_HREDRAW | CS_VREDRAW;
+ wcex.lpfnWndProc = WndProc;
+ wcex.cbClsExtra = 0;
+ wcex.cbWndExtra = 0;
+ wcex.hInstance = hInstance;
+ wcex.hIcon = NULL;
+ wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wcex.lpszMenuName = NULL;
+ wcex.lpszClassName = szWindowClass;
+ wcex.hIconSm = NULL;
+
+ return RegisterClassEx(&wcex);
+}
+
+
+static BOOL
+InitInstance(HINSTANCE hInstance, int nCmdShow)
+{
+ HWND hWnd;
+
+ hInst = hInstance;
+
+ hWnd = CreateWindowEx(0,
+ szWindowClass,
+ _T("BitBlt raster operation test"),
+ WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ 440,
+ 440,
+ NULL,
+ NULL,
+ hInstance,
+ NULL);
+
+ if (!hWnd)
+ {
+ return FALSE;
+ }
+
+ ShowWindow(hWnd, nCmdShow);
+ UpdateWindow(hWnd);
+
+ return TRUE;
+}
+
+
+int WINAPI
+_tWinMain(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPTSTR lpCmdLine,
+ int nCmdShow)
+{
+ MSG msg;
+
+ MyRegisterClass(hInstance);
+
+ if (!InitInstance(hInstance, nCmdShow))
+ {
+ return FALSE;
+ }
+
+ while (GetMessage(&msg, NULL, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+
+ return (int)msg.wParam;
+}
Propchange: trunk/rostests/dibtests/bltrop/bltrop.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/bltrop/bltrop.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/bltrop/bltrop.rb…
==============================================================================
--- trunk/rostests/dibtests/bltrop/bltrop.rbuild (added)
+++ trunk/rostests/dibtests/bltrop/bltrop.rbuild [iso-8859-1] Mon Nov 17 09:05:02 2008
@@ -1,0 +1,9 @@
+<module name="bltrop" type="win32gui" installbase="bin"
installname="bltrop.exe">
+ <define name="__USE_W32API" />
+ <include base="bltrop">.</include>
+ <library>kernel32</library>
+ <library>gdi32</library>
+ <library>user32</library>
+ <file>bltrop.c</file>
+ <file>bltrop.rc</file>
+</module>
Propchange: trunk/rostests/dibtests/bltrop/bltrop.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/bltrop/bltrop.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/bltrop/bltrop.rc…
==============================================================================
--- trunk/rostests/dibtests/bltrop/bltrop.rc (added)
+++ trunk/rostests/dibtests/bltrop/bltrop.rc [iso-8859-1] Mon Nov 17 09:05:02 2008
@@ -1,0 +1,1 @@
+100 BITMAP "mars.bmp"
Propchange: trunk/rostests/dibtests/bltrop/bltrop.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/bltrop/mars.bmp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/bltrop/mars.bmp?…
==============================================================================
Binary file - no diff available.
Propchange: trunk/rostests/dibtests/bltrop/mars.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/rostests/dibtests/directory.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/directory.rbuild…
==============================================================================
--- trunk/rostests/dibtests/directory.rbuild (added)
+++ trunk/rostests/dibtests/directory.rbuild [iso-8859-1] Mon Nov 17 09:05:02 2008
@@ -1,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
+<group
xmlns:xi="http://www.w3.org/2001/XInclude">
+ <directory name="bltrop">
+ <xi:include href="bltrop/bltrop.rbuild" />
+ </directory>
+ <directory name="vbltest">
+ <xi:include href="vbltest/vbltest.rbuild" />
+ </directory>
+</group>
Propchange: trunk/rostests/dibtests/directory.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/vbltest/test_inv01.bmp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/vbltest/test_inv…
==============================================================================
Binary file - no diff available.
Propchange: trunk/rostests/dibtests/vbltest/test_inv01.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/rostests/dibtests/vbltest/test_inv04.bmp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/vbltest/test_inv…
==============================================================================
Binary file - no diff available.
Propchange: trunk/rostests/dibtests/vbltest/test_inv04.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/rostests/dibtests/vbltest/test_inv08.bmp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/vbltest/test_inv…
==============================================================================
Binary file - no diff available.
Propchange: trunk/rostests/dibtests/vbltest/test_inv08.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/rostests/dibtests/vbltest/test_inv24.bmp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/vbltest/test_inv…
==============================================================================
Binary file - no diff available.
Propchange: trunk/rostests/dibtests/vbltest/test_inv24.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/rostests/dibtests/vbltest/vbltest.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/vbltest/vbltest.…
==============================================================================
--- trunk/rostests/dibtests/vbltest/vbltest.c (added)
+++ trunk/rostests/dibtests/vbltest/vbltest.c [iso-8859-1] Mon Nov 17 09:05:02 2008
@@ -1,0 +1,178 @@
+/*
+ * Tests various blit and blend operations with different src
+ * bit depths and scaling where possbile.
+ *
+ * Created by Gregor Schneider <grschneider AT gmail DOT com>, November 2008
+*/
+
+#include <windows.h>
+#include <tchar.h>
+
+#define CURRENT_BMPS 4
+#define SCALE 1.5
+#define OFFSET 5
+
+HINSTANCE hInst;
+TCHAR szWindowClass[] = _T("testclass");
+
+static LRESULT CALLBACK
+WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ static HBITMAP hbmList[CURRENT_BMPS];
+
+ switch (message)
+ {
+ case WM_CREATE:
+ {
+ hbmList[0] = (HBITMAP)LoadImage(hInst, MAKEINTRESOURCE(100), IMAGE_BITMAP, 0,
0, LR_DEFAULTCOLOR);
+ hbmList[1] = (HBITMAP)LoadImage(hInst, MAKEINTRESOURCE(400), IMAGE_BITMAP, 0,
0, LR_DEFAULTCOLOR);
+ hbmList[2] = (HBITMAP)LoadImage(hInst, MAKEINTRESOURCE(800), IMAGE_BITMAP, 0,
0, LR_DEFAULTCOLOR);
+ hbmList[3] = (HBITMAP)LoadImage(hInst, MAKEINTRESOURCE(2400), IMAGE_BITMAP,
0, 0, LR_DEFAULTCOLOR);
+ break;
+ }
+
+ case WM_PAINT:
+ {
+ PAINTSTRUCT ps;
+ HDC hdc, hdcMem;
+ BITMAP bitmap;
+ BLENDFUNCTION bfunc;
+ int x = 0, y = 0, i;
+
+ hdc = BeginPaint(hWnd, &ps);
+ hdcMem = CreateCompatibleDC(hdc);
+
+ bfunc.AlphaFormat = AC_SRC_ALPHA;
+ bfunc.BlendFlags = 0;
+ bfunc.BlendOp = AC_SRC_OVER;
+ bfunc.SourceConstantAlpha = 128;
+
+ for(i = 0; i < CURRENT_BMPS; i++)
+ {
+ y = 0;
+ SelectObject(hdcMem, hbmList[i]);
+ GetObject(hbmList[i], sizeof(BITMAP), &bitmap);
+
+ /* bit blt */
+ BitBlt(hdc, x, y, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
SRCCOPY);
+ y += bitmap.bmHeight + OFFSET;
+
+ /* stretch blt, org size */
+ StretchBlt(hdc, x, y, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
bitmap.bmWidth, bitmap.bmHeight, SRCCOPY);
+ y += bitmap.bmHeight + OFFSET;
+
+ /* stretch blt, scaled */
+ StretchBlt(hdc, x, y, bitmap.bmWidth*SCALE, bitmap.bmHeight*SCALE,
hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCCOPY);
+ y += bitmap.bmHeight*SCALE + OFFSET;
+
+ /* transparent blt, transparency: grey */
+ TransparentBlt(hdc, x, y, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
bitmap.bmWidth, bitmap.bmHeight, 128*256*256+128*256+128);
+ y += bitmap.bmHeight + OFFSET;
+
+ /* transparent blt, transparency: grey, scaled */
+ TransparentBlt(hdc, x, y, bitmap.bmWidth*SCALE, bitmap.bmHeight*SCALE,
hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, 128*256*256+128*256+128);
+ y += bitmap.bmHeight*SCALE + OFFSET;
+
+ /* alpha blend, org size */
+ AlphaBlend(hdc, x, y, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0,
bitmap.bmWidth, bitmap.bmHeight, bfunc);
+ y += bitmap.bmHeight + OFFSET;
+
+ /* alpha blend, scaled */
+ AlphaBlend(hdc, x, y, bitmap.bmWidth*SCALE, bitmap.bmHeight*SCALE,
hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, bfunc);
+
+ x += bitmap.bmWidth*SCALE + OFFSET;
+ }
+
+ DeleteDC(hdcMem);
+ EndPaint(hWnd, &ps);
+ break;
+ }
+
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ break;
+ default:
+ return DefWindowProc(hWnd, message, wParam, lParam);
+ }
+ return 0;
+}
+
+
+static ATOM
+MyRegisterClass(HINSTANCE hInstance)
+{
+ WNDCLASSEX wcex;
+
+ wcex.cbSize = sizeof(WNDCLASSEX);
+
+ wcex.style = CS_HREDRAW | CS_VREDRAW;
+ wcex.lpfnWndProc = WndProc;
+ wcex.cbClsExtra = 0;
+ wcex.cbWndExtra = 0;
+ wcex.hInstance = hInstance;
+ wcex.hIcon = NULL;
+ wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wcex.lpszMenuName = NULL;
+ wcex.lpszClassName = szWindowClass;
+ wcex.hIconSm = NULL;
+
+ return RegisterClassEx(&wcex);
+}
+
+
+static BOOL
+InitInstance(HINSTANCE hInstance, int nCmdShow)
+{
+ HWND hWnd;
+
+ hInst = hInstance;
+
+ hWnd = CreateWindowEx(0,
+ szWindowClass,
+ _T("Various blit and blend operations"),
+ WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ 640,
+ 640,
+ NULL,
+ NULL,
+ hInstance,
+ NULL);
+
+ if (!hWnd)
+ {
+ return FALSE;
+ }
+
+ ShowWindow(hWnd, nCmdShow);
+ UpdateWindow(hWnd);
+
+ return TRUE;
+}
+
+
+int WINAPI
+_tWinMain(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPTSTR lpCmdLine,
+ int nCmdShow)
+{
+ MSG msg;
+
+ MyRegisterClass(hInstance);
+
+ if (!InitInstance(hInstance, nCmdShow))
+ {
+ return FALSE;
+ }
+
+ while (GetMessage(&msg, NULL, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+
+ return (int)msg.wParam;
+}
Propchange: trunk/rostests/dibtests/vbltest/vbltest.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/vbltest/vbltest.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/vbltest/vbltest.…
==============================================================================
--- trunk/rostests/dibtests/vbltest/vbltest.rbuild (added)
+++ trunk/rostests/dibtests/vbltest/vbltest.rbuild [iso-8859-1] Mon Nov 17 09:05:02 2008
@@ -1,0 +1,10 @@
+<module name="vbltest" type="win32gui" installbase="bin"
installname="vbltest.exe">
+ <define name="__USE_W32API" />
+ <include base="vbltest">.</include>
+ <library>kernel32</library>
+ <library>gdi32</library>
+ <library>user32</library>
+ <library>msimg32</library>
+ <file>vbltest.c</file>
+ <file>vbltest.rc</file>
+</module>
Propchange: trunk/rostests/dibtests/vbltest/vbltest.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/vbltest/vbltest.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/vbltest/vbltest.…
==============================================================================
--- trunk/rostests/dibtests/vbltest/vbltest.rc (added)
+++ trunk/rostests/dibtests/vbltest/vbltest.rc [iso-8859-1] Mon Nov 17 09:05:02 2008
@@ -1,0 +1,4 @@
+100 BITMAP "test_inv01.bmp"
+400 BITMAP "test_inv04.bmp"
+800 BITMAP "test_inv08.bmp"
+2400 BITMAP "test_inv24.bmp"
Propchange: trunk/rostests/dibtests/vbltest/vbltest.rc
------------------------------------------------------------------------------
svn:eol-style = native