From 440964557848b63127cedeb0d2b06cfc14c4afaf Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Tue, 25 Nov 2008 16:50:25 +0000 Subject: [PATCH] - Enhance test with icon drawing - Tests some configurations of DrawIcon and DrawIconEx, highlighting another problem in 32bpp - Reference TransparentBlt and AlphaBlend directly svn path=/trunk/; revision=37640 --- rostests/dibtests/vbltest/test_inv32.ico | Bin 0 -> 22486 bytes rostests/dibtests/vbltest/vbltest.c | 53 ++++++++++++++++++++--- rostests/dibtests/vbltest/vbltest.rbuild | 3 +- rostests/dibtests/vbltest/vbltest.rc | 2 + 4 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 rostests/dibtests/vbltest/test_inv32.ico diff --git a/rostests/dibtests/vbltest/test_inv32.ico b/rostests/dibtests/vbltest/test_inv32.ico new file mode 100644 index 0000000000000000000000000000000000000000..2c32fdf002289cca3985489800a06f2224f4dc21 GIT binary patch literal 22486 zcmeI4yRXzn6o=1!ao-Ov+(beo+7J?jDnzd6u5OQn6j77PqR6A93DQ>7c?roKMG}!B z4M_PDD1vLKsE|NHkpdl3iph7zJASS0_3nCiy<%rM9?#4_<`dm4d0^^$KR2gt0LciDe@V0 zqC&ocRF8)4mW`szQgUyMk#4suL{OItyf!9ZGs)<74Of0PCZ~H_Uc7iAVHnE8hYuwP z0`Yxcu3o(=p6AKAbLZsRH6uUE6EXjU^61IG^5o@9`QeX05%#E4tq!12M3cyfN1jKX zr+MgA7N30T6`y>ce4l(33&;=1N3R6r2jmk;NPb9uNIuvkB;SxWq)lk6H7N9`+@m57 zAy4g6^JTQ1*@W5bUg24lW2L=xe9vCciFnD0_z~F(w1A~VG z4;&siJd49b=2;{@_xKMiK3J^DVDVAzqsXUHA1u}l6sn(nu=rrHZUKi64qw{<96mU# ztH9xd!3Tp626dee4j&9Y7(%t1t92oIq91ANUiA*B&>g^KU5)MlOaV#*6a-)j&>c{y z?H`~!K(}oUtDAiE2j~ybuT2!7KfpHu7y>W^^e=5Tyke~ z!G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xeNvn!p!7*gZ;?*N0!Iv*cYSNKbm}cZcE?SwLdMB vz8@%`g_}0r-cL?G>4{Z$<@&3nlCr#frg8hMO*MS4tSNa{&$Q!l2d4i4n>Z)0 literal 0 HcmV?d00001 diff --git a/rostests/dibtests/vbltest/vbltest.c b/rostests/dibtests/vbltest/vbltest.c index c56885e03ba..0e2bb25fe27 100644 --- a/rostests/dibtests/vbltest/vbltest.c +++ b/rostests/dibtests/vbltest/vbltest.c @@ -8,7 +8,18 @@ #include #include +BOOL WINAPI GdiAlphaBlend( + HDC hdcDst, int xDst, int yDst, int wDst, int hDst, + HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, + BLENDFUNCTION blendFunction); + +BOOL WINAPI GdiTransparentBlt( + HDC hdcDst, int xDst, int yDst, int wDst, int hDst, + HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, + UINT crTransparent); + #define CURRENT_BMPS 4 +#define CURRENT_ICONS 1 #define SCALE 1.5 #define OFFSET 5 @@ -19,6 +30,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static HBITMAP hbmList[CURRENT_BMPS]; + static HICON hicList[CURRENT_ICONS]; switch (message) { @@ -28,6 +40,7 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 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); + hicList[0] = (HICON)LoadIcon(hInst, MAKEINTRESOURCE(3200)); break; } @@ -38,7 +51,6 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) BITMAP bitmap; BLENDFUNCTION bfunc; int x = 0, y = 0, i; - hdc = BeginPaint(hWnd, &ps); hdcMem = CreateCompatibleDC(hdc); @@ -47,6 +59,7 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) bfunc.BlendOp = AC_SRC_OVER; bfunc.SourceConstantAlpha = 128; + /* bitmaps */ for(i = 0; i < CURRENT_BMPS; i++) { y = 0; @@ -66,19 +79,47 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 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); + GdiTransparentBlt(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); + GdiTransparentBlt(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); + GdiAlphaBlend(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); + GdiAlphaBlend(hdc, x, y, bitmap.bmWidth*SCALE, bitmap.bmHeight*SCALE, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, bfunc); + y += bitmap.bmHeight*SCALE + OFFSET; + + x += bitmap.bmWidth*SCALE + OFFSET; + } + + /* icons */ + for(i = 0; i < CURRENT_ICONS; i++) + { + y = 0; + /* pure icon */ + DrawIcon(hdc, x, y, hicList[i]); + y += bitmap.bmHeight + OFFSET; + + /* normal icon using Ex */ + DrawIconEx(hdc, x, y, hicList[i], 0, 0, 0, NULL, DI_NORMAL); + y += bitmap.bmHeight + OFFSET; + + /* normal icon using Ex with bigger size */ + DrawIconEx(hdc, x, y, hicList[i], bitmap.bmWidth, bitmap.bmHeight, 0, NULL, DI_NORMAL); + y += bitmap.bmHeight + OFFSET; + + /* only icon using Ex */ + DrawIconEx(hdc, x, y, hicList[i], 0, 0, 0, NULL, DI_IMAGE); + y += bitmap.bmHeight + OFFSET; + + /* mask using Ex */ + DrawIconEx(hdc, x, y, hicList[i], 0, 0, 0, NULL, DI_MASK); + y += bitmap.bmHeight + OFFSET; x += bitmap.bmWidth*SCALE + OFFSET; } diff --git a/rostests/dibtests/vbltest/vbltest.rbuild b/rostests/dibtests/vbltest/vbltest.rbuild index 4478b9712a2..5b8a0bb476d 100644 --- a/rostests/dibtests/vbltest/vbltest.rbuild +++ b/rostests/dibtests/vbltest/vbltest.rbuild @@ -2,9 +2,8 @@ . kernel32 - gdi32 user32 - msimg32 + gdi32 vbltest.c vbltest.rc \ No newline at end of file diff --git a/rostests/dibtests/vbltest/vbltest.rc b/rostests/dibtests/vbltest/vbltest.rc index a0da3010326..432bf1ce56b 100644 --- a/rostests/dibtests/vbltest/vbltest.rc +++ b/rostests/dibtests/vbltest/vbltest.rc @@ -2,3 +2,5 @@ 400 BITMAP "test_inv04.bmp" 800 BITMAP "test_inv08.bmp" 2400 BITMAP "test_inv24.bmp" +3200 ICON "test_inv32.ico" + -- 2.17.1