Index: dxgltest/Tests2D.cpp |
— | — | @@ -127,13 +127,16 @@ |
128 | 128 | RunTestMouse2D(testnum,Msg,wParam,lParam);
|
129 | 129 | if(!fullscreen)
|
130 | 130 | {
|
131 | | - p.x = 0;
|
132 | | - p.y = 0;
|
133 | | - ClientToScreen(hWnd,&p);
|
134 | | - GetClientRect(hWnd,&destrect);
|
135 | | - OffsetRect(&destrect,p.x,p.y);
|
136 | | - SetRect(&srcrect,0,0,width,height);
|
137 | | - if(ddsurface && ddsrender)error = ddsurface->Blt(&destrect,ddsrender,&srcrect,DDBLT_WAIT,NULL);
|
| 131 | + if ((testnum != 4) && (testnum != 10))
|
| 132 | + {
|
| 133 | + p.x = 0;
|
| 134 | + p.y = 0;
|
| 135 | + ClientToScreen(hWnd, &p);
|
| 136 | + GetClientRect(hWnd, &destrect);
|
| 137 | + OffsetRect(&destrect, p.x, p.y);
|
| 138 | + SetRect(&srcrect, 0, 0, width, height);
|
| 139 | + if (ddsurface && ddsrender)error = ddsurface->Blt(&destrect, ddsrender, &srcrect, DDBLT_WAIT, NULL);
|
| 140 | + }
|
138 | 141 | }
|
139 | 142 | break;
|
140 | 143 | default:
|
— | — | @@ -694,6 +697,46 @@ |
695 | 698 | ddinterface->CreateSurface(&sprites[0].ddsd, &sprites[0].surface, NULL);
|
696 | 699 | counter = 0;
|
697 | 700 | break;
|
| 701 | + case 10:
|
| 702 | + ddsrender->GetSurfaceDesc(&ddsd);
|
| 703 | + sprites[0].ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
| 704 | + sprites[0].ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
| 705 | + if (ddver > 3) sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
| 706 | + else sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC);
|
| 707 | + switch (bpp)
|
| 708 | + {
|
| 709 | + case 8:
|
| 710 | + sprites[0].width = sprites[0].height = 16;
|
| 711 | + break;
|
| 712 | + case 15:
|
| 713 | + sprites[0].width = 32;
|
| 714 | + sprites[0].height = 7;
|
| 715 | + break;
|
| 716 | + case 16:
|
| 717 | + sprites[0].width = 64;
|
| 718 | + sprites[0].height = 7;
|
| 719 | + break;
|
| 720 | + case 24:
|
| 721 | + case 32:
|
| 722 | + default:
|
| 723 | + sprites[0].width = 256;
|
| 724 | + sprites[0].height = 7;
|
| 725 | + break;
|
| 726 | + }
|
| 727 | + sprites[0].ddsd.dwWidth = sprites[0].width;
|
| 728 | + sprites[0].ddsd.dwHeight = sprites[0].height;
|
| 729 | + memcpy(&sprites[1], &sprites[0], sizeof(DDSPRITE));
|
| 730 | + memcpy(&sprites[2], &sprites[0], sizeof(DDSPRITE));
|
| 731 | + ddinterface->CreateSurface(&sprites[0].ddsd, &sprites[0].surface, NULL);
|
| 732 | + ddinterface->CreateSurface(&sprites[1].ddsd, &sprites[1].surface, NULL);
|
| 733 | + ddinterface->CreateSurface(&sprites[2].ddsd, &sprites[2].surface, NULL);
|
| 734 | + sprites[1].surface->Lock(NULL, &sprites[1].ddsd, DDLOCK_WAIT, NULL);
|
| 735 | + DrawColorKeyCompPatterns(sprites[1].ddsd, (unsigned char*)sprites[1].ddsd.lpSurface, bpp, 0);
|
| 736 | + sprites[1].surface->Unlock(NULL);
|
| 737 | + sprites[2].surface->Lock(NULL, &sprites[2].ddsd, DDLOCK_WAIT, NULL);
|
| 738 | + DrawColorKeyCompPatterns(sprites[2].ddsd, (unsigned char*)sprites[2].ddsd.lpSurface, bpp, 1);
|
| 739 | + sprites[2].surface->Unlock(NULL);
|
| 740 | + counter = 0;
|
698 | 741 | }
|
699 | 742 | }
|
700 | 743 |
|
— | — | @@ -700,8 +743,13 @@ |
701 | 744 | void RunTestTimed2D(int test)
|
702 | 745 | {
|
703 | 746 | if(stoptimer) return;
|
| 747 | + DDSURFACEDESC2 ddsd;
|
704 | 748 | DDSCAPS2 ddscaps;
|
705 | 749 | DDBLTFX bltfx;
|
| 750 | + HDC hDCdest, hDCsrc;
|
| 751 | + RECT r1, r2;
|
| 752 | + POINT p;
|
| 753 | + TCHAR message[256];
|
706 | 754 | bltfx.dwSize = sizeof(DDBLTFX);
|
707 | 755 | ZeroMemory(&ddscaps,sizeof(DDSCAPS2));
|
708 | 756 | ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
|
— | — | @@ -710,6 +758,7 @@ |
711 | 759 | {
|
712 | 760 | case 0: // Palette and gradients
|
713 | 761 | case 2: // GDI patterns
|
| 762 | + case 7: // ROP patterns
|
714 | 763 | default:
|
715 | 764 | if(fullscreen) ddsurface->Flip(NULL,DDFLIP_WAIT);
|
716 | 765 | break;
|
— | — | @@ -737,8 +786,189 @@ |
738 | 787 | if(backbuffers) temp1->Release();
|
739 | 788 | }
|
740 | 789 | }
|
741 | | - if(backbuffers && ddsrender) ddsrender->Flip(NULL,DDFLIP_WAIT);
|
| 790 | + if (fullscreen)
|
| 791 | + {
|
| 792 | + if (backbuffers && ddsrender) ddsrender->Flip(NULL, DDFLIP_WAIT);
|
| 793 | + }
|
| 794 | + else
|
| 795 | + {
|
| 796 | + p.x = 0;
|
| 797 | + p.y = 0;
|
| 798 | + ClientToScreen(hWnd, &p);
|
| 799 | + GetClientRect(hWnd, &r1);
|
| 800 | + OffsetRect(&r1, p.x, p.y);
|
| 801 | + SetRect(&r2, 0, 0, width, height);
|
| 802 | + if (ddsurface && ddsrender) ddsurface->Blt(&r1, ddsrender, &r2, DDBLT_WAIT, NULL);
|
| 803 | + }
|
742 | 804 | break;
|
| 805 | + case 10: // Source Key Override test
|
| 806 | + if (backbuffers) ddsrender->GetAttachedSurface(&ddscaps, &temp1);
|
| 807 | + else temp1 = ddsrender;
|
| 808 | +
|
| 809 | + sprites[0].surface->Blt(NULL, sprites[1].surface, NULL, DDBLT_WAIT, NULL);
|
| 810 | + bltfx.dwSize = sizeof(DDBLTFX);
|
| 811 | + switch (bpp)
|
| 812 | + {
|
| 813 | + case 8:
|
| 814 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue = counter;
|
| 815 | + counter++;
|
| 816 | + if (counter > 255) counter = 0;
|
| 817 | + r1.left = r1.top = 0;
|
| 818 | + r1.right = r1.bottom = 16;
|
| 819 | + break;
|
| 820 | + case 15:
|
| 821 | + switch (counter >> 5)
|
| 822 | + {
|
| 823 | + case 0:
|
| 824 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 825 | + (counter & 31) << 10;
|
| 826 | + break;
|
| 827 | + case 1:
|
| 828 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 829 | + (counter & 31) << 5;
|
| 830 | + break;
|
| 831 | + case 2:
|
| 832 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 833 | + (counter & 31);
|
| 834 | + break;
|
| 835 | + case 3:
|
| 836 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 837 | + (counter & 31) + ((counter & 31) << 5);
|
| 838 | + break;
|
| 839 | + case 4:
|
| 840 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 841 | + (counter & 31) + ((counter & 31) << 10);
|
| 842 | + break;
|
| 843 | + case 5:
|
| 844 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 845 | + ((counter & 31) << 5) + ((counter & 31) << 10);
|
| 846 | + break;
|
| 847 | + case 6:
|
| 848 | + default:
|
| 849 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 850 | + (counter & 31) + ((counter & 31) << 5) + ((counter & 31) << 10);
|
| 851 | + break;
|
| 852 | + }
|
| 853 | + counter++;
|
| 854 | + if (counter > 223) counter = 0;
|
| 855 | + r1.left = r1.top = 0;
|
| 856 | + r1.right = 32;
|
| 857 | + r1.bottom = 7;
|
| 858 | + break;
|
| 859 | + case 16:
|
| 860 | + switch (counter >> 6)
|
| 861 | + {
|
| 862 | + case 0:
|
| 863 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 864 | + ((counter & 63) >> 1) << 11;
|
| 865 | + break;
|
| 866 | + case 1:
|
| 867 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 868 | + (counter & 63) << 5;
|
| 869 | + break;
|
| 870 | + case 2:
|
| 871 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 872 | + (counter & 63) >> 1;
|
| 873 | + break;
|
| 874 | + case 3:
|
| 875 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 876 | + ((counter & 63) >> 1) + ((counter & 63) << 5);
|
| 877 | + break;
|
| 878 | + case 4:
|
| 879 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 880 | + ((counter & 63) >> 1) + (((counter & 63) >> 1) << 11);
|
| 881 | + break;
|
| 882 | + case 5:
|
| 883 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 884 | + ((counter & 63) << 5) + (((counter & 63) >> 1) << 11);
|
| 885 | + break;
|
| 886 | + case 6:
|
| 887 | + default:
|
| 888 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 889 | + ((counter & 63) >> 1) + ((counter & 63) << 5) + (((counter & 63) >> 1) << 11);
|
| 890 | + break;
|
| 891 | + }
|
| 892 | + counter++;
|
| 893 | + if (counter > 447) counter = 0;
|
| 894 | + r1.left = r1.top = 0;
|
| 895 | + r1.right = 64;
|
| 896 | + r1.bottom = 7;
|
| 897 | + break;
|
| 898 | + case 24:
|
| 899 | + case 32:
|
| 900 | + default:
|
| 901 | + switch (counter >> 8)
|
| 902 | + {
|
| 903 | + case 0:
|
| 904 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 905 | + (counter & 255) << 16;
|
| 906 | + break;
|
| 907 | + case 1:
|
| 908 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 909 | + (counter & 255) << 8;
|
| 910 | + break;
|
| 911 | + case 2:
|
| 912 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 913 | + counter & 255;
|
| 914 | + break;
|
| 915 | + case 3:
|
| 916 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 917 | + (counter & 255) + ((counter & 255) << 8);
|
| 918 | + break;
|
| 919 | + case 4:
|
| 920 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 921 | + (counter & 255) + ((counter & 255) << 16);
|
| 922 | + break;
|
| 923 | + case 5:
|
| 924 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 925 | + ((counter & 255) << 8) + ((counter & 255) << 16);
|
| 926 | + break;
|
| 927 | + case 6:
|
| 928 | + default:
|
| 929 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 930 | + (counter & 255) + ((counter & 255) << 8) + ((counter & 255) << 16);
|
| 931 | + break;
|
| 932 | + }
|
| 933 | + counter++;
|
| 934 | + if (counter > 1791) counter = 0;
|
| 935 | + r1.left = r1.top = 0;
|
| 936 | + r1.right = 256;
|
| 937 | + r1.bottom = 7;
|
| 938 | + break;
|
| 939 | + }
|
| 940 | + //sprites[0].surface->Blt(NULL, sprites[2].surface, NULL, DDBLT_WAIT|DDBLT_KEYSRCOVERRIDE, &bltfx);
|
| 941 | + sprites[0].surface->Blt(NULL, sprites[2].surface, NULL, DDBLT_WAIT, NULL);
|
| 942 | + temp1->GetDC(&hDCdest);
|
| 943 | + sprites[0].surface->GetDC(&hDCsrc);
|
| 944 | + if (ddver > 3) ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
| 945 | + else ddsd.dwSize = sizeof(DDSURFACEDESC);
|
| 946 | + temp1->GetSurfaceDesc(&ddsd);
|
| 947 | + StretchBlt(hDCdest, ((ddsd.dwWidth / 2) - 128), ((ddsd.dwHeight / 2) - 128), 256, 256,
|
| 948 | + hDCsrc, 0, 0, r1.right, r1.bottom, SRCCOPY);
|
| 949 | + sprites[0].surface->ReleaseDC(hDCsrc);
|
| 950 | + SetBkColor(hDCdest, RGB(0, 0, 255));
|
| 951 | + SetTextColor(hDCdest, RGB(255, 255, 255));
|
| 952 | + _tcscpy(message, _T("Source Color Key Override Test"));
|
| 953 | + TextOut(hDCdest, 0, 0, message, _tcslen(message));
|
| 954 | + _stprintf(message, _T("Color: 0x%08X"), bltfx.ddckSrcColorkey.dwColorSpaceHighValue);
|
| 955 | + TextOut(hDCdest, 0, 16, message, _tcslen(message));
|
| 956 | + temp1->ReleaseDC(hDCdest);
|
| 957 | + if (backbuffers) temp1->Release();
|
| 958 | + if (fullscreen)
|
| 959 | + {
|
| 960 | + if (backbuffers && ddsrender) ddsrender->Flip(NULL, DDFLIP_WAIT);
|
| 961 | + }
|
| 962 | + else
|
| 963 | + {
|
| 964 | + p.x = 0;
|
| 965 | + p.y = 0;
|
| 966 | + ClientToScreen(hWnd, &p);
|
| 967 | + GetClientRect(hWnd, &r1);
|
| 968 | + OffsetRect(&r1, p.x, p.y);
|
| 969 | + SetRect(&r2, 0, 0, width, height);
|
| 970 | + if (ddsurface && ddsrender) ddsurface->Blt(&r1, ddsrender, &r2, DDBLT_WAIT, NULL);
|
| 971 | + }
|
| 972 | + break;
|
743 | 973 | }
|
744 | 974 | }
|
745 | 975 |
|
Index: dxgltest/dxgltest.cpp |
— | — | @@ -230,7 +230,8 @@ |
231 | 231 | {1, 7, 0, 0, false, 0.0, false, false, _T("Mouse pointer event test")},
|
232 | 232 | {1, 7, 1, 1, true, 1.0, false, false, _T("Raster Operation Blt() test")},
|
233 | 233 | {1, 7, 0, 0, false, 0.0, false, false, _T("Mirrored and Rotated Blt() test")},
|
234 | | - {1, 7, 0, 1, false, 0.0, false, false, _T("Large batch color fill Blt() operations")}
|
| 234 | + {1, 7, 0, 1, false, 0.0, false, false, _T("Large batch color fill Blt() operations")},
|
| 235 | + {1, 7, 0, 1, true, 60.0, false, false, _T("Source Color Key Override test")}
|
235 | 236 | };
|
236 | 237 | const int END_2D = __LINE__ - 4;
|
237 | 238 | const int numtests2d = END_2D - START_2D;
|
Index: dxgltest/surfacegen.cpp |
— | — | @@ -1202,83 +1202,405 @@ |
1203 | 1203 |
|
1204 | 1204 | void DrawRotatedBlt(MultiDirectDrawSurface *primary, DDSPRITE *sprites)
|
1205 | 1205 | {
|
1206 | | - HDC hdc;
|
1207 | | - DDBLTFX bltfx;
|
1208 | | - ZeroMemory(&bltfx, sizeof(DDBLTFX));
|
1209 | | - bltfx.dwSize = sizeof(DDBLTFX);
|
1210 | | - sprites[0].surface->GetDC(&hdc);
|
1211 | | - DrawBitmap(hdc, 0, 0, 64, 64, MAKEINTRESOURCE(IDB_DXGLINV64), SRCCOPY);
|
1212 | | - sprites[0].surface->ReleaseDC(hdc);
|
1213 | | - RECT r;
|
1214 | | - r.left = 0;
|
1215 | | - r.right = 64;
|
1216 | | - r.top = 0;
|
1217 | | - r.bottom = 64;
|
1218 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1219 | | - r.left = 64;
|
1220 | | - r.right = 128;
|
1221 | | - bltfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT;
|
1222 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1223 | | - r.left = 128;
|
1224 | | - r.right = 192;
|
1225 | | - bltfx.dwDDFX = DDBLTFX_MIRRORUPDOWN;
|
1226 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1227 | | - r.left = 192;
|
1228 | | - r.right = 256;
|
1229 | | - bltfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
|
1230 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1231 | | - r.top = 64;
|
1232 | | - r.bottom = 128;
|
1233 | | - r.left = 0;
|
1234 | | - r.right = 64;
|
1235 | | - bltfx.dwDDFX = DDBLTFX_ROTATE90;
|
1236 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1237 | | - r.left = 64;
|
1238 | | - r.right = 128;
|
1239 | | - bltfx.dwDDFX = DDBLTFX_ROTATE90 | DDBLTFX_MIRRORLEFTRIGHT;
|
1240 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1241 | | - r.left = 128;
|
1242 | | - r.right = 192;
|
1243 | | - bltfx.dwDDFX = DDBLTFX_ROTATE90 | DDBLTFX_MIRRORUPDOWN;
|
1244 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1245 | | - r.left = 192;
|
1246 | | - r.right = 256;
|
1247 | | - bltfx.dwDDFX = DDBLTFX_ROTATE90 | DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
|
1248 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1249 | | - r.top = 128;
|
1250 | | - r.bottom = 192;
|
1251 | | - r.left = 0;
|
1252 | | - r.right = 64;
|
1253 | | - bltfx.dwDDFX = DDBLTFX_ROTATE180;
|
1254 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1255 | | - r.left = 64;
|
1256 | | - r.right = 128;
|
1257 | | - bltfx.dwDDFX = DDBLTFX_ROTATE180 | DDBLTFX_MIRRORLEFTRIGHT;
|
1258 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1259 | | - r.left = 128;
|
1260 | | - r.right = 192;
|
1261 | | - bltfx.dwDDFX = DDBLTFX_ROTATE180 | DDBLTFX_MIRRORUPDOWN;
|
1262 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1263 | | - r.left = 192;
|
1264 | | - r.right = 256;
|
1265 | | - bltfx.dwDDFX = DDBLTFX_ROTATE180 | DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
|
1266 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1267 | | - r.top = 192;
|
1268 | | - r.bottom = 256;
|
1269 | | - r.left = 0;
|
1270 | | - r.right = 64;
|
1271 | | - bltfx.dwDDFX = DDBLTFX_ROTATE270;
|
1272 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1273 | | - r.left = 64;
|
1274 | | - r.right = 128;
|
1275 | | - bltfx.dwDDFX = DDBLTFX_ROTATE270 | DDBLTFX_MIRRORLEFTRIGHT;
|
1276 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1277 | | - r.left = 128;
|
1278 | | - r.right = 192;
|
1279 | | - bltfx.dwDDFX = DDBLTFX_ROTATE270 | DDBLTFX_MIRRORUPDOWN;
|
1280 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
1281 | | - r.left = 192;
|
1282 | | - r.right = 256;
|
1283 | | - bltfx.dwDDFX = DDBLTFX_ROTATE270 | DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
|
1284 | | - primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1206 | +HDC hdc;
|
| 1207 | +DDBLTFX bltfx;
|
| 1208 | +ZeroMemory(&bltfx, sizeof(DDBLTFX));
|
| 1209 | +bltfx.dwSize = sizeof(DDBLTFX);
|
| 1210 | +sprites[0].surface->GetDC(&hdc);
|
| 1211 | +DrawBitmap(hdc, 0, 0, 64, 64, MAKEINTRESOURCE(IDB_DXGLINV64), SRCCOPY);
|
| 1212 | +sprites[0].surface->ReleaseDC(hdc);
|
| 1213 | +RECT r;
|
| 1214 | +r.left = 0;
|
| 1215 | +r.right = 64;
|
| 1216 | +r.top = 0;
|
| 1217 | +r.bottom = 64;
|
| 1218 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1219 | +r.left = 64;
|
| 1220 | +r.right = 128;
|
| 1221 | +bltfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT;
|
| 1222 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1223 | +r.left = 128;
|
| 1224 | +r.right = 192;
|
| 1225 | +bltfx.dwDDFX = DDBLTFX_MIRRORUPDOWN;
|
| 1226 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1227 | +r.left = 192;
|
| 1228 | +r.right = 256;
|
| 1229 | +bltfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
|
| 1230 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1231 | +r.top = 64;
|
| 1232 | +r.bottom = 128;
|
| 1233 | +r.left = 0;
|
| 1234 | +r.right = 64;
|
| 1235 | +bltfx.dwDDFX = DDBLTFX_ROTATE90;
|
| 1236 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1237 | +r.left = 64;
|
| 1238 | +r.right = 128;
|
| 1239 | +bltfx.dwDDFX = DDBLTFX_ROTATE90 | DDBLTFX_MIRRORLEFTRIGHT;
|
| 1240 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1241 | +r.left = 128;
|
| 1242 | +r.right = 192;
|
| 1243 | +bltfx.dwDDFX = DDBLTFX_ROTATE90 | DDBLTFX_MIRRORUPDOWN;
|
| 1244 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1245 | +r.left = 192;
|
| 1246 | +r.right = 256;
|
| 1247 | +bltfx.dwDDFX = DDBLTFX_ROTATE90 | DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
|
| 1248 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1249 | +r.top = 128;
|
| 1250 | +r.bottom = 192;
|
| 1251 | +r.left = 0;
|
| 1252 | +r.right = 64;
|
| 1253 | +bltfx.dwDDFX = DDBLTFX_ROTATE180;
|
| 1254 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1255 | +r.left = 64;
|
| 1256 | +r.right = 128;
|
| 1257 | +bltfx.dwDDFX = DDBLTFX_ROTATE180 | DDBLTFX_MIRRORLEFTRIGHT;
|
| 1258 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1259 | +r.left = 128;
|
| 1260 | +r.right = 192;
|
| 1261 | +bltfx.dwDDFX = DDBLTFX_ROTATE180 | DDBLTFX_MIRRORUPDOWN;
|
| 1262 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1263 | +r.left = 192;
|
| 1264 | +r.right = 256;
|
| 1265 | +bltfx.dwDDFX = DDBLTFX_ROTATE180 | DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
|
| 1266 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1267 | +r.top = 192;
|
| 1268 | +r.bottom = 256;
|
| 1269 | +r.left = 0;
|
| 1270 | +r.right = 64;
|
| 1271 | +bltfx.dwDDFX = DDBLTFX_ROTATE270;
|
| 1272 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1273 | +r.left = 64;
|
| 1274 | +r.right = 128;
|
| 1275 | +bltfx.dwDDFX = DDBLTFX_ROTATE270 | DDBLTFX_MIRRORLEFTRIGHT;
|
| 1276 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1277 | +r.left = 128;
|
| 1278 | +r.right = 192;
|
| 1279 | +bltfx.dwDDFX = DDBLTFX_ROTATE270 | DDBLTFX_MIRRORUPDOWN;
|
| 1280 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1281 | +r.left = 192;
|
| 1282 | +r.right = 256;
|
| 1283 | +bltfx.dwDDFX = DDBLTFX_ROTATE270 | DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
|
| 1284 | +primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
|
| 1285 | +}
|
| 1286 | +
|
| 1287 | +void DrawColorKeyCompPatterns(DDSURFACEDESC2 ddsd, unsigned char *buffer, int bpp, int index)
|
| 1288 | +{
|
| 1289 | + int x, y;
|
| 1290 | + DWORD i;
|
| 1291 | + if (!index)
|
| 1292 | + {
|
| 1293 | + switch (bpp)
|
| 1294 | + {
|
| 1295 | + case 8:
|
| 1296 | + for (int y = 0; y < 16; y++)
|
| 1297 | + {
|
| 1298 | + for (int x = 0; x < 16; x++)
|
| 1299 | + {
|
| 1300 | + i = x + (y << 4);
|
| 1301 | + buffer[x + (ddsd.lPitch*y)] = i;
|
| 1302 | + }
|
| 1303 | + }
|
| 1304 | + break;
|
| 1305 | + for (int y = 1; y < 8; y++)
|
| 1306 | + {
|
| 1307 | + for (int x = 0; x < 32; x++)
|
| 1308 | + {
|
| 1309 | + switch (y)
|
| 1310 | + {
|
| 1311 | + case 1:
|
| 1312 | + i = x << 10;
|
| 1313 | + break;
|
| 1314 | + case 2:
|
| 1315 | + i = x << 5;
|
| 1316 | + break;
|
| 1317 | + case 3:
|
| 1318 | + i = x;
|
| 1319 | + break;
|
| 1320 | + case 4:
|
| 1321 | + i = x + (x << 5);
|
| 1322 | + break;
|
| 1323 | + case 5:
|
| 1324 | + i = x + (x << 10);
|
| 1325 | + break;
|
| 1326 | + case 6:
|
| 1327 | + i = (x << 5) + (x << 10);
|
| 1328 | + break;
|
| 1329 | + case 7:
|
| 1330 | + default:
|
| 1331 | + i = x + (x << 5) + (x << 10);
|
| 1332 | + break;
|
| 1333 | + }
|
| 1334 | + buffer[(x * 2) + (ddsd.lPitch*(y - 1))] = i;
|
| 1335 | + }
|
| 1336 | + }
|
| 1337 | + break;
|
| 1338 | + case 16:
|
| 1339 | + for (int y = 1; y < 8; y++)
|
| 1340 | + {
|
| 1341 | + for (int x = 0; x < 64; x++)
|
| 1342 | + {
|
| 1343 | + switch (y)
|
| 1344 | + {
|
| 1345 | + case 1:
|
| 1346 | + i = (x >> 1) << 11;
|
| 1347 | + break;
|
| 1348 | + case 2:
|
| 1349 | + i = x << 5;
|
| 1350 | + break;
|
| 1351 | + case 3:
|
| 1352 | + i = x >> 1;
|
| 1353 | + break;
|
| 1354 | + case 4:
|
| 1355 | + i = (x >> 1) + (x << 5);
|
| 1356 | + break;
|
| 1357 | + case 5:
|
| 1358 | + i = (x >> 1) + ((x >> 1) << 11);
|
| 1359 | + break;
|
| 1360 | + case 6:
|
| 1361 | + i = (x << 5) + ((x >> 1) << 11);
|
| 1362 | + break;
|
| 1363 | + case 7:
|
| 1364 | + default:
|
| 1365 | + i = (x >> 1) + (x << 5) + ((x >> 1) << 11);
|
| 1366 | + break;
|
| 1367 | + }
|
| 1368 | + buffer[(x * 2) + (ddsd.lPitch*(y - 1))] = (char)i;
|
| 1369 | + buffer[((x * 2) + (ddsd.lPitch*(y - 1))) + 1] = (char)i >> 8;
|
| 1370 | + }
|
| 1371 | + }
|
| 1372 | + break;
|
| 1373 | + case 24:
|
| 1374 | + for (int y = 1; y < 8; y++)
|
| 1375 | + {
|
| 1376 | + for (int x = 0; x < 256; x++)
|
| 1377 | + {
|
| 1378 | + switch (y)
|
| 1379 | + {
|
| 1380 | + case 1:
|
| 1381 | + i = x << 16;
|
| 1382 | + break;
|
| 1383 | + case 2:
|
| 1384 | + i = x << 8;
|
| 1385 | + break;
|
| 1386 | + case 3:
|
| 1387 | + i = x;
|
| 1388 | + break;
|
| 1389 | + case 4:
|
| 1390 | + i = x + (x << 8);
|
| 1391 | + break;
|
| 1392 | + case 5:
|
| 1393 | + i = x + (x << 16);
|
| 1394 | + break;
|
| 1395 | + case 6:
|
| 1396 | + i = (x << 8) + (x << 16);
|
| 1397 | + break;
|
| 1398 | + case 7:
|
| 1399 | + default:
|
| 1400 | + i = x + (x << 8) + (x << 16);
|
| 1401 | + break;
|
| 1402 | + }
|
| 1403 | + buffer[(x * 3) + (ddsd.lPitch*(y - 1))] = (char)i;
|
| 1404 | + buffer[((x * 3) + (ddsd.lPitch*(y - 1))) + 1] = (char)i >> 8;
|
| 1405 | + buffer[((x * 3) + (ddsd.lPitch*(y - 1))) + 2] = (char)i >> 16;
|
| 1406 | + }
|
| 1407 | + }
|
| 1408 | + break;
|
| 1409 | + case 32:
|
| 1410 | + default:
|
| 1411 | + for (int y = 1; y < 8; y++)
|
| 1412 | + {
|
| 1413 | + for (int x = 0; x < 256; x++)
|
| 1414 | + {
|
| 1415 | + switch (y)
|
| 1416 | + {
|
| 1417 | + case 1:
|
| 1418 | + i = x << 16;
|
| 1419 | + break;
|
| 1420 | + case 2:
|
| 1421 | + i = x << 8;
|
| 1422 | + break;
|
| 1423 | + case 3:
|
| 1424 | + i = x;
|
| 1425 | + break;
|
| 1426 | + case 4:
|
| 1427 | + i = x + (x << 8);
|
| 1428 | + break;
|
| 1429 | + case 5:
|
| 1430 | + i = x + (x << 16);
|
| 1431 | + break;
|
| 1432 | + case 6:
|
| 1433 | + i = (x << 8) + (x << 16);
|
| 1434 | + break;
|
| 1435 | + case 7:
|
| 1436 | + default:
|
| 1437 | + i = x + (x << 8) + (x << 16);
|
| 1438 | + break;
|
| 1439 | + }
|
| 1440 | + buffer[(x * 4) + (ddsd.lPitch*(y - 1))] = (char)i;
|
| 1441 | + buffer[((x * 4) + (ddsd.lPitch*(y - 1))) + 1] = (char)i >> 8;
|
| 1442 | + buffer[((x * 4) + (ddsd.lPitch*(y - 1))) + 2] = (char)i >> 16;
|
| 1443 | + buffer[((x * 4) + (ddsd.lPitch*(y - 1))) + 3] = 0;
|
| 1444 | + }
|
| 1445 | + }
|
| 1446 | + break;
|
| 1447 | + }
|
| 1448 | + }
|
| 1449 | + else
|
| 1450 | + {
|
| 1451 | + switch (bpp)
|
| 1452 | + {
|
| 1453 | + case 8:
|
| 1454 | + for (int y = 0; y < 16; y++)
|
| 1455 | + {
|
| 1456 | + for (int x = 0; x < 16; x++)
|
| 1457 | + {
|
| 1458 | + i = ((x + (y << 4)) + 128) & 255;
|
| 1459 | + buffer[x + (ddsd.lPitch*y)] = i;
|
| 1460 | + }
|
| 1461 | + }
|
| 1462 | + break;
|
| 1463 | + case 15:
|
| 1464 | + for (int y = 1; y < 8; y++)
|
| 1465 | + {
|
| 1466 | + for (int x = 0; x < 32; x++)
|
| 1467 | + {
|
| 1468 | + switch (y)
|
| 1469 | + {
|
| 1470 | + case 7:
|
| 1471 | + i = (32 - x) << 10;
|
| 1472 | + break;
|
| 1473 | + case 6:
|
| 1474 | + i = (32 - x) << 5;
|
| 1475 | + break;
|
| 1476 | + case 5:
|
| 1477 | + i = (32 - x);
|
| 1478 | + break;
|
| 1479 | + case 4:
|
| 1480 | + i = x + ((32 - x) << 5);
|
| 1481 | + break;
|
| 1482 | + case 3:
|
| 1483 | + i = x + ((32 - x) << 10);
|
| 1484 | + break;
|
| 1485 | + case 2:
|
| 1486 | + i = ((32 - x) << 5) + ((32 - x) << 10);
|
| 1487 | + break;
|
| 1488 | + case 1:
|
| 1489 | + default:
|
| 1490 | + i = (32 - x) + ((32 - x) << 5) + ((32 - x) << 10);
|
| 1491 | + break;
|
| 1492 | + }
|
| 1493 | + buffer[(x * 2) + (ddsd.lPitch*(y - 1))] = i;
|
| 1494 | + }
|
| 1495 | + }
|
| 1496 | + break;
|
| 1497 | + case 16:
|
| 1498 | + for (int y = 1; y < 8; y++)
|
| 1499 | + {
|
| 1500 | + for (int x = 0; x < 64; x++)
|
| 1501 | + {
|
| 1502 | + switch (y)
|
| 1503 | + {
|
| 1504 | + case 7:
|
| 1505 | + i = ((64 - x) >> 1) << 11;
|
| 1506 | + break;
|
| 1507 | + case 6:
|
| 1508 | + i = (64 - x) << 5;
|
| 1509 | + break;
|
| 1510 | + case 5:
|
| 1511 | + i = (64 - x) >> 1;
|
| 1512 | + break;
|
| 1513 | + case 4:
|
| 1514 | + i = ((64 - x) >> 1) + ((64 - x) << 5);
|
| 1515 | + break;
|
| 1516 | + case 3:
|
| 1517 | + i = ((64 - x) >> 1) + (((64 - x) >> 1) << 11);
|
| 1518 | + break;
|
| 1519 | + case 2:
|
| 1520 | + i = ((64 - x) << 5) + (((64 - x) >> 1) << 11);
|
| 1521 | + break;
|
| 1522 | + case 1:
|
| 1523 | + default:
|
| 1524 | + i = ((64 - x) >> 1) + ((64 - x) << 5) + (((64 - x) >> 1) << 11);
|
| 1525 | + break;
|
| 1526 | + }
|
| 1527 | + buffer[(x * 2) + (ddsd.lPitch*(y - 1))] = i;
|
| 1528 | + }
|
| 1529 | + }
|
| 1530 | + break;
|
| 1531 | + case 24:
|
| 1532 | + for (int y = 1; y < 8; y++)
|
| 1533 | + {
|
| 1534 | + for (int x = 0; x < 256; x++)
|
| 1535 | + {
|
| 1536 | + switch (y)
|
| 1537 | + {
|
| 1538 | + case 7:
|
| 1539 | + i = (256 - x) << 16;
|
| 1540 | + break;
|
| 1541 | + case 6:
|
| 1542 | + i = (256 - x) << 8;
|
| 1543 | + break;
|
| 1544 | + case 5:
|
| 1545 | + i = (256 - x);
|
| 1546 | + break;
|
| 1547 | + case 4:
|
| 1548 | + i = (256 - x) + ((256 - x) << 8);
|
| 1549 | + break;
|
| 1550 | + case 3:
|
| 1551 | + i = (256 - x) + ((256 - x) << 16);
|
| 1552 | + break;
|
| 1553 | + case 2:
|
| 1554 | + i = ((256 - x) << 8) + ((256 - x) << 16);
|
| 1555 | + break;
|
| 1556 | + case 1:
|
| 1557 | + default:
|
| 1558 | + i = (256 - x) + ((256 - x) << 8) + ((256 - x) << 16);
|
| 1559 | + break;
|
| 1560 | + }
|
| 1561 | + buffer[(x * 3) + (ddsd.lPitch*(y - 1))] = (char)i;
|
| 1562 | + buffer[((x * 3) + (ddsd.lPitch*(y - 1))) + 1] = (char)i >> 8;
|
| 1563 | + buffer[((x * 3) + (ddsd.lPitch*(y - 1))) + 2] = (char)i >> 16;
|
| 1564 | + }
|
| 1565 | + }
|
| 1566 | + break;
|
| 1567 | + case 32:
|
| 1568 | + default:
|
| 1569 | + for (int y = 1; y < 8; y++)
|
| 1570 | + {
|
| 1571 | + for (int x = 0; x < 256; x++)
|
| 1572 | + {
|
| 1573 | + switch (y)
|
| 1574 | + {
|
| 1575 | + case 7:
|
| 1576 | + i = (256 - x) << 16;
|
| 1577 | + break;
|
| 1578 | + case 6:
|
| 1579 | + i = (256 - x) << 8;
|
| 1580 | + break;
|
| 1581 | + case 5:
|
| 1582 | + i = (256 - x);
|
| 1583 | + break;
|
| 1584 | + case 4:
|
| 1585 | + i = (256 - x) + ((256 - x) << 8);
|
| 1586 | + break;
|
| 1587 | + case 3:
|
| 1588 | + i = (256 - x) + ((256 - x) << 16);
|
| 1589 | + break;
|
| 1590 | + case 2:
|
| 1591 | + i = ((256 - x) << 8) + ((256 - x) << 16);
|
| 1592 | + break;
|
| 1593 | + case 1:
|
| 1594 | + default:
|
| 1595 | + i = (256 - x) + ((256 - x) << 8) + ((256 - x) << 16);
|
| 1596 | + break;
|
| 1597 | + }
|
| 1598 | + buffer[(x * 4) + (ddsd.lPitch*(y - 1))] = (char)i;
|
| 1599 | + buffer[((x * 4) + (ddsd.lPitch*(y - 1))) + 1] = (char)i >> 8;
|
| 1600 | + buffer[((x * 4) + (ddsd.lPitch*(y - 1))) + 2] = (char)i >> 16;
|
| 1601 | + buffer[((x * 4) + (ddsd.lPitch*(y - 1))) + 3] = 0;
|
| 1602 | + }
|
| 1603 | + }
|
| 1604 | + break;
|
| 1605 | + }
|
| 1606 | + }
|
1285 | 1607 | } |
\ No newline at end of file |
Index: dxgltest/surfacegen.h |
— | — | @@ -26,5 +26,6 @@ |
27 | 27 | void DrawROPPatterns(MultiDirectDrawSurface *primary, DDSPRITE *sprites, int backbuffers, int ddver, int bpp, DWORD *ropcaps,
|
28 | 28 | HWND hwnd, LPDIRECTDRAWPALETTE palette); // ROP pattern test
|
29 | 29 | void DrawRotatedBlt(MultiDirectDrawSurface *primary, DDSPRITE *sprites);
|
| 30 | +void DrawColorKeyCompPatterns(DDSURFACEDESC2 ddsd, unsigned char *buffer, int bpp, int index);
|
30 | 31 |
|
31 | 32 | #endif //_SURFACEGEN_H |
\ No newline at end of file |