- Timestamp:
- Jan 28, 2000, 11:24:58 PM (26 years ago)
- Location:
- trunk/src/gdi32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/gdi32.cpp
r2527 r2551 1 /* $Id: gdi32.cpp,v 1.3 3 2000-01-26 23:48:02sandervl Exp $ */1 /* $Id: gdi32.cpp,v 1.34 2000-01-28 22:24:57 sandervl Exp $ */ 2 2 3 3 /* … … 20 20 #include <codepage.h> 21 21 #include "oslibgpi.h" 22 #include "oslibgdi.h" 22 23 23 24 static ULONG QueryPaletteSize(BITMAPINFOHEADER *pBHdr) … … 689 690 //****************************************************************************** 690 691 //****************************************************************************** 691 HDC WIN32API CreateDCA( LPCSTR arg1, LPCSTR arg2, LPCSTR arg3, const DEVMODEA * arg4) 692 { 693 dprintf(("GDI32: CreateDCA")); 694 return O32_CreateDC(arg1, arg2, arg3, arg4); 692 HDC WIN32API CreateDCA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput, const DEVMODEA *lpInitData) 693 { 694 HDC hdc; 695 696 hdc = O32_CreateDC(lpszDriver, lpszDevice, lpszOutput, lpInitData); 697 dprintf(("GDI32: CreateDCA %s %s %s %x returned %x", lpszDriver, lpszDevice, lpszOutput, lpInitData, hdc)); 698 return hdc; 695 699 } 696 700 //****************************************************************************** … … 1029 1033 //****************************************************************************** 1030 1034 //****************************************************************************** 1031 int WIN32API SetROP2( HDC arg1, int arg2)1032 { 1033 dprintf(("GDI32: SetROP2 "));1034 return O32_SetROP2( arg1, arg2);1035 int WIN32API SetROP2( HDC hdc, int rop2) 1036 { 1037 dprintf(("GDI32: SetROP2 %x %x", hdc, rop2)); 1038 return O32_SetROP2(hdc, rop2); 1035 1039 } 1036 1040 //****************************************************************************** … … 1256 1260 //****************************************************************************** 1257 1261 //****************************************************************************** 1258 int WIN32API GetDIBits( HDC arg1, HBITMAP arg2, UINT arg3, UINT arg4, void * arg5, PBITMAPINFO arg6, UINT arg7) 1259 { 1260 dprintf(("GDI32: GetDIBits")); 1261 return O32_GetDIBits(arg1, arg2, arg3, arg4, arg5, arg6, arg7); 1262 int WIN32API GetDIBits(HDC hdc, HBITMAP hBitmap, UINT uStartScan, UINT cScanLines, 1263 void *lpvBits, PBITMAPINFO lpbi, UINT uUsage) 1264 { 1265 int rc; 1266 1267 rc = O32_GetDIBits(hdc, hBitmap, uStartScan, cScanLines, lpvBits, lpbi, uUsage); 1268 dprintf(("GDI32: GetDIBits %x %x %d %d %x %x %d returned %d", hdc, hBitmap, uStartScan, cScanLines, lpvBits, lpbi, uUsage, rc)); 1269 //SvL: Wrong Open32 return value 1270 return (rc == TRUE) ? cScanLines : 0; 1262 1271 } 1263 1272 //****************************************************************************** … … 1943 1952 //****************************************************************************** 1944 1953 //****************************************************************************** 1945 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) 1946 { 1947 INT result, imgsize, palsize; 1954 INT WIN32API SetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, 1955 DWORD cy, INT xSrc, INT ySrc, 1956 UINT startscan, UINT lines, LPCVOID bits, 1957 const BITMAPINFO *info, UINT coloruse) 1958 { 1959 INT result, imgsize, palsize, height, width; 1948 1960 char *ptr; 1949 1961 1950 dprintf(("GDI32: SetDIBitsToDevice hdc:%X xDest:%d yDest:%d, cx:%d, cy:%d, xSrc:%d, ySrc:%d, startscan:%d, lines:%d, bits:%X, info%X, coloruse:%d", 1951 hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (LPVOID) bits, (PBITMAPINFO)info, coloruse)); 1962 SetLastError(0); 1963 if(info == NULL) { 1964 goto invalid_parameter; 1965 } 1966 height = info->bmiHeader.biHeight; 1967 width = info->bmiHeader.biWidth; 1968 1969 if (height < 0) height = -height; 1970 if (!lines || (startscan >= height)) { 1971 goto invalid_parameter; 1972 } 1973 if (startscan + lines > height) lines = height - startscan; 1974 1975 if (ySrc < startscan) ySrc = startscan; 1976 else if (ySrc >= startscan + lines) goto invalid_parameter; 1977 1978 if (xSrc >= width) goto invalid_parameter; 1979 1980 if (ySrc + cy >= startscan + lines) cy = startscan + lines - ySrc; 1981 1982 if (xSrc + cx >= width) cx = width - xSrc; 1983 1984 if (!cx || !cy) goto invalid_parameter; 1952 1985 1953 1986 // EB: ->>> Crazy. Nobody seen this Open32 bug ? … … 1966 1999 // EB: <<<- 1967 2000 1968 result = O32_SetDIBitsToDevice(hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (PVOID) bits, (PBITMAPINFO)info, coloruse); 2001 // if(xDest == 0 && yDest == 0 && xSrc == 0 && ySrc == 0 && cx == width && cy == height) { 2002 // result = OSLibSetDIBitsToDevice(hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (PVOID) bits, (WINBITMAPINFOHEADER*)info, coloruse); 2003 // } 2004 // else { 2005 result = O32_SetDIBitsToDevice(hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (PVOID) bits, (PBITMAPINFO)info, coloruse); 2006 //SvL: Wrong Open32 return value 2007 result = (result == TRUE) ? lines : 0; 2008 // } 2009 2010 dprintf(("GDI32: SetDIBitsToDevice hdc:%X xDest:%d yDest:%d, cx:%d, cy:%d, xSrc:%d, ySrc:%d, startscan:%d, lines:%d, bits:%X, info%X, coloruse:%d returned %d", 2011 hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (LPVOID) bits, (PBITMAPINFO)info, coloruse, result)); 1969 2012 return result; 2013 2014 invalid_parameter: 2015 SetLastError(ERROR_INVALID_PARAMETER); 2016 return 0; 1970 2017 } 1971 2018 //****************************************************************************** -
trunk/src/gdi32/oslibgdi.cpp
r2049 r2551 1 /* $Id: oslibgdi.cpp,v 1. 2 1999-12-09 16:49:45 cbratschiExp $ */1 /* $Id: oslibgdi.cpp,v 1.3 2000-01-28 22:24:58 sandervl Exp $ */ 2 2 3 3 /* … … 27 27 UINT coloruse) 28 28 { 29 INT result ;29 INT result, rc; 30 30 POINTL points[4]; 31 BITMAPINFO2 os2bmpinfo; 31 32 32 33 // This is a quick hack. Only tested with winmine. Need much more testing. 33 34 // TODO: check parameter and info structure 34 35 lines = (int)lines >= 0 ? (int)lines : (int)-lines; 35 36 #if 0 // WINE99050837 tmpheight = height = info->bmiHeader.biHeight;38 width = info->bmiHeader.biWidth;39 if (height < 0) height = -height;40 if (!lines || (startscan >= height)) return 0;41 if (startscan + lines > height) lines = height - startscan;42 if (ySrc < startscan) ySrc = startscan;43 else if (ySrc >= startscan + lines) return 0;44 if (xSrc >= width) return 0;45 if (ySrc + cy >= startscan + lines) cy = startscan + lines - ySrc;46 if (xSrc + cx >= width) cx = width - xSrc;47 if (!cx || !cy) return 0;48 49 descr.dc = dc;50 descr.bits = bits;51 descr.image = NULL;52 descr.lines = tmpheight >= 0 ? lines : -lines;53 descr.infoWidth = width;54 descr.depth = dc->w.bitsPerPixel;55 descr.drawable = physDev->drawable;56 descr.gc = physDev->gc;57 descr.xSrc = xSrc;58 descr.ySrc = tmpheight >= 0 ? lines-(ySrc-startscan)-cy+(oldcy-cy)59 : ySrc - startscan;60 descr.xDest = dc->w.DCOrgX + XLPTODP( dc, xDest );61 descr.yDest = dc->w.DCOrgY + YLPTODP( dc, yDest ) +62 (tmpheight >= 0 ? oldcy-cy : 0);63 descr.width = cx;64 descr.height = cy;65 #endif66 36 67 37 points[0].x = xDest; … … 74 44 points[3].y = ySrc + lines; 75 45 76 // WINBITMAPINFOHEADER and BITMAPINFO2 are identical 77 GpiDrawBits((HPS)hdc, (VOID *)bits, (BITMAPINFO2 *)info, 4, 78 points, ROP_SRCCOPY, BBO_IGNORE); 46 memset(&os2bmpinfo, 0, sizeof(os2bmpinfo)); 47 os2bmpinfo.cbFix = sizeof(BITMAPINFO2) - sizeof(RGB2); 48 os2bmpinfo.cx = info->biWidth; 49 os2bmpinfo.cy = info->biHeight; 50 os2bmpinfo.cPlanes = info->biPlanes; 51 os2bmpinfo.cBitCount = info->biBitCount; 52 os2bmpinfo.ulCompression = info->biCompression; 53 os2bmpinfo.cbImage = info->biSizeImage; 54 os2bmpinfo.cxResolution = info->biXPelsPerMeter; 55 os2bmpinfo.cyResolution = info->biYPelsPerMeter; 56 os2bmpinfo.cclrUsed = info->biClrUsed; 57 os2bmpinfo.cclrImportant = info->biClrImportant; 79 58 59 // rc = GpiDrawBits((HPS)hdc, (VOID *)bits, &os2bmpinfo, 4, 60 // points, ROP_SRCCOPY, BBO_IGNORE); 61 62 // if(rc != GPI_OK) { 63 // dprintf(("GpiDrawBits returned %d", rc)); 64 // } 80 65 return lines; 81 66 } 82 67 //****************************************************************************** 83 68 //****************************************************************************** 84
Note:
See TracChangeset
for help on using the changeset viewer.