727{
735 int bitmap_type;
738
739 DPRINT(
"Entered GreGetDIBitsInternal()\n");
740
742 return 0;
743
746 {
747 ScanLines = 0;
748 goto done;
749 }
750
751
754 {
755 ScanLines = 0;
756 goto done;
757 }
758
760 rgbQuads = colorPtr;
761
765 &planes,
769 if(bitmap_type == -1)
770 {
771 DPRINT1(
"Wrong bitmap format\n");
773 ScanLines = 0;
774 goto done;
775 }
776 else if(bitmap_type == 0)
777 {
778
779
781
785 {
786 DPRINT1(
"Error, could not convert the BITMAPCOREINFO!\n");
787 ScanLines = 0;
788 goto done;
789 }
790 rgbQuads =
Info->bmiColors;
791 }
792
793
794
795
796
797 if (
width < 0 || (
bpp == 0 && Bits))
798 {
799 ScanLines = 0;
800 goto done;
801 }
802
804 {
806 {
807 ScanLines = 0;
808 goto done;
809 }
810 }
811
812 Info->bmiHeader.biClrUsed = 0;
813 Info->bmiHeader.biClrImportant = 0;
814
815
817 {
818 case 0:
823 Info->bmiHeader.biPlanes = 1;
826 Info->bmiHeader.biHeight,
827 Info->bmiHeader.biBitCount);
828 Info->bmiHeader.biCompression = (
Info->bmiHeader.biBitCount == 16 ||
Info->bmiHeader.biBitCount == 32) ?
830 Info->bmiHeader.biXPelsPerMeter = 0;
831 Info->bmiHeader.biYPelsPerMeter = 0;
832
833 if (
Info->bmiHeader.biBitCount <= 8 &&
Info->bmiHeader.biClrUsed == 0)
834 Info->bmiHeader.biClrUsed = 1 <<
Info->bmiHeader.biBitCount;
835
836 ScanLines = 1;
837 goto done;
838
839 case 1:
840 case 4:
841 case 8:
842 Info->bmiHeader.biClrUsed = 1 <<
bpp;
843
844
845
848 {
850 {
852 if(colors != 256)
Info->bmiHeader.biClrUsed = colors;
853 for(
i = 0;
i < colors;
i++)
854 {
855 rgbQuads[
i].rgbRed = psurf->
ppal->IndexedColors[
i].peRed;
856 rgbQuads[
i].rgbGreen = psurf->
ppal->IndexedColors[
i].peGreen;
857 rgbQuads[
i].rgbBlue = psurf->
ppal->IndexedColors[
i].peBlue;
858 rgbQuads[
i].rgbReserved = 0;
859 }
860 }
861 else
862 {
863 for(
i = 0;
i < 256;
i++)
865 }
866 }
867 else
868 {
870 {
871 for(
i = 0;
i < 256;
i++)
872 {
874 }
875 }
877 {
878
879
880
882 if(!pDcPal)
883 {
884 ScanLines = 0 ;
885 goto done ;
886 }
888 {
892 rgbQuads[
i].rgbReserved = 0;
893 }
895 }
896 else
897 {
899 {
900 case 1:
901 rgbQuads[0].rgbRed = rgbQuads[0].rgbGreen = rgbQuads[0].rgbBlue = 0;
902 rgbQuads[0].rgbReserved = 0;
903 rgbQuads[1].rgbRed = rgbQuads[1].rgbGreen = rgbQuads[1].rgbBlue = 0xff;
904 rgbQuads[1].rgbReserved = 0;
905 break;
906
907 case 4:
908
909
914 break;
915
916 case 8:
917 {
919
922
923 for (
i = 10;
i < 246;
i++)
924 {
925 rgbQuads[
i].rgbRed = (
i & 0x07) << 5;
926 rgbQuads[
i].rgbGreen = (
i & 0x38) << 2;
927 rgbQuads[
i].rgbBlue =
i & 0xc0;
928 rgbQuads[
i].rgbReserved = 0;
929 }
930 }
931 }
932 }
933 }
934 break;
935
936 case 15:
938 {
942 }
943 break;
944
945 case 16:
947 {
949 {
953 }
954 else
955 {
959 }
960 }
961 break;
962
963 case 24:
964 case 32:
966 {
968 {
972 }
973 else
974 {
978 }
979 }
980 break;
981
982 default:
983 ScanLines = 0;
984 goto done;
985 }
986
988 Info->bmiHeader.biPlanes = 1;
989
990 if(Bits && ScanLines)
991 {
992
1000 int newLines = -1;
1001
1002 if (StartScan >=
abs(
Info->bmiHeader.biHeight))
1003 {
1004 ScanLines = 1;
1005 goto done;
1006 }
1007 else
1008 {
1009 ScanLines =
min(ScanLines,
abs(
Info->bmiHeader.biHeight) - StartScan);
1010 }
1011
1013 {
1015 }
1016
1018 -(
LONG)ScanLines : ScanLines;
1019
1021
1023
1024 if(!hBmpDest)
1025 {
1026 DPRINT1(
"Unable to create a DIB Section!\n");
1028 ScanLines = 0;
1029 goto done ;
1030 }
1031
1033
1037
1039 {
1041 }
1042 else
1043 {
1044
1045
1048 if (newLines > 0)
1049 {
1052 {
1054 }
1055 }
1056 else
1057 {
1058 newLines = 0;
1060 }
1061 }
1062
1064
1069 &rcDest,
1070 &srcPoint);
1071
1073
1075 ScanLines = 0;
1076 else
1077 {
1079 }
1080
1081 if (newLines != -1)
1082 {
1083 ScanLines = (
UINT)newLines;
1084 }
1087 }
1088 else
1089 {
1090
1091 ScanLines = 1;
1092 }
1093
1094done:
1095
1096 if (pbmci)
1098
1099 if (psurf)
1101
1102 if (pDC)
1104
1105 return ScanLines;
1106}
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)