798{
800 ULONG bytestoread, bytesread;
802
804
808
810 {
817 }
818
821 if (bytesread !=
sizeof(
DWORD) ||
826 This->bih.bV5Size !=
sizeof(BITMAPV5HEADER)))
return E_FAIL;
827
828 bytestoread =
This->bih.bV5Size-
sizeof(
DWORD);
829 hr = IStream_Read(
stream, &
This->bih.bV5Width, bytestoread, &bytesread);
831 if (bytestoread != bytesread)
return E_FAIL;
832
834 This->palette_offset =
This->bih.bV5Size;
835 else
837
839 {
841 {
844 }
845 else
846 {
847 This->bih.bV5Height /= 2;
848 }
849 }
850
851
852
855 {
856 hr = IStream_Read(
stream, &
This->bih.bV5RedMask, 12, &bytesread);
858 if (bytesread != 12)
return E_FAIL;
859 This->bih.bV5AlphaMask = 0;
860 This->palette_offset += 12;
861 }
862
863
865 {
871 {
872 case 1:
873 This->pixelformat = &GUID_WICPixelFormat1bppIndexed;
874 break;
875 case 2:
876 This->pixelformat = &GUID_WICPixelFormat2bppIndexed;
877 break;
878 case 4:
879 This->pixelformat = &GUID_WICPixelFormat4bppIndexed;
880 break;
881 case 8:
882 This->pixelformat = &GUID_WICPixelFormat8bppIndexed;
883 break;
884 case 24:
885 This->pixelformat = &GUID_WICPixelFormat24bppBGR;
886 break;
887 default:
888 This->pixelformat = &GUID_WICPixelFormatUndefined;
889 WARN(
"unsupported bit depth %i for BITMAPCOREHEADER\n", bch->
bcBitCount);
890 break;
891 }
892 }
893 else
894 {
895 TRACE(
"bitmap header=%li compression=%li depth=%i\n",
This->bih.bV5Size,
This->bih.bV5Compression,
This->bih.bV5BitCount);
896 switch(
This->bih.bV5Compression)
897 {
899 This->bitsperpixel =
This->bih.bV5BitCount;
901 switch(
This->bih.bV5BitCount)
902 {
903 case 1:
904 This->pixelformat = &GUID_WICPixelFormat1bppIndexed;
905 break;
906 case 2:
907 This->pixelformat = &GUID_WICPixelFormat2bppIndexed;
908 break;
909 case 4:
910 This->pixelformat = &GUID_WICPixelFormat4bppIndexed;
911 break;
912 case 8:
913 This->pixelformat = &GUID_WICPixelFormat8bppIndexed;
914 break;
915 case 16:
916 This->pixelformat = &GUID_WICPixelFormat16bppBGR555;
917 break;
918 case 24:
919 This->pixelformat = &GUID_WICPixelFormat24bppBGR;
920 break;
921 case 32:
922 This->pixelformat = &GUID_WICPixelFormat32bppBGR;
923 break;
924 default:
925 This->pixelformat = &GUID_WICPixelFormatUndefined;
926 FIXME(
"unsupported bit depth %i for uncompressed RGB\n",
This->bih.bV5BitCount);
927 }
928 break;
930 This->bitsperpixel = 32;
932 This->pixelformat = &GUID_WICPixelFormat32bppBGR;
933 break;
935 This->bitsperpixel = 32;
937 This->pixelformat = &GUID_WICPixelFormat32bppBGR;
938 break;
940 {
943 {
944
945 This->bitsperpixel = 0;
947 This->pixelformat = &GUID_WICPixelFormatUndefined;
948 FIXME(
"Huffman 1D compression is unsupported\n");
949 break;
950 }
951 This->bitsperpixel =
This->bih.bV5BitCount;
953 {
954 if ((
format->bitcount ==
This->bih.bV5BitCount) &&
956 (
format->greenmask ==
This->bih.bV5GreenMask) &&
957 (
format->bluemask ==
This->bih.bV5BlueMask) &&
958 (
format->alphamask ==
This->bih.bV5AlphaMask))
959 {
960 This->read_data_func =
format->read_data_func;
962 break;
963 }
964 }
966 {
968 This->pixelformat = &GUID_WICPixelFormatUndefined;
969 FIXME(
"unsupported bitfields type depth=%i red=%lx green=%lx blue=%lx alpha=%lx\n",
970 This->bih.bV5BitCount,
This->bih.bV5RedMask,
This->bih.bV5GreenMask,
This->bih.bV5BlueMask,
This->bih.bV5AlphaMask);
971 }
972 break;
973 }
974 default:
975 This->bitsperpixel = 0;
977 This->pixelformat = &GUID_WICPixelFormatUndefined;
978 FIXME(
"unsupported bitmap type header=%li compression=%li depth=%i\n",
This->bih.bV5Size,
This->bih.bV5Compression,
This->bih.bV5BitCount);
979 break;
980 }
981 }
982
984 {
985
987 if (
This->bih.bV5ClrUsed)
988 palette_count =
This->bih.bV5ClrUsed;
989 else if (
This->bih.bV5BitCount <= 8)
990 palette_count = 1 <<
This->bih.bV5BitCount;
991 else
992 palette_count = 0;
995 else
998 }
999
1001
1003}
static HRESULT BmpFrameDecode_ReadRLE8(BmpDecoder *This)
static const struct bitfields_format bitfields_formats[]
static HRESULT BmpFrameDecode_ReadRLE4(BmpDecoder *This)
static unsigned int palette_size(DWORD flags)
int seek(void *fd, ulong off, int mode)
#define WINCODEC_ERR_WRONGSTATE
struct tagBITMAPFILEHEADER BITMAPFILEHEADER
struct tagRGBTRIPLE RGBTRIPLE