704{
712 int bitmap_type;
715
716 DPRINT(
"Entered GreGetDIBitsInternal()\n");
717
719 return 0;
720
723 {
724 ScanLines = 0;
725 goto done;
726 }
727
728
731 {
732 ScanLines = 0;
733 goto done;
734 }
735
737 rgbQuads = colorPtr;
738
742 &planes,
746 if(bitmap_type == -1)
747 {
748 DPRINT1(
"Wrong bitmap format\n");
750 ScanLines = 0;
751 goto done;
752 }
753 else if(bitmap_type == 0)
754 {
755
756
758
762 {
763 DPRINT1(
"Error, could not convert the BITMAPCOREINFO!\n");
764 ScanLines = 0;
765 goto done;
766 }
767 rgbQuads =
Info->bmiColors;
768 }
769
770
771
772
773
774 if (
width < 0 || (
bpp == 0 && Bits))
775 {
776 ScanLines = 0;
777 goto done;
778 }
779
781 {
783 {
784 ScanLines = 0;
785 goto done;
786 }
787 }
788
789 Info->bmiHeader.biClrUsed = 0;
790 Info->bmiHeader.biClrImportant = 0;
791
792
794 {
795 case 0:
800 Info->bmiHeader.biPlanes = 1;
803 Info->bmiHeader.biHeight,
804 Info->bmiHeader.biBitCount);
805 Info->bmiHeader.biCompression = (
Info->bmiHeader.biBitCount == 16 ||
Info->bmiHeader.biBitCount == 32) ?
807 Info->bmiHeader.biXPelsPerMeter = 0;
808 Info->bmiHeader.biYPelsPerMeter = 0;
809
810 if (
Info->bmiHeader.biBitCount <= 8 &&
Info->bmiHeader.biClrUsed == 0)
811 Info->bmiHeader.biClrUsed = 1 <<
Info->bmiHeader.biBitCount;
812
813 ScanLines = 1;
814 goto done;
815
816 case 1:
817 case 4:
818 case 8:
819 Info->bmiHeader.biClrUsed = 1 <<
bpp;
820
821
822
825 {
827 {
829 if(colors != 256)
Info->bmiHeader.biClrUsed = colors;
830 for(
i = 0;
i < colors;
i++)
831 {
832 rgbQuads[
i].rgbRed = psurf->
ppal->IndexedColors[
i].peRed;
833 rgbQuads[
i].rgbGreen = psurf->
ppal->IndexedColors[
i].peGreen;
834 rgbQuads[
i].rgbBlue = psurf->
ppal->IndexedColors[
i].peBlue;
835 rgbQuads[
i].rgbReserved = 0;
836 }
837 }
838 else
839 {
840 for(
i = 0;
i < 256;
i++)
842 }
843 }
844 else
845 {
847 {
848 for(
i = 0;
i < 256;
i++)
849 {
851 }
852 }
854 {
855
856
857
859 if(!pDcPal)
860 {
861 ScanLines = 0 ;
862 goto done ;
863 }
865 {
869 rgbQuads[
i].rgbReserved = 0;
870 }
872 }
873 else
874 {
876 {
877 case 1:
878 rgbQuads[0].rgbRed = rgbQuads[0].rgbGreen = rgbQuads[0].rgbBlue = 0;
879 rgbQuads[0].rgbReserved = 0;
880 rgbQuads[1].rgbRed = rgbQuads[1].rgbGreen = rgbQuads[1].rgbBlue = 0xff;
881 rgbQuads[1].rgbReserved = 0;
882 break;
883
884 case 4:
885
886
891 break;
892
893 case 8:
894 {
896
899
900 for (
i = 10;
i < 246;
i++)
901 {
902 rgbQuads[
i].rgbRed = (
i & 0x07) << 5;
903 rgbQuads[
i].rgbGreen = (
i & 0x38) << 2;
904 rgbQuads[
i].rgbBlue =
i & 0xc0;
905 rgbQuads[
i].rgbReserved = 0;
906 }
907 }
908 }
909 }
910 }
911 break;
912
913 case 15:
915 {
919 }
920 break;
921
922 case 16:
924 {
926 {
930 }
931 else
932 {
936 }
937 }
938 break;
939
940 case 24:
941 case 32:
943 {
945 {
949 }
950 else
951 {
955 }
956 }
957 break;
958
959 default:
960 ScanLines = 0;
961 goto done;
962 }
963
965 Info->bmiHeader.biPlanes = 1;
966
967 if(Bits && ScanLines)
968 {
969
977 int newLines = -1;
978
979 if (StartScan >=
abs(
Info->bmiHeader.biHeight))
980 {
981 ScanLines = 1;
982 goto done;
983 }
984 else
985 {
986 ScanLines =
min(ScanLines,
abs(
Info->bmiHeader.biHeight) - StartScan);
987 }
988
990 {
992 }
993
995 -(
LONG)ScanLines : ScanLines;
996
998
1000
1001 if(!hBmpDest)
1002 {
1003 DPRINT1(
"Unable to create a DIB Section!\n");
1005 ScanLines = 0;
1006 goto done ;
1007 }
1008
1010
1014
1016 {
1018 }
1019 else
1020 {
1021
1022
1025 if (newLines > 0)
1026 {
1029 {
1031 }
1032 }
1033 else
1034 {
1035 newLines = 0;
1037 }
1038 }
1039
1041
1046 &rcDest,
1047 &srcPoint);
1048
1050
1052 ScanLines = 0;
1053 else
1054 {
1056 }
1057
1058 if (newLines != -1)
1059 {
1060 ScanLines = (
UINT)newLines;
1061 }
1064 }
1065 else
1066 {
1067
1068 ScanLines = 1;
1069 }
1070
1071done:
1072
1073 if (pbmci)
1075
1076 if (psurf)
1078
1079 if (pDC)
1081
1082 return ScanLines;
1083}
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)