Ignore:
Timestamp:
Jun 25, 2002, 9:11:10 AM (23 years ago)
Author:
sandervl
Message:

Allocate space the two missing RGB2 entries

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/oslibres.cpp

    r7943 r8753  
    1 /* $Id: oslibres.cpp,v 1.30 2002-02-18 10:14:56 sandervl Exp $ */
     1/* $Id: oslibres.cpp,v 1.31 2002-06-25 07:11:10 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    247247            pixel = 0;
    248248            memcpy(&pixel, os2rgb, increment);
    249             if(nrcolors == 0) { 
     249            if(nrcolors == 0) {
    250250                color[0] = pixel;
    251251                nrcolors = 1;
     
    257257            }
    258258            else {
    259                 if(color[0] != pixel && color[1] != pixel) 
     259                if(color[0] != pixel && color[1] != pixel)
    260260                {
    261261                    return FALSE;
     
    271271//******************************************************************************
    272272char *colorToMonoBitmap(HBITMAP bmpsrc, BITMAPINFO2 *pBmpDest)
    273 { 
     273{
    274274    HDC hdcDest = 0;            /* device context handle                */
    275275    HPS hpsDest = 0;
    276276    SIZEL sizl = { 0, 0 };  /* use same page size as device         */
    277277    DEVOPENSTRUC dop = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
    278     LONG lHits; 
     278    LONG lHits;
    279279    char *bmpbuffer = 0;
    280280    BITMAPINFO2 *bmpinfo = NULL;
     
    287287    /* create memory device context */
    288288    hdcDest = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
    289  
     289
    290290    /* Create the presentation and associate the memory device
    291291       context. */
    292292    hpsDest = GpiCreatePS(hab, hdcDest, &sizl, PU_PELS |
    293293                          GPIT_MICRO | GPIA_ASSOC);
    294     if(!hpsDest) goto fail; 
     294    if(!hpsDest) goto fail;
    295295
    296296    GpiSetBitmap(hpsDest, bmpsrc);
     
    322322                else WriteLogNoEOL(".");
    323323            }
    324             else 
     324            else
    325325            if(j<16) {
    326326                if((*(bmpbuffer+1+i*4)) & (1<<(15-j))) {
     
    355355    free(bmpinfo);
    356356
    357     return bmpbuffer; 
     357    return bmpbuffer;
    358358
    359359fail:
     
    374374//      Assumes 1 bpp bitmaps have a top left origin and all others have a bottom left origin
    375375//******************************************************************************
    376 HANDLE OSLibWinCreatePointer(CURSORICONINFO *pInfo, char *pAndBits, BITMAP_W *pAndBmp, char *pXorBits, 
     376HANDLE OSLibWinCreatePointer(CURSORICONINFO *pInfo, char *pAndBits, BITMAP_W *pAndBmp, char *pXorBits,
    377377                             BITMAP_W *pXorBmp, BOOL fCursor)
    378378{
     
    434434                }
    435435        }
    436         else   
     436        else
    437437        if(pXorBmp->bmBitsPixel == 16) {
    438438                ConvertRGB555to565(os2rgb, rgb, pXorBmp->bmHeight * pXorBmp->bmWidthBytes);
     
    447447                goto fail;
    448448        }
    449         if(fCursor && pXorBmp->bmBitsPixel >= 8) 
     449        if(fCursor && pXorBmp->bmBitsPixel >= 8)
    450450        {
    451             if(fForceMonoCursor || isMonoBitmap(pXorBmp, (PBYTE)os2rgb) == TRUE) 
     451            if(fForceMonoCursor || isMonoBitmap(pXorBmp, (PBYTE)os2rgb) == TRUE)
    452452            {
    453453                pOS2XorBits = colorToMonoBitmap(hbmColor, pBmpColor);
     
    466466    //SvL: 2*sizeof(RGB2) is enough, but GpiCreateBitmap seems to touch more
    467467    //     memory. (Adobe Photoshop 6 running in the debugger)
    468     masksize = sizeof(BITMAPINFO2) + (pAndBmp->bmHeight * 2 * pAndBmp->bmWidthBytes) + 16*sizeof(RGB2);
     468    //bird: We should reserve the amount required anythingelse is stupid.
     469    //      Looks like it's reading 3 bytes too much... Hopefully that's due to the
     470    //      &pBmpMask->argbColor[2] which it assumes is 16 colors long. But no proofs.
     471    masksize = sizeof(BITMAPINFO2) + (pAndBmp->bmHeight * 2 * pAndBmp->bmWidthBytes) + (16+2)*sizeof(RGB2);
    469472    pBmpMask = (BITMAPINFO2 *)malloc(masksize);
    470473    if(pBmpMask == NULL) {
     
    723726//******************************************************************************
    724727//******************************************************************************
    725 BOOL WIN32API OSLibWinCreateObject(LPSTR pszPath, LPSTR pszArgs, 
    726                                    LPSTR pszWorkDir, LPSTR pszLink, 
     728BOOL WIN32API OSLibWinCreateObject(LPSTR pszPath, LPSTR pszArgs,
     729                                   LPSTR pszWorkDir, LPSTR pszLink,
    727730                                   LPSTR pszDescription, LPSTR pszIcoPath,
    728731                                   INT iIcoNdx, BOOL fDesktop)
     
    748751       }
    749752   }
    750    dprintf(("OSLibWinCreateObject %s %s %s\n    %s %s %s %d %d", pszPath, pszArgs, 
     753   dprintf(("OSLibWinCreateObject %s %s %s\n    %s %s %s %d %d", pszPath, pszArgs,
    751754            pszWorkDir, pszName, pszDescription, pszIcoPath, iIcoNdx, fDesktop));
    752755   dprintf(("Link path %s", pszLink));
     
    761764   }
    762765
    763    pszSetupString = (LPSTR)malloc(128 + strlen(pszPath) + strlen(pszName) + 
     766   pszSetupString = (LPSTR)malloc(128 + strlen(pszPath) + strlen(pszName) +
    764767                                  strlen(pszLink) + 2*strlen(szSystemDir) +
    765768                                  strlen(szWorkDir) + strlen(pszIcoPath) +
    766                                   ((pszArgs) ? strlen(pszArgs) : 0) + 
    767                                   ((pszWorkDir) ? strlen(pszWorkDir) : 0)); 
     769                                  ((pszArgs) ? strlen(pszArgs) : 0) +
     770                                  ((pszWorkDir) ? strlen(pszWorkDir) : 0));
    768771
    769772   sprintf(pszSetupString, "PROGTYPE=PM;OBJECTID=<%s>;EXENAME=%s\\PE.EXE;SET BEGINLIBPATH=%s;STARTUPDIR=%s;ICONFILE=%s;PARAMETERS=\"%s\"", pszName, szSystemDir, szSystemDir, szWorkDir, pszIcoPath, pszPath);
     
    777780       dprintf(("Name = %s", pszName));
    778781       dprintf(("Setup string = %s", pszSetupString));
    779        hObject = WinCreateObject("WPProgram", pszName, pszSetupString, 
     782       hObject = WinCreateObject("WPProgram", pszName, pszSetupString,
    780783                                 "<WP_DESKTOP>", CO_REPLACEIFEXISTS);
    781784   }
     
    788791       hObject = WinCreateObject("WPFolder", pszFolder, szWorkDir,
    789792                                 "<ODINFOLDER>", CO_UPDATEIFEXISTS);
    790        hObject = WinCreateObject("WPProgram", pszName, pszSetupString, 
     793       hObject = WinCreateObject("WPProgram", pszName, pszSetupString,
    791794                                 temp, CO_REPLACEIFEXISTS);
    792795   }
    793796// If SysCreateObject("WPProgram", "WarpMix", "<ICHAUDIO>",,
    794 //                    "PROGTYPE=PM;OBJECTID=<WARPMIX>;ICONFILE=WARPMIX.ICO;EXENAME="||bootDrive||"\MMOS2\WARPMIX.EXE") 
     797//                    "PROGTYPE=PM;OBJECTID=<WARPMIX>;ICONFILE=WARPMIX.ICO;EXENAME="||bootDrive||"\MMOS2\WARPMIX.EXE")
    795798
    796799   free(pszSetupString);
Note: See TracChangeset for help on using the changeset viewer.