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
788 {
790 {
791 ScanLines = 0;
792 goto done;
793 }
794 }
795
797 {
799 {
800 ScanLines = 0;
801 goto done;
802 }
803 }
804
805 Info->bmiHeader.biClrUsed = 0;
806 Info->bmiHeader.biClrImportant = 0;
807
808
810 {
811 case 0:
816 Info->bmiHeader.biPlanes = 1;
819 Info->bmiHeader.biHeight,
820 Info->bmiHeader.biBitCount);
821 Info->bmiHeader.biCompression = (
Info->bmiHeader.biBitCount == 16 ||
Info->bmiHeader.biBitCount == 32) ?
823 Info->bmiHeader.biXPelsPerMeter = 0;
824 Info->bmiHeader.biYPelsPerMeter = 0;
825
826 if (
Info->bmiHeader.biBitCount <= 8 &&
Info->bmiHeader.biClrUsed == 0)
827 Info->bmiHeader.biClrUsed = 1 <<
Info->bmiHeader.biBitCount;
828
829 ScanLines = 1;
830 goto done;
831
832 case 1:
833 case 4:
834 case 8:
835 Info->bmiHeader.biClrUsed = 1 <<
bpp;
836
837
838
841 {
843 {
845 if(colors != 256)
Info->bmiHeader.biClrUsed = colors;
846 for(
i = 0;
i < colors;
i++)
847 {
848 rgbQuads[
i].rgbRed = psurf->
ppal->IndexedColors[
i].peRed;
849 rgbQuads[
i].rgbGreen = psurf->
ppal->IndexedColors[
i].peGreen;
850 rgbQuads[
i].rgbBlue = psurf->
ppal->IndexedColors[
i].peBlue;
851 rgbQuads[
i].rgbReserved = 0;
852 }
853 }
854 else
855 {
856 for(
i = 0;
i < 256;
i++)
858 }
859 }
860 else
861 {
863 {
864 for(
i = 0;
i < 256;
i++)
865 {
867 }
868 }
870 {
871
872
873
875 if(!pDcPal)
876 {
877 ScanLines = 0 ;
878 goto done ;
879 }
881 {
885 rgbQuads[
i].rgbReserved = 0;
886 }
888 }
889 else
890 {
892 {
893 case 1:
894 rgbQuads[0].rgbRed = rgbQuads[0].rgbGreen = rgbQuads[0].rgbBlue = 0;
895 rgbQuads[0].rgbReserved = 0;
896 rgbQuads[1].rgbRed = rgbQuads[1].rgbGreen = rgbQuads[1].rgbBlue = 0xff;
897 rgbQuads[1].rgbReserved = 0;
898 break;
899
900 case 4:
901
902
907 break;
908
909 case 8:
910 {
912
915
916 for (
i = 10;
i < 246;
i++)
917 {
918 rgbQuads[
i].rgbRed = (
i & 0x07) << 5;
919 rgbQuads[
i].rgbGreen = (
i & 0x38) << 2;
920 rgbQuads[
i].rgbBlue =
i & 0xc0;
921 rgbQuads[
i].rgbReserved = 0;
922 }
923 }
924 }
925 }
926 }
927 break;
928
929 case 15:
931 {
935 }
936 break;
937
938 case 16:
940 {
942 {
946 }
947 else
948 {
952 }
953 }
954 break;
955
956 case 24:
957 case 32:
959 {
961 {
965 }
966 else
967 {
971 }
972 }
973 break;
974
975 default:
976 ScanLines = 0;
977 goto done;
978 }
979
981 Info->bmiHeader.biPlanes = 1;
982
983 if(Bits && ScanLines)
984 {
985
993 int newLines = -1;
994
995 if (StartScan >=
abs(
Info->bmiHeader.biHeight))
996 {
997 ScanLines = 1;
998 goto done;
999 }
1000 else
1001 {
1002 ScanLines =
min(ScanLines,
abs(
Info->bmiHeader.biHeight) - StartScan);
1003 }
1004
1006 {
1008 }
1009
1011 -(
LONG)ScanLines : ScanLines;
1012
1014
1016
1017 if(!hBmpDest)
1018 {
1019 DPRINT1(
"Unable to create a DIB Section!\n");
1021 ScanLines = 0;
1022 goto done ;
1023 }
1024
1026
1030
1032 {
1034 }
1035 else
1036 {
1037
1038
1041 if (newLines > 0)
1042 {
1045 {
1047 }
1048 }
1049 else
1050 {
1051 newLines = 0;
1053 }
1054 }
1055
1057
1062 &rcDest,
1063 &srcPoint);
1064
1066
1068 ScanLines = 0;
1069 else
1070 {
1072 }
1073
1074 if (newLines != -1)
1075 {
1076 ScanLines = (
UINT)newLines;
1077 }
1080 }
1081 else
1082 {
1083 if (width < 0 || Info->bmiHeader.biSizeImage == 0)
1084 ScanLines = 0;
1085 else
1086
1087 ScanLines = 1;
1088 }
1089
1090done:
1091
1092 if (pbmci)
1094
1095 if (psurf)
1097
1098 if (pDC)
1100
1101 return ScanLines;
1102}
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)