Ignore:
Timestamp:
Nov 27, 2002, 2:56:27 PM (23 years ago)
Author:
sandervl
Message:

CopyBitmap fix + use PM bitmaps for standard user32 frame buttons in OS/2 GUI mode

File:
1 edited

Legend:

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

    r8112 r9437  
    1 /* $Id: loadres.cpp,v 1.39 2002-03-22 12:51:17 sandervl Exp $ */
     1/* $Id: loadres.cpp,v 1.40 2002-11-27 13:56:26 sandervl Exp $ */
    22
    33/*
     
    166166    int size;
    167167
     168    //if in OS/2 mode, then we must replace the standard button bitmaps
     169    //(min, max, restore, close)
     170#ifdef NEW_WGSS
     171    if(fOS2Look && (hinst == hInstanceUser32 || !hinst)) {
     172        switch((ULONG)lpszName) {
     173        case OBM_CLOSE:
     174            return CopyImage(hBmpCloseButton, IMAGE_BITMAP, 0, 0, 0);
     175        case OBM_CLOSED:
     176            return CopyImage(hBmpCloseButtonDown, IMAGE_BITMAP, 0, 0, 0);
     177        case OBM_RESTORE:
     178            return CopyImage(hBmpRestoreButton, IMAGE_BITMAP, 0, 0, 0);
     179        case OBM_RESTORED:
     180            return CopyImage(hBmpRestoreButtonDown, IMAGE_BITMAP, 0, 0, 0);
     181        case OBM_REDUCE:
     182            return CopyImage(hBmpMinButton, IMAGE_BITMAP, 0, 0, 0);
     183        case OBM_REDUCED:
     184            return CopyImage(hBmpMinButtonDown, IMAGE_BITMAP, 0, 0, 0);
     185        case OBM_ZOOM:
     186            return CopyImage(hBmpMaxButton, IMAGE_BITMAP, 0, 0, 0);
     187        case OBM_ZOOMD:
     188            return CopyImage(hBmpMaxButtonDown, IMAGE_BITMAP, 0, 0, 0);
     189        }
     190    }
     191#endif
    168192    if (!(fuLoad & LR_LOADFROMFILE))
    169193    {
     
    304328    }
    305329
     330#ifdef __WIN32OS2__
     331    BITMAPINFO* pInfo;
     332    HBITMAP oldbmp;
     333    HDC     hdc;
     334    int     colortablesize, bmpsize, headersize;
     335    char   *pBitmapData;
     336
     337    colortablesize = 0;
     338
     339    if(bm.bmBitsPixel <= 8) {
     340        colortablesize = sizeof(RGBQUAD)*(1<<bm.bmBitsPixel);
     341    }
     342    bmpsize = DIB_GetDIBImageBytes(bm.bmWidth, bm.bmHeight, bm.bmBitsPixel);
     343    headersize = sizeof(BITMAPINFO)+colortablesize+3*sizeof(DWORD); //+ extra space for > 8bpp images
     344
     345    pInfo = (BITMAPINFO *)malloc(headersize+bmpsize);
     346    if(pInfo == NULL) {
     347        DebugInt3();
     348        return 0;
     349    }
     350    pBitmapData = (char*)((char *)pInfo + headersize);
     351    memset(pInfo, 0, headersize+bmpsize);
     352
     353    hdc = CreateCompatibleDC(0);
     354
     355    pInfo->bmiHeader.biSize     = sizeof(BITMAPINFOHEADER);
     356    pInfo->bmiHeader.biPlanes   = bm.bmPlanes;
     357    pInfo->bmiHeader.biBitCount = bm.bmBitsPixel;
     358    pInfo->bmiHeader.biWidth    = bm.bmWidth;
     359    pInfo->bmiHeader.biHeight   = bm.bmHeight;
     360
     361    GetDIBits(hdc, hBitmap, 0, bm.bmHeight, pBitmapData, pInfo, DIB_RGB_COLORS);
     362
     363    res = CreateDIBitmap(hdc, &pInfo->bmiHeader, CBM_INIT, pBitmapData,
     364                         pInfo, DIB_RGB_COLORS );
     365
     366    DeleteDC(hdc);
     367    free(pInfo);
     368#else
    306369    bm.bmBits = NULL;
    307370    res = CreateBitmapIndirect(&bm);
     
    315378        HeapFree( GetProcessHeap(), 0, buf );
    316379    }
     380#endif
    317381    return res;
    318382}
Note: See TracChangeset for help on using the changeset viewer.