Changeset 37 for trunk/src/gdi32
- Timestamp:
- Jun 6, 1999, 2:25:49 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/gdi32.cpp
r4 r37 1 /* $Id: gdi32.cpp,v 1. 1 1999-05-24 20:19:39 ktkExp $ */1 /* $Id: gdi32.cpp,v 1.2 1999-06-06 12:25:48 cbratschi Exp $ */ 2 2 3 3 /* … … 43 43 } POLYTEXTW; 44 44 45 46 static ULONG CalcBitmapSize(ULONG cBits, LONG cx, LONG cy) 47 { 48 ULONG alignment; 49 ULONG factor; 50 BOOL flag = TRUE; //true: '*' false: '/' 51 52 cy = cy < 0 ? -cy : cy; 53 54 switch(cBits) 55 { 56 case 1: 57 factor = 8; 58 flag = FALSE; 59 break; 60 61 case 4: 62 factor = 2; 63 flag = FALSE; 64 break; 65 66 case 8: 67 factor = 1; 68 break; 69 70 case 16: 71 factor = 2; 72 break; 73 74 case 24: 75 factor = 3; 76 break; 77 78 case 32: 79 return cx*cy; 80 81 default: 82 return 0; 83 } 84 85 if (flag) 86 alignment = (cx = (cx*factor)) % 4; 87 else 88 alignment = (cx = ((cx+factor-1)/factor)) % 4; 89 90 if (alignment != 0) 91 cx += 4 - alignment; 92 93 return cx*cy; 94 } 45 95 46 96 //****************************************************************************** … … 1815 1865 //****************************************************************************** 1816 1866 //****************************************************************************** 1817 INT WIN32API SetDIBitsToDevice( HDC arg1, INT arg2, INT arg3, DWORD arg4, DWORD arg5, INT arg6, INT arg7, UINT arg8, UINT arg9, LPCVOID arg10, const BITMAPINFO *arg11, UINT arg12) 1818 { 1819 dprintf(("GDI32: OS2SetDIBitsToDevice")); 1820 return O32_SetDIBitsToDevice(arg1, arg2, arg3, (int)arg4, (int)arg5, arg6, arg7, arg8, arg9, (PVOID)arg10, (PBITMAPINFO)arg11, arg12); 1867 INT WIN32API SetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, DWORD cy, INT xSrc, INT ySrc, UINT startscan, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse) 1868 { 1869 INT result, imgsize, palsize; 1870 char *ptr; 1871 1872 dprintf(("GDI32: OS2SetDIBitsToDevice hdc:%X xDest:%d yDest:%d, cx:%d, cy:%d, xSrc:%d, ySrc:%d, startscan:%d, lines:%d, bits:%X, info%X, coloruse:%d", 1873 hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (LPVOID) bits, (PBITMAPINFO)info, coloruse)); 1874 1875 // EB: ->>> Crazy. Nobody seen this Open32 bug ? 1876 // Dont't like dirty pointers, but Open32 needs a bit help. 1877 // Only tested with winmine. 1878 palsize = (1 << info->bmiHeader.biBitCount) * sizeof(RGBQUAD); 1879 imgsize = CalcBitmapSize(info->bmiHeader.biBitCount, 1880 info->bmiHeader.biWidth, info->bmiHeader.biHeight); 1881 ptr = ((char *)info) + palsize + sizeof(BITMAPINFOHEADER); 1882 if(bits >= ptr && bits < ptr + imgsize) 1883 { 1884 bits = (char *)bits - imgsize + 1885 CalcBitmapSize(info->bmiHeader.biBitCount, 1886 info->bmiHeader.biWidth, lines); 1887 } 1888 // EB: <<<- 1889 1890 result = O32_SetDIBitsToDevice(hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (PVOID) bits, (PBITMAPINFO)info, coloruse); 1891 return result; 1821 1892 } 1822 1893 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.