728{
736 int bitmap_type;
739
740 DPRINT(
"Entered GreGetDIBitsInternal()\n");
741
743 return 0;
744
747 {
748 ScanLines = 0;
749 goto done;
750 }
751
752
755 {
756 ScanLines = 0;
757 goto done;
758 }
759
761 rgbQuads = colorPtr;
762
766 &planes,
770 if(bitmap_type == -1)
771 {
772 DPRINT1(
"Wrong bitmap format\n");
774 ScanLines = 0;
775 goto done;
776 }
777 else if(bitmap_type == 0)
778 {
779
780
782
786 {
787 DPRINT1(
"Error, could not convert the BITMAPCOREINFO!\n");
788 ScanLines = 0;
789 goto done;
790 }
791 rgbQuads =
Info->bmiColors;
792 }
793
794
795
796
797
798 if (
width < 0 || (
bpp == 0 && Bits))
799 {
800 ScanLines = 0;
801 goto done;
802 }
803
805 {
807 {
808 ScanLines = 0;
809 goto done;
810 }
811 }
812
813 Info->bmiHeader.biClrUsed = 0;
814 Info->bmiHeader.biClrImportant = 0;
815
816
818 {
819 case 0:
824 Info->bmiHeader.biPlanes = 1;
827 Info->bmiHeader.biHeight,
828 Info->bmiHeader.biBitCount);
829 Info->bmiHeader.biCompression = (
Info->bmiHeader.biBitCount == 16 ||
Info->bmiHeader.biBitCount == 32) ?
831 Info->bmiHeader.biXPelsPerMeter = 0;
832 Info->bmiHeader.biYPelsPerMeter = 0;
833
834 if (
Info->bmiHeader.biBitCount <= 8 &&
Info->bmiHeader.biClrUsed == 0)
835 Info->bmiHeader.biClrUsed = 1 <<
Info->bmiHeader.biBitCount;
836
837 ScanLines = 1;
838 goto done;
839
840 case 1:
841 case 4:
842 case 8:
843 Info->bmiHeader.biClrUsed = 1 <<
bpp;
844
845
846
849 {
851 {
853 if(colors != 256)
Info->bmiHeader.biClrUsed = colors;
854 for(
i = 0;
i < colors;
i++)
855 {
856 rgbQuads[
i].rgbRed = psurf->
ppal->IndexedColors[
i].peRed;
857 rgbQuads[
i].rgbGreen = psurf->
ppal->IndexedColors[
i].peGreen;
858 rgbQuads[
i].rgbBlue = psurf->
ppal->IndexedColors[
i].peBlue;
859 rgbQuads[
i].rgbReserved = 0;
860 }
861 }
862 else
863 {
864 for(
i = 0;
i < 256;
i++)
866 }
867 }
868 else
869 {
871 {
872 for(
i = 0;
i < 256;
i++)
873 {
875 }
876 }
878 {
879
880
881
883 if(!pDcPal)
884 {
885 ScanLines = 0 ;
886 goto done ;
887 }
889 {
893 rgbQuads[
i].rgbReserved = 0;
894 }
896 }
897 else
898 {
900 {
901 case 1:
902 rgbQuads[0].rgbRed = rgbQuads[0].rgbGreen = rgbQuads[0].rgbBlue = 0;
903 rgbQuads[0].rgbReserved = 0;
904 rgbQuads[1].rgbRed = rgbQuads[1].rgbGreen = rgbQuads[1].rgbBlue = 0xff;
905 rgbQuads[1].rgbReserved = 0;
906 break;
907
908 case 4:
909
910
915 break;
916
917 case 8:
918 {
920
923
924 for (
i = 10;
i < 246;
i++)
925 {
926 rgbQuads[
i].rgbRed = (
i & 0x07) << 5;
927 rgbQuads[
i].rgbGreen = (
i & 0x38) << 2;
928 rgbQuads[
i].rgbBlue =
i & 0xc0;
929 rgbQuads[
i].rgbReserved = 0;
930 }
931 }
932 }
933 }
934 }
935 break;
936
937 case 15:
939 {
943 }
944 break;
945
946 case 16:
948 {
950 {
954 }
955 else
956 {
960 }
961 }
962 break;
963
964 case 24:
965 case 32:
967 {
969 {
973 }
974 else
975 {
979 }
980 }
981 break;
982
983 default:
984 ScanLines = 0;
985 goto done;
986 }
987
989 Info->bmiHeader.biPlanes = 1;
990
991 if(Bits && ScanLines)
992 {
993
1001 int newLines = -1;
1002
1003 if (StartScan >=
abs(
Info->bmiHeader.biHeight))
1004 {
1005 ScanLines = 1;
1006 goto done;
1007 }
1008 else
1009 {
1010 ScanLines =
min(ScanLines,
abs(
Info->bmiHeader.biHeight) - StartScan);
1011 }
1012
1014 {
1016 }
1017
1019 -(
LONG)ScanLines : ScanLines;
1020
1022
1024
1025 if(!hBmpDest)
1026 {
1027 DPRINT1(
"Unable to create a DIB Section!\n");
1029 ScanLines = 0;
1030 goto done ;
1031 }
1032
1034
1038
1040 {
1042 }
1043 else
1044 {
1045
1046
1049 if (newLines > 0)
1050 {
1053 {
1055 }
1056 }
1057 else
1058 {
1059 newLines = 0;
1061 }
1062 }
1063
1065
1070 &rcDest,
1071 &srcPoint);
1072
1074
1076 ScanLines = 0;
1077 else
1078 {
1080 }
1081
1082 if (newLines != -1)
1083 {
1084 ScanLines = (
UINT)newLines;
1085 }
1088 }
1089 else
1090 {
1091
1092 ScanLines = 1;
1093 }
1094
1095done:
1096
1097 if (pbmci)
1099
1100 if (psurf)
1102
1103 if (pDC)
1105
1106 return ScanLines;
1107}
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)