Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -696,6 +696,16 @@ |
697 | 697 | cmd.patternlevel = pattern->miplevel;
|
698 | 698 | }
|
699 | 699 | }
|
| 700 | + if (dwFlags & DDBLT_KEYSRCOVERRIDE)
|
| 701 | + {
|
| 702 | + if(!lpDDBltFx) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 703 | + if(dwFlags) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 704 | + }
|
| 705 | + if (dwFlags & DDBLT_KEYDESTOVERRIDE)
|
| 706 | + {
|
| 707 | + if (!lpDDBltFx) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 708 | + if (dwFlags) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 709 | + }
|
700 | 710 | if (dwFlags & DDBLT_KEYSRC)
|
701 | 711 | {
|
702 | 712 | if (!lpDDSrcSurface) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
— | — | @@ -704,6 +714,7 @@ |
705 | 715 | if (((glDirectDrawSurface7*)lpDDSrcSurface)->ddsd.ddckCKSrcBlt.dwColorSpaceHighValue !=
|
706 | 716 | ((glDirectDrawSurface7*)lpDDSrcSurface)->ddsd.ddckCKSrcBlt.dwColorSpaceLowValue)
|
707 | 717 | cmd.flags |= 0x20000000;
|
| 718 | + if(dwFlags & DDBLT_KEYSRCOVERRIDE) cmd.flags |= 0x20000000;
|
708 | 719 | }
|
709 | 720 | if (dwFlags & DDBLT_KEYDEST)
|
710 | 721 | {
|
— | — | @@ -710,6 +721,7 @@ |
711 | 722 | if (!(this->ddsd.dwFlags & DDSD_CKDESTBLT)) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
712 | 723 | if (this->ddsd.ddckCKDestBlt.dwColorSpaceHighValue != this->ddsd.ddckCKDestBlt.dwColorSpaceLowValue)
|
713 | 724 | cmd.flags |= 0x40000000;
|
| 725 | + if(dwFlags & DDBLT_KEYDESTOVERRIDE) cmd.flags |= 0x40000000;
|
714 | 726 | }
|
715 | 727 | glDirectDrawSurface7 *src = (glDirectDrawSurface7 *)lpDDSrcSurface;
|
716 | 728 | if (clipper)
|
Index: dxgltest/Tests2D.cpp |
— | — | @@ -127,7 +127,7 @@ |
128 | 128 | RunTestMouse2D(testnum,Msg,wParam,lParam);
|
129 | 129 | if(!fullscreen)
|
130 | 130 | {
|
131 | | - if ((testnum != 4) && (testnum != 10))
|
| 131 | + if ((testnum != 4) && (testnum != 10) && (testnum != 11))
|
132 | 132 | {
|
133 | 133 | p.x = 0;
|
134 | 134 | p.y = 0;
|
— | — | @@ -698,6 +698,7 @@ |
699 | 699 | counter = 0;
|
700 | 700 | break;
|
701 | 701 | case 10:
|
| 702 | + case 11:
|
702 | 703 | ddsrender->GetSurfaceDesc(&ddsd);
|
703 | 704 | sprites[0].ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
704 | 705 | sprites[0].ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
— | — | @@ -802,6 +803,7 @@ |
803 | 804 | }
|
804 | 805 | break;
|
805 | 806 | case 10: // Source Key Override test
|
| 807 | + case 11: // Destination Key Override Test
|
806 | 808 | if (backbuffers) ddsrender->GetAttachedSurface(&ddscaps, &temp1);
|
807 | 809 | else temp1 = ddsrender;
|
808 | 810 |
|
— | — | @@ -810,7 +812,8 @@ |
811 | 813 | switch (bpp)
|
812 | 814 | {
|
813 | 815 | case 8:
|
814 | | - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue = counter;
|
| 816 | + bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 817 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue = counter;
|
815 | 818 | counter++;
|
816 | 819 | if (counter > 255) counter = 0;
|
817 | 820 | r1.left = r1.top = 0;
|
— | — | @@ -821,31 +824,38 @@ |
822 | 825 | {
|
823 | 826 | case 0:
|
824 | 827 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 828 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
825 | 829 | (counter & 31) << 10;
|
826 | 830 | break;
|
827 | 831 | case 1:
|
828 | 832 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 833 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
829 | 834 | (counter & 31) << 5;
|
830 | 835 | break;
|
831 | 836 | case 2:
|
832 | 837 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 838 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
833 | 839 | (counter & 31);
|
834 | 840 | break;
|
835 | 841 | case 3:
|
836 | 842 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 843 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
837 | 844 | (counter & 31) + ((counter & 31) << 5);
|
838 | 845 | break;
|
839 | 846 | case 4:
|
840 | 847 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 848 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
841 | 849 | (counter & 31) + ((counter & 31) << 10);
|
842 | 850 | break;
|
843 | 851 | case 5:
|
844 | 852 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 853 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
845 | 854 | ((counter & 31) << 5) + ((counter & 31) << 10);
|
846 | 855 | break;
|
847 | 856 | case 6:
|
848 | 857 | default:
|
849 | 858 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 859 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
850 | 860 | (counter & 31) + ((counter & 31) << 5) + ((counter & 31) << 10);
|
851 | 861 | break;
|
852 | 862 | }
|
— | — | @@ -860,31 +870,38 @@ |
861 | 871 | {
|
862 | 872 | case 0:
|
863 | 873 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 874 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
864 | 875 | ((counter & 63) >> 1) << 11;
|
865 | 876 | break;
|
866 | 877 | case 1:
|
867 | 878 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 879 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
868 | 880 | (counter & 63) << 5;
|
869 | 881 | break;
|
870 | 882 | case 2:
|
871 | 883 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 884 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
872 | 885 | (counter & 63) >> 1;
|
873 | 886 | break;
|
874 | 887 | case 3:
|
875 | 888 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 889 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
876 | 890 | ((counter & 63) >> 1) + ((counter & 63) << 5);
|
877 | 891 | break;
|
878 | 892 | case 4:
|
879 | 893 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 894 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
880 | 895 | ((counter & 63) >> 1) + (((counter & 63) >> 1) << 11);
|
881 | 896 | break;
|
882 | 897 | case 5:
|
883 | 898 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 899 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
884 | 900 | ((counter & 63) << 5) + (((counter & 63) >> 1) << 11);
|
885 | 901 | break;
|
886 | 902 | case 6:
|
887 | 903 | default:
|
888 | 904 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 905 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
889 | 906 | ((counter & 63) >> 1) + ((counter & 63) << 5) + (((counter & 63) >> 1) << 11);
|
890 | 907 | break;
|
891 | 908 | }
|
— | — | @@ -901,31 +918,38 @@ |
902 | 919 | {
|
903 | 920 | case 0:
|
904 | 921 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 922 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
905 | 923 | (counter & 255) << 16;
|
906 | 924 | break;
|
907 | 925 | case 1:
|
908 | 926 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 927 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
909 | 928 | (counter & 255) << 8;
|
910 | 929 | break;
|
911 | 930 | case 2:
|
912 | 931 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 932 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
913 | 933 | counter & 255;
|
914 | 934 | break;
|
915 | 935 | case 3:
|
916 | 936 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 937 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
917 | 938 | (counter & 255) + ((counter & 255) << 8);
|
918 | 939 | break;
|
919 | 940 | case 4:
|
920 | 941 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 942 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
921 | 943 | (counter & 255) + ((counter & 255) << 16);
|
922 | 944 | break;
|
923 | 945 | case 5:
|
924 | 946 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 947 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
925 | 948 | ((counter & 255) << 8) + ((counter & 255) << 16);
|
926 | 949 | break;
|
927 | 950 | case 6:
|
928 | 951 | default:
|
929 | 952 | bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
|
| 953 | + bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
|
930 | 954 | (counter & 255) + ((counter & 255) << 8) + ((counter & 255) << 16);
|
931 | 955 | break;
|
932 | 956 | }
|
— | — | @@ -936,7 +960,10 @@ |
937 | 961 | r1.bottom = 7;
|
938 | 962 | break;
|
939 | 963 | }
|
940 | | - sprites[0].surface->Blt(NULL, sprites[2].surface, NULL, DDBLT_WAIT|DDBLT_KEYSRCOVERRIDE, &bltfx);
|
| 964 | + if (test == 10)
|
| 965 | + sprites[0].surface->Blt(NULL, sprites[2].surface, NULL, DDBLT_WAIT | DDBLT_KEYSRCOVERRIDE, &bltfx);
|
| 966 | + else
|
| 967 | + sprites[0].surface->Blt(NULL, sprites[2].surface, NULL, DDBLT_WAIT | DDBLT_KEYDESTOVERRIDE, &bltfx);
|
941 | 968 | temp1->GetDC(&hDCdest);
|
942 | 969 | sprites[0].surface->GetDC(&hDCsrc);
|
943 | 970 | if (ddver > 3) ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
— | — | @@ -947,7 +974,10 @@ |
948 | 975 | sprites[0].surface->ReleaseDC(hDCsrc);
|
949 | 976 | SetBkColor(hDCdest, RGB(0, 0, 255));
|
950 | 977 | SetTextColor(hDCdest, RGB(255, 255, 255));
|
951 | | - _tcscpy(message, _T("Source Color Key Override Test"));
|
| 978 | + if(test == 10)
|
| 979 | + _tcscpy(message, _T("Source Color Key Override Test"));
|
| 980 | + else
|
| 981 | + _tcscpy(message, _T("Destination Color Key Override Test"));
|
952 | 982 | TextOut(hDCdest, 0, 0, message, _tcslen(message));
|
953 | 983 | _stprintf(message, _T("Color: 0x%08X "), bltfx.ddckSrcColorkey.dwColorSpaceHighValue);
|
954 | 984 | TextOut(hDCdest, 0, 16, message, _tcslen(message));
|
Index: dxgltest/dxgltest.cpp |
— | — | @@ -231,7 +231,8 @@ |
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 | 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 | + {1, 7, 0, 1, true, 60.0, false, false, _T("Source Color Key Override test")},
|
| 236 | + {1, 7, 0, 1, true, 60.0, false, false, _T("Destination Color Key Override test")}
|
236 | 237 | };
|
237 | 238 | const int END_2D = __LINE__ - 4;
|
238 | 239 | const int numtests2d = END_2D - START_2D;
|