717{
725 int bitmap_type;
728
729 DPRINT(
"Entered GreGetDIBitsInternal()\n");
730
732 return 0;
733
736 {
737 ScanLines = 0;
738 goto done;
739 }
740
741
744 {
745 ScanLines = 0;
746 goto done;
747 }
748
750 rgbQuads = colorPtr;
751
755 &planes,
759 if(bitmap_type == -1)
760 {
761 DPRINT1(
"Wrong bitmap format\n");
763 ScanLines = 0;
764 goto done;
765 }
766 else if(bitmap_type == 0)
767 {
768
769
771
775 {
776 DPRINT1(
"Error, could not convert the BITMAPCOREINFO!\n");
777 ScanLines = 0;
778 goto done;
779 }
780 rgbQuads =
Info->bmiColors;
781 }
782
783
784
785
786
787 if (
width < 0 || (
bpp == 0 && Bits))
788 {
789 ScanLines = 0;
790 goto done;
791 }
792
794 {
796 {
797 ScanLines = 0;
798 goto done;
799 }
800 }
801
802 Info->bmiHeader.biClrUsed = 0;
803 Info->bmiHeader.biClrImportant = 0;
804
805
807 {
808 case 0:
813 Info->bmiHeader.biPlanes = 1;
816 Info->bmiHeader.biHeight,
817 Info->bmiHeader.biBitCount);
818 Info->bmiHeader.biCompression = (
Info->bmiHeader.biBitCount == 16 ||
Info->bmiHeader.biBitCount == 32) ?
820 Info->bmiHeader.biXPelsPerMeter = 0;
821 Info->bmiHeader.biYPelsPerMeter = 0;
822
823 if (
Info->bmiHeader.biBitCount <= 8 &&
Info->bmiHeader.biClrUsed == 0)
824 Info->bmiHeader.biClrUsed = 1 <<
Info->bmiHeader.biBitCount;
825
826 ScanLines = 1;
827 goto done;
828
829 case 1:
830 case 4:
831 case 8:
832 Info->bmiHeader.biClrUsed = 1 <<
bpp;
833
834
835
838 {
840 {
842 if(colors != 256)
Info->bmiHeader.biClrUsed = colors;
843 for(
i = 0;
i < colors;
i++)
844 {
845 rgbQuads[
i].rgbRed = psurf->
ppal->IndexedColors[
i].peRed;
846 rgbQuads[
i].rgbGreen = psurf->
ppal->IndexedColors[
i].peGreen;
847 rgbQuads[
i].rgbBlue = psurf->
ppal->IndexedColors[
i].peBlue;
848 rgbQuads[
i].rgbReserved = 0;
849 }
850 }
851 else
852 {
853 for(
i = 0;
i < 256;
i++)
855 }
856 }
857 else
858 {
860 {
861 for(
i = 0;
i < 256;
i++)
862 {
864 }
865 }
867 {
868
869
870
872 if(!pDcPal)
873 {
874 ScanLines = 0 ;
875 goto done ;
876 }
878 {
882 rgbQuads[
i].rgbReserved = 0;
883 }
885 }
886 else
887 {
889 {
890 case 1:
891 rgbQuads[0].rgbRed = rgbQuads[0].rgbGreen = rgbQuads[0].rgbBlue = 0;
892 rgbQuads[0].rgbReserved = 0;
893 rgbQuads[1].rgbRed = rgbQuads[1].rgbGreen = rgbQuads[1].rgbBlue = 0xff;
894 rgbQuads[1].rgbReserved = 0;
895 break;
896
897 case 4:
898
899
904 break;
905
906 case 8:
907 {
909
912
913 for (
i = 10;
i < 246;
i++)
914 {
915 rgbQuads[
i].rgbRed = (
i & 0x07) << 5;
916 rgbQuads[
i].rgbGreen = (
i & 0x38) << 2;
917 rgbQuads[
i].rgbBlue =
i & 0xc0;
918 rgbQuads[
i].rgbReserved = 0;
919 }
920 }
921 }
922 }
923 }
924 break;
925
926 case 15:
928 {
932 }
933 break;
934
935 case 16:
937 {
939 {
943 }
944 else
945 {
949 }
950 }
951 break;
952
953 case 24:
954 case 32:
956 {
958 {
962 }
963 else
964 {
968 }
969 }
970 break;
971
972 default:
973 ScanLines = 0;
974 goto done;
975 }
976
978 Info->bmiHeader.biPlanes = 1;
979
980 if(Bits && ScanLines)
981 {
982
990 int newLines = -1;
991
992 if (StartScan >=
abs(
Info->bmiHeader.biHeight))
993 {
994 ScanLines = 1;
995 goto done;
996 }
997 else
998 {
999 ScanLines =
min(ScanLines,
abs(
Info->bmiHeader.biHeight) - StartScan);
1000 }
1001
1003 {
1005 }
1006
1008 -(
LONG)ScanLines : ScanLines;
1009
1011
1013
1014 if(!hBmpDest)
1015 {
1016 DPRINT1(
"Unable to create a DIB Section!\n");
1018 ScanLines = 0;
1019 goto done ;
1020 }
1021
1023
1027
1029 {
1031 }
1032 else
1033 {
1034
1035
1038 if (newLines > 0)
1039 {
1042 {
1044 }
1045 }
1046 else
1047 {
1048 newLines = 0;
1050 }
1051 }
1052
1054
1059 &rcDest,
1060 &srcPoint);
1061
1063
1065 ScanLines = 0;
1066 else
1067 {
1069 }
1070
1071 if (newLines != -1)
1072 {
1073 ScanLines = (
UINT)newLines;
1074 }
1077 }
1078 else
1079 {
1080
1081 ScanLines = 1;
1082 }
1083
1084done:
1085
1086 if (pbmci)
1088
1089 if (psurf)
1091
1092 if (pDC)
1094
1095 return ScanLines;
1096}
BOOL APIENTRY IntEngCopyBits(SURFOBJ *psoTrg, SURFOBJ *psoSrc, CLIPOBJ *pco, XLATEOBJ *pxlo, RECTL *prclTrg, POINTL *pptlSrc)
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
FORCEINLINE PDC DC_LockDc(HDC hdc)
static const RGBQUAD DefLogPaletteQuads[20]
BITMAPINFO *FASTCALL DIB_ConvertBitmapInfo(CONST BITMAPINFO *pbmi, DWORD Usage)
int FASTCALL DIB_GetBitmapInfo(const BITMAPINFOHEADER *header, LONG *width, LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size)
VOID FASTCALL DIB_FreeConvertedBitmapInfo(BITMAPINFO *converted, BITMAPINFO *orig, DWORD usage)
HBITMAP APIENTRY DIB_CreateDIBSection(PDC dc, CONST BITMAPINFO *bmi, UINT usage, LPVOID *bits, HANDLE section, DWORD offset, DWORD ovr_pitch)
#define memcpy(s1, s2, n)
struct _PALETTE *const ppal
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
#define BitsPerFormat(Format)
#define PALETTE_ShareLockPalette(hpal)
FORCEINLINE VOID RECTL_vSetRect(_Out_ RECTL *prcl, _In_ LONG left, _In_ LONG top, _In_ LONG right, _In_ LONG bottom)
VOID NTAPI EXLATEOBJ_vInitialize(_Out_ PEXLATEOBJ pexlo, _In_opt_ PALETTE *ppalSrc, _In_opt_ PALETTE *ppalDst, _In_ COLORREF crSrcBackColor, _In_ COLORREF crDstBackColor, _In_ COLORREF crDstForeColor)
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)