Changeset 85864 in vbox
- Timestamp:
- Aug 21, 2020 12:44:56 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
include/iprt/formats/bmp.h (modified) (1 diff)
-
src/VBox/Devices/Graphics/DevVGA-SVGA3d-info.cpp (modified) (1 diff)
-
src/VBox/Devices/Graphics/DevVGA.cpp (modified) (4 diffs)
-
src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp (modified) (3 diffs)
-
src/VBox/Main/src-client/RecordingStream.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/formats/bmp.h
r85859 r85864 34 34 #include <iprt/assertcompile.h> 35 35 36 /** @name BMP header sizes (in bytes). 37 * @{ . */ 38 #define BMP_HDR_SIZE_FILE 14 39 #define BMP_HDR_SIZE_OS21 12 40 #define BMP_HDR_SIZE_OS22 64 41 #define BMP_HDR_SIZE_WIN3X 40 42 /** @} . */ 43 36 44 #pragma pack(1) 37 45 38 /** BMP File Format Bitmap Header. */39 typedef struct 46 /** BMP format file header. */ 47 typedef struct BMPFILEHDR 40 48 { 41 /** File Type Identifier. */42 uint16_t Type;43 /** Size of File. */44 uint32_t FileSize;49 /** File type identifier ("magic"). */ 50 uint16_t uType; 51 /** Size of file in bytes. */ 52 uint32_t cbFileSize; 45 53 /** Reserved (should be 0). */ 46 54 uint16_t Reserved1; 47 55 /** Reserved (should be 0). */ 48 56 uint16_t Reserved2; 49 /** Offset to bitmap data. */50 uint32_t Offset;51 } BMP INFO;52 AssertCompileSize(BMP INFO, 14);53 /** Pointer to a bitmapheader. */54 typedef BMP INFO *PBMPINFO;57 /** Offset (in bytes) to bitmap data. */ 58 uint32_t offBits; 59 } BMPFILEHDR; 60 AssertCompileSize(BMPFILEHDR, BMP_HDR_SIZE_FILE); 61 /** Pointer to a BMP format file header. */ 62 typedef BMPFILEHDR *PBMPFILEHDR; 55 63 56 /** OS/2 1.x Information Header Format. */ 57 typedef struct 64 /** OS/2 1.x BMP core header, 65 * also known as BITMAPCOREHEADER. */ 66 typedef struct BMPOS2COREHDR 58 67 { 59 /** Size of Remaining Header. */60 uint32_t Size;61 /** Width of Bitmap in Pixels. */62 uint16_t Width;63 /** Height of Bitmap in Pixels. */64 uint16_t Height;65 /** Number of Planes. */66 uint16_t Planes;67 /** Color Bits Per Pixel. */68 uint16_t BitCount;69 } OS2HDR;70 AssertCompileSize( OS2HDR, 12);71 /** Pointer to a OS/2 1.x header format. */72 typedef OS2HDR *POS2HDR;68 /** Size (in bytes) of remaining header. */ 69 uint32_t cbSize; 70 /** Width of bitmap in pixels. */ 71 uint16_t uWidth; 72 /** Height of bitmap in pixels. */ 73 uint16_t uHeight; 74 /** Number of planes. */ 75 uint16_t cPlanes; 76 /** Color bits per pixel. */ 77 uint16_t cBits; 78 } BMPOS2COREHDR; 79 AssertCompileSize(BMPOS2COREHDR, BMP_HDR_SIZE_OS21); 80 /** Pointer to a OS/2 1.x BMP core header. */ 81 typedef BMPOS2COREHDR *PBMPOS2COREHDR; 73 82 74 /** OS/2 2.0 Information Header Format. */ 75 typedef struct 83 /** OS/2 2.0 BMP core header, version 2, 84 * also known as BITMAPCOREHEADER2. */ 85 typedef struct BMPOS2COREHDR2 76 86 { 77 /** Size of Remaining Header. */78 uint32_t Size;79 /** Width of Bitmap in Pixels. */80 uint32_t Width;81 /** Height of Bitmap in Pixels. */82 uint32_t Height;83 /** Number of Planes. */84 uint16_t Planes;85 /** Color Bits Per Pixel. */86 uint16_t BitCount;87 /** Compression Scheme (0=none). */88 uint32_t Compression;87 /** Size (in bytes) of remaining header. */ 88 uint32_t cbSize; 89 /** Width of bitmap in pixels. */ 90 uint32_t uWidth; 91 /** Height of bitmap in pixels. */ 92 uint32_t uHeight; 93 /** Number of planes. */ 94 uint16_t cPlanes; 95 /** Color bits per pixel. */ 96 uint16_t cBits; 97 /** Compression scheme of type BMP_COMPRESSION_TYPE. */ 98 uint32_t enmCompression; 89 99 /** Size of bitmap in bytes. */ 90 uint32_t SizeImage;91 /** Horz. Resolution in Pixels/Meter. */92 uint32_t XPelsPerMeter;93 /** Vert. Resolution in Pixels/Meter. */94 uint32_t YPelsPerMeter;95 /** Number of Colors in Color Table. */96 uint32_t ClrUsed;97 /** Number of Important Colors. */98 uint32_t ClrImportant;99 /** Resolution Measurement Used. */100 uint16_t Units;101 /** Reserved Fields (always 0). */100 uint32_t cbSizeImage; 101 /** Horz. resolution in pixels/meter. */ 102 uint32_t uXPelsPerMeter; 103 /** Vert. resolution in pixels/meter. */ 104 uint32_t uYPelsPerMeter; 105 /** Number of colors in color table. */ 106 uint32_t cClrUsed; 107 /** Number of important colors. */ 108 uint32_t cClrImportant; 109 /** Resolution measurement Used. */ 110 uint16_t uUnits; 111 /** Reserved fields (always 0). */ 102 112 uint16_t Reserved; 103 /** Orientation of Bitmap. */104 uint16_t Recording;105 /** Halftone Algorithm Used on Image. */106 uint16_t Rendering;107 /** Halftone Algorithm Data. */108 uint32_t Size1;109 /** Halftone Algorithm Data. */110 uint32_t Size2;111 /** Color Table Format (always 0). */112 uint32_t ColorEncoding;113 /** Misc. Field for Application Use . */114 uint32_t Identifier;115 } OS22HDR;116 AssertCompileSize( OS22HDR, 64);117 /** Pointer to a OS/2 2.0 header format. */118 typedef OS22HDR *POS22HDR;113 /** Orientation of bitmap. */ 114 uint16_t uRecording; 115 /** Halftone algorithm used on image. */ 116 uint16_t enmHalftone; 117 /** Halftone algorithm data. */ 118 uint32_t uHalftoneParm1; 119 /** Halftone algorithm data. */ 120 uint32_t uHalftoneParm2; 121 /** Color table format (always 0). */ 122 uint32_t uColorEncoding; 123 /** Misc. field for application use . */ 124 uint32_t uIdentifier; 125 } BMPOS2COREHDR2; 126 AssertCompileSize(BMPOS2COREHDR2, BMP_HDR_SIZE_OS22); 127 /** Pointer to an OS/2 2.0 BMP core header version 2. */ 128 typedef BMPOS2COREHDR2 *PBMPOS2COREHDR2; 119 129 120 /** Windows 3.x Information Header Format. */121 typedef struct 130 /** Windows 3.x BMP information header Format. */ 131 typedef struct BMPWIN3XINFOHDR 122 132 { 123 /** Size of Remaining Header. */124 uint32_t Size;125 /** Width of Bitmap in Pixels. */126 uint32_t Width;127 /** Height of Bitmap in Pixels. */128 uint32_t Height;129 /** Number of Planes. */130 uint16_t Planes;131 /** Bits Per Pixel. */132 uint16_t BitCount;133 /** Compression Scheme (0=none). */134 uint32_t Compression;133 /** Size (in bytes) of remaining header. */ 134 uint32_t cbSize; 135 /** Width of bitmap in pixels. */ 136 uint32_t uWidth; 137 /** Height of bitmap in pixels. */ 138 uint32_t uHeight; 139 /** Number of planes. */ 140 uint16_t cPlanes; 141 /** Color bits per pixel. */ 142 uint16_t cBits; 143 /** Compression scheme of type BMP_COMPRESSION_TYPE. */ 144 uint32_t enmCompression; 135 145 /** Size of bitmap in bytes. */ 136 uint32_t SizeImage; 137 /** Horz. Resolution in Pixels/Meter. */ 138 uint32_t XPelsPerMeter; 139 /** Vert. Resolution in Pixels/Meter. */ 140 uint32_t YPelsPerMeter; 141 /** Number of Colors in Color Table. */ 142 uint32_t ClrUsed; 143 /** Number of Important Colors. */ 144 uint32_t ClrImportant; 145 } WINHDR; 146 /** Pointer to a Windows 3.x header format. */ 147 typedef WINHDR *PWINHDR; 146 uint32_t cbSizeImage; 147 /** Horz. resolution in pixels/meter. */ 148 uint32_t uXPelsPerMeter; 149 /** Vert. resolution in pixels/meter. */ 150 uint32_t uYPelsPerMeter; 151 /** Number of colors in color table. */ 152 uint32_t cClrUsed; 153 /** Number of important colors. */ 154 uint32_t cClrImportant; 155 } BMPWIN3XINFOHDR; 156 AssertCompileSize(BMPWIN3XINFOHDR, BMP_HDR_SIZE_WIN3X); 157 /** Pointer to a Windows 3.x BMP information header. */ 158 typedef BMPWIN3XINFOHDR *PBMPWIN3XINFOHDR; 148 159 149 160 #pragma pack() 150 161 151 /** BMP file magic number . */162 /** BMP file magic number for BMP / DIB. */ 152 163 #define BMP_HDR_MAGIC (RT_H2LE_U16_C(0x4d42)) 153 164 154 /** @name BMP compression s.165 /** @name BMP compression types. 155 166 * @{ . */ 156 #define BMP_COMPRESS_NONE 0 157 #define BMP_COMPRESS_RLE8 1 158 #define BMP_COMPRESS_RLE4 2 159 /** @} . */ 160 161 /** @name BMP header sizes. 162 * @{ . */ 163 #define BMP_HEADER_OS21 12 164 #define BMP_HEADER_OS22 64 165 #define BMP_HEADER_WIN3 40 167 typedef enum BMP_COMPRESSION_TYPE 168 { 169 BMP_COMPRESSION_TYPE_NONE = 0, 170 BMP_COMPRESSION_TYPE_RLE8 = 1, 171 BMP_COMPRESSION_TYPE_RLE4 = 2 172 } BMP_COMPRESSION_TYPE; 166 173 /** @} . */ 167 174 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-info.cpp
r85858 r85864 1818 1818 if (cbPixel == 4) 1819 1819 { 1820 B ITMAPV4HEADER bh;1821 RT_ZERO( bh);1822 bh.bV4Size = sizeof(bh);1823 bh.bV4Width = w;1824 bh.bV4Height = -h;1825 bh.bV4Planes = 1; 1826 bh.bV4BitCount = 32;1827 bh.bV4V4Compression = BI_BITFIELDS;1828 bh.bV4SizeImage = cbBitmap;1829 bh.bV4XPelsPerMeter = 2835;1830 bh.bV4YPelsPerMeter = 2835;1831 // bh.bV4ClrUsed = 0;1832 // bh.bV4ClrImportant = 0;1833 bh.bV4RedMask = 0x00ff0000;1834 bh.bV4GreenMask = 0x0000ff00;1835 bh.bV4BlueMask = 0x000000ff;1836 bh.bV4AlphaMask = 0xff000000;1837 bh.bV4CSType = LCS_WINDOWS_COLOR_SPACE;1838 // bh.bV4Endpoints = {0};1839 // bh.bV4GammaRed =0;1840 // bh.bV4GammaGreen =0;1841 // bh.bV4GammaBlue = 0;1842 1843 BMPINFO bf;1844 RT_ZERO(bf);1845 bf.Type = BMP_HDR_MAGIC;1846 bf.FileSize = sizeof(bf) + sizeof(bh) + cbBitmap;1847 bf.Offset = sizeof(bf) + sizeof(bh);1848 1849 fwrite(& bf, 1, sizeof(bf), f);1850 fwrite(& bh, 1, sizeof(bh), f);1820 BMPFILEHDR fileHdr; 1821 RT_ZERO(fileHdr); 1822 fileHdr.uType = BMP_HDR_MAGIC; 1823 fileHdr.cbFileSize = sizeof(fileHdr) + sizeof(BITMAPV4HEADER) + cbBitmap; 1824 fileHdr.offBits = sizeof(fileHdr) + sizeof(BITMAPV4HEADER); 1825 1826 BITMAPV4HEADER hdrV4; 1827 RT_ZERO(hdrV4); 1828 hdrV4.bV4Size = sizeof(hdrV4); 1829 hdrV4.bV4Width = w; 1830 hdrV4.bV4Height = -h; 1831 hdrV4.bV4Planes = 1; 1832 hdrV4.bV4BitCount = 32; 1833 hdrV4.bV4V4Compression = BI_BITFIELDS; 1834 hdrV4.bV4SizeImage = cbBitmap; 1835 hdrV4.bV4XPelsPerMeter = 2835; 1836 hdrV4.bV4YPelsPerMeter = 2835; 1837 // hdrV4.bV4ClrUsed = 0; 1838 // hdrV4.bV4ClrImportant = 0; 1839 hdrV4.bV4RedMask = 0x00ff0000; 1840 hdrV4.bV4GreenMask = 0x0000ff00; 1841 hdrV4.bV4BlueMask = 0x000000ff; 1842 hdrV4.bV4AlphaMask = 0xff000000; 1843 hdrV4.bV4CSType = LCS_WINDOWS_COLOR_SPACE; 1844 // hdrV4.bV4Endpoints = {0}; 1845 // hdrV4.bV4GammaRed = 0; 1846 // hdrV4.bV4GammaGreen = 0; 1847 // hdrV4.bV4GammaBlue = 0; 1848 1849 fwrite(&fileHdr, 1, sizeof(fileHdr), f); 1850 fwrite(&hdrV4, 1, sizeof(hdrV4), f); 1851 1851 } 1852 1852 else 1853 1853 #endif 1854 1854 { 1855 BMP INFO bf;1856 RT_ZERO( bf);1857 bf.Type= BMP_HDR_MAGIC;1858 bf.FileSize = sizeof(BMPINFO) + sizeof(WINHDR) + cbBitmap;1859 bf.Offset = sizeof(BMPINFO) + sizeof(WINHDR);1860 1861 WINHDR bi;1862 RT_ZERO( bi);1863 bi.Size = sizeof(bi);1864 bi.Width= w;1865 bi.Height= -h;1866 bi.Planes= 1;1867 bi.BitCount= 32;1868 bi.SizeImage = cbBitmap;1869 1870 fwrite(& bf, 1, sizeof(bf), f);1871 fwrite(& bi, 1, sizeof(bi), f);1855 BMPFILEHDR fileHdr; 1856 RT_ZERO(fileHdr); 1857 fileHdr.uType = BMP_HDR_MAGIC; 1858 fileHdr.cbFileSize = sizeof(BMPFILEHDR) + sizeof(BMPWIN3XINFOHDR) + cbBitmap; 1859 fileHdr.offBits = sizeof(BMPFILEHDR) + sizeof(BMPWIN3XINFOHDR); 1860 1861 BMPWIN3XINFOHDR coreHdr; 1862 RT_ZERO(coreHdr); 1863 coreHdr.cbSize = sizeof(coreHdr); 1864 coreHdr.uWidth = w; 1865 coreHdr.uHeight = -h; 1866 coreHdr.cPlanes = 1; 1867 coreHdr.cBits = 32; 1868 coreHdr.cbSizeImage = cbBitmap; 1869 1870 fwrite(&fileHdr, 1, sizeof(fileHdr), f); 1871 fwrite(&coreHdr, 1, sizeof(coreHdr), f); 1872 1872 } 1873 1873 -
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r85863 r85864 3871 3871 * Get bitmap header data 3872 3872 */ 3873 PBMP INFO pBmpInfo = (PBMPINFO)(pThisCC->pbLogo + sizeof(LOGOHDR));3874 P WINHDR pWinHdr = (PWINHDR)(pThisCC->pbLogo + sizeof(LOGOHDR) + sizeof(BMPINFO));3875 3876 if (p BmpInfo->Type == BMP_HDR_MAGIC)3877 { 3878 switch (p WinHdr->Size)3873 PBMPFILEHDR pFileHdr = (PBMPFILEHDR)(pThisCC->pbLogo + sizeof(LOGOHDR)); 3874 PBMPWIN3XINFOHDR pCoreHdr = (PBMPWIN3XINFOHDR)(pThisCC->pbLogo + sizeof(LOGOHDR) + sizeof(BMPFILEHDR)); 3875 3876 if (pFileHdr->uType == BMP_HDR_MAGIC) 3877 { 3878 switch (pCoreHdr->cbSize) 3879 3879 { 3880 case BMP_H EADER_OS21:3880 case BMP_HDR_SIZE_OS21: 3881 3881 { 3882 P OS2HDR pOs2Hdr = (POS2HDR)pWinHdr;3883 pThisCC->cxLogo = pOs2Hdr-> Width;3884 pThisCC->cyLogo = pOs2Hdr-> Height;3885 pThisCC->cLogoPlanes = pOs2Hdr-> Planes;3886 pThisCC->cLogoBits = pOs2Hdr-> BitCount;3887 pThisCC->LogoCompression = BMP_COMPRESS _NONE;3882 PBMPOS2COREHDR pOs2Hdr = (PBMPOS2COREHDR)pCoreHdr; 3883 pThisCC->cxLogo = pOs2Hdr->uWidth; 3884 pThisCC->cyLogo = pOs2Hdr->uHeight; 3885 pThisCC->cLogoPlanes = pOs2Hdr->cPlanes; 3886 pThisCC->cLogoBits = pOs2Hdr->cBits; 3887 pThisCC->LogoCompression = BMP_COMPRESSION_TYPE_NONE; 3888 3888 pThisCC->cLogoUsedColors = 0; 3889 3889 break; 3890 3890 } 3891 3891 3892 case BMP_H EADER_OS22:3892 case BMP_HDR_SIZE_OS22: 3893 3893 { 3894 P OS22HDR pOs22Hdr = (POS22HDR)pWinHdr;3895 pThisCC->cxLogo = pOs22Hdr-> Width;3896 pThisCC->cyLogo = pOs22Hdr-> Height;3897 pThisCC->cLogoPlanes = pOs22Hdr-> Planes;3898 pThisCC->cLogoBits = pOs22Hdr-> BitCount;3899 pThisCC->LogoCompression = pOs22Hdr-> Compression;3900 pThisCC->cLogoUsedColors = pOs22Hdr-> ClrUsed;3894 PBMPOS2COREHDR2 pOs22Hdr = (PBMPOS2COREHDR2)pCoreHdr; 3895 pThisCC->cxLogo = pOs22Hdr->uWidth; 3896 pThisCC->cyLogo = pOs22Hdr->uHeight; 3897 pThisCC->cLogoPlanes = pOs22Hdr->cPlanes; 3898 pThisCC->cLogoBits = pOs22Hdr->cBits; 3899 pThisCC->LogoCompression = pOs22Hdr->enmCompression; 3900 pThisCC->cLogoUsedColors = pOs22Hdr->cClrUsed; 3901 3901 break; 3902 3902 } 3903 3903 3904 case BMP_H EADER_WIN3:3905 pThisCC->cxLogo = p WinHdr->Width;3906 pThisCC->cyLogo = p WinHdr->Height;3907 pThisCC->cLogoPlanes = p WinHdr->Planes;3908 pThisCC->cLogoBits = p WinHdr->BitCount;3909 pThisCC->LogoCompression = p WinHdr->Compression;3910 pThisCC->cLogoUsedColors = p WinHdr->ClrUsed;3904 case BMP_HDR_SIZE_WIN3X: 3905 pThisCC->cxLogo = pCoreHdr->uWidth; 3906 pThisCC->cyLogo = pCoreHdr->uHeight; 3907 pThisCC->cLogoPlanes = pCoreHdr->cPlanes; 3908 pThisCC->cLogoBits = pCoreHdr->cBits; 3909 pThisCC->LogoCompression = pCoreHdr->enmCompression; 3910 pThisCC->cLogoUsedColors = pCoreHdr->cClrUsed; 3911 3911 break; 3912 3912 3913 3913 default: 3914 AssertLogRelMsgFailedReturn(("Unsupported bitmap header size %u.\n", p WinHdr->Size),3914 AssertLogRelMsgFailedReturn(("Unsupported bitmap header size %u.\n", pCoreHdr->cbSize), 3915 3915 VERR_INVALID_PARAMETER); 3916 3916 break; … … 3933 3933 VERR_INVALID_PARAMETER); 3934 3934 3935 AssertLogRelMsgReturn(pThisCC->LogoCompression == BMP_COMPRESS _NONE,3935 AssertLogRelMsgReturn(pThisCC->LogoCompression == BMP_COMPRESSION_TYPE_NONE, 3936 3936 ("Unsupported %u compression.\n", pThisCC->LogoCompression), 3937 3937 VERR_INVALID_PARAMETER); … … 3947 3947 if (pThisCC->cLogoPalEntries) 3948 3948 { 3949 const uint8_t *pbPal = pThisCC->pbLogo + sizeof(LOGOHDR) + sizeof(BMP INFO) + pWinHdr->Size; /* ASSUMES Size location (safe) */3949 const uint8_t *pbPal = pThisCC->pbLogo + sizeof(LOGOHDR) + sizeof(BMPFILEHDR) + pCoreHdr->cbSize; /* ASSUMES Size location (safe) */ 3950 3950 3951 3951 for (uint16_t i = 0; i < pThisCC->cLogoPalEntries; i++) … … 3969 3969 * Bitmap data offset 3970 3970 */ 3971 pThisCC->pbLogoBitmap = pThisCC->pbLogo + sizeof(LOGOHDR) + p BmpInfo->Offset;3971 pThisCC->pbLogoBitmap = pThisCC->pbLogo + sizeof(LOGOHDR) + pFileHdr->offBits; 3972 3972 } 3973 3973 else -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp
r85856 r85864 901 901 AssertPtrReturn(pcbDest, VERR_INVALID_POINTER); 902 902 903 P WINHDR pBmpWinHdr = (PWINHDR)pvSrc;903 PBMPWIN3XINFOHDR coreHdr = (PBMPWIN3XINFOHDR)pvSrc; 904 904 /** @todo Support all the many versions of the DIB headers. */ 905 if ( cbSrc < sizeof( WINHDR)906 || RT_LE2H_U32( pBmpWinHdr->Size) < sizeof(WINHDR)907 || RT_LE2H_U32( pBmpWinHdr->Size) != sizeof(WINHDR))905 if ( cbSrc < sizeof(BMPWIN3XINFOHDR) 906 || RT_LE2H_U32(coreHdr->cbSize) < sizeof(BMPWIN3XINFOHDR) 907 || RT_LE2H_U32(coreHdr->cbSize) != sizeof(BMPWIN3XINFOHDR)) 908 908 { 909 909 return VERR_INVALID_PARAMETER; 910 910 } 911 911 912 size_t offPixel = sizeof(BMP INFO)913 + RT_LE2H_U32( pBmpWinHdr->Size)914 + RT_LE2H_U32( pBmpWinHdr->ClrUsed) * sizeof(uint32_t);912 size_t offPixel = sizeof(BMPFILEHDR) 913 + RT_LE2H_U32(coreHdr->cbSize) 914 + RT_LE2H_U32(coreHdr->cClrUsed) * sizeof(uint32_t); 915 915 if (cbSrc < offPixel) 916 916 return VERR_INVALID_PARAMETER; 917 917 918 size_t cbDst = sizeof(BMP INFO) + cbSrc;918 size_t cbDst = sizeof(BMPFILEHDR) + cbSrc; 919 919 920 920 void *pvDest = RTMemAlloc(cbDst); … … 922 922 return VERR_NO_MEMORY; 923 923 924 PBMPINFO pBmpHdr = (PBMPINFO)pvDest; 925 926 pBmpHdr->Type = BMP_HDR_MAGIC; 927 pBmpHdr->FileSize = (uint32_t)RT_H2LE_U32(cbDst); 928 pBmpHdr->Reserved1 = pBmpHdr->Reserved2 = 0; 929 pBmpHdr->Offset = (uint32_t)RT_H2LE_U32(offPixel); 930 931 memcpy((uint8_t *)pvDest + sizeof(BMPINFO), pvSrc, cbSrc); 924 PBMPFILEHDR fileHdr = (PBMPFILEHDR)pvDest; 925 926 fileHdr->uType = BMP_HDR_MAGIC; 927 fileHdr->cbFileSize = (uint32_t)RT_H2LE_U32(cbDst); 928 fileHdr->Reserved1 = 0; 929 fileHdr->Reserved2 = 0; 930 fileHdr->offBits = (uint32_t)RT_H2LE_U32(offPixel); 931 932 memcpy((uint8_t *)pvDest + sizeof(BMPFILEHDR), pvSrc, cbSrc); 932 933 933 934 *ppvDest = pvDest; … … 945 946 AssertPtrReturn(pcbDest, VERR_INVALID_POINTER); 946 947 947 PBMP INFO pBmpHdr = (PBMPINFO)pvSrc;948 if ( cbSrc < sizeof(BMP INFO)949 || pBmpHdr-> Type != BMP_HDR_MAGIC950 || RT_LE2H_U32(pBmpHdr-> FileSize) != cbSrc)948 PBMPFILEHDR pBmpHdr = (PBMPFILEHDR)pvSrc; 949 if ( cbSrc < sizeof(BMPFILEHDR) 950 || pBmpHdr->uType != BMP_HDR_MAGIC 951 || RT_LE2H_U32(pBmpHdr->cbFileSize) != cbSrc) 951 952 { 952 953 return VERR_INVALID_PARAMETER; 953 954 } 954 955 955 *ppvDest = ((uint8_t *)pvSrc) + sizeof(BMP INFO);956 *pcbDest = cbSrc - sizeof(BMP INFO);956 *ppvDest = ((uint8_t *)pvSrc) + sizeof(BMPFILEHDR); 957 *pcbDest = cbSrc - sizeof(BMPFILEHDR); 957 958 958 959 return VINF_SUCCESS; -
trunk/src/VBox/Main/src-client/RecordingStream.cpp
r85858 r85864 637 637 638 638 #ifdef VBOX_RECORDING_DUMP 639 BMP INFO bmpHdr;640 RT_ZERO( bmpHdr);641 642 WINHDR bmpDIBHdr;643 RT_ZERO( bmpDIBHdr);644 645 bmpHdr.Type= BMP_HDR_MAGIC;646 bmpHdr.FileSize = (uint32_t)(sizeof(BMPINFO) + sizeof(WINHDR) + (w * h * uBytesPerPixel));647 bmpHdr.Offset = (uint32_t)(sizeof(BMPINFO) + sizeof(WINHDR));648 649 bmpDIBHdr.Size = sizeof(WINHDR);650 bmpDIBHdr.Width = w;651 bmpDIBHdr.Height = h;652 bmpDIBHdr.Planes = 1;653 bmpDIBHdr.BitCount= uBPP;654 bmpDIBHdr.XPelsPerMeter = 5000;655 bmpDIBHdr.YPelsPerMeter = 5000;639 BMPFILEHDR fileHdr; 640 RT_ZERO(fileHdr); 641 642 BMPWIN3XINFOHDR coreHdr; 643 RT_ZERO(coreHdr); 644 645 fileHdr.uType = BMP_HDR_MAGIC; 646 fileHdr.cbFileSize = (uint32_t)(sizeof(BMPFILEHDR) + sizeof(BMPWIN3XINFOHDR) + (w * h * uBytesPerPixel)); 647 fileHdr.offBits = (uint32_t)(sizeof(BMPFILEHDR) + sizeof(BMPWIN3XINFOHDR)); 648 649 coreHdr.cbSize = sizeof(BMPWIN3XINFOHDR); 650 coreHdr.uWidth = w; 651 coreHdr.uHeight = h; 652 coreHdr.cPlanes = 1; 653 coreHdr.cBits = uBPP; 654 coreHdr.uXPelsPerMeter = 5000; 655 coreHdr.uYPelsPerMeter = 5000; 656 656 657 657 char szFileName[RTPATH_MAX]; … … 663 663 if (RT_SUCCESS(rc2)) 664 664 { 665 RTFileWrite(fh, & bmpHdr, sizeof(bmpHdr), NULL);666 RTFileWrite(fh, & bmpDIBHdr, sizeof(bmpDIBHdr), NULL);665 RTFileWrite(fh, &fileHdr, sizeof(fileHdr), NULL); 666 RTFileWrite(fh, &coreHdr, sizeof(coreHdr), NULL); 667 667 } 668 668 #endif
Note:
See TracChangeset
for help on using the changeset viewer.

