Ignore:
Timestamp:
Nov 9, 2000, 7:15:23 PM (25 years ago)
Author:
sandervl
Message:

Icon api rewrite + small fixes

File:
1 edited

Legend:

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

    r3101 r4573  
    1 /* $Id: oslibres.cpp,v 1.10 2000-03-13 13:10:47 sandervl Exp $ */
     1/* $Id: oslibres.cpp,v 1.11 2000-11-09 18:15:18 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    2424#include "pmwindow.h"
    2525
    26 #define DBG_LOCALLOG    DBG_oslibres
     26#define DBG_LOCALLOG    DBG_oslibres
    2727#include "dbglocal.h"
    2828
     
    4646}
    4747//******************************************************************************
    48 //******************************************************************************
    49 HANDLE OSLibWinCreateIcon(PVOID iconbitmap)
     48//TODO: change search method for icon array (cxDesired, cyDesired)
     49//TODO: PM rescales the icon internally!!! ($W(#*&$(*%&)
     50//******************************************************************************
     51HANDLE OSLibWinCreateIcon(PVOID iconbitmap, ULONG cxDesired, ULONG cyDesired)
    5052{
    5153 POINTERINFO pointerInfo = {0};
     
    102104    hps = WinGetScreenPS(HWND_DESKTOP);
    103105
    104     hbmColor = GpiCreateBitmap(hps, &bfhColor->bmp2, CBM_INIT,
    105                                (char *)bafh + bfhColor->offBits,
    106                                (BITMAPINFO2 *)&bfhColor->bmp2);
     106    //Resize icon bitmap if requested size is different
     107    if(cxDesired != bfhColor->bmp2.cx|| cyDesired != bfhColor->bmp2.cy)
     108    {
     109        BITMAPINFOHEADER2 infohdr = bfhColor->bmp2;
     110
     111        infohdr.cx = cxDesired;
     112        infohdr.cy = cyDesired;
     113        hbmColor = GpiCreateBitmap(hps, &infohdr, CBM_INIT,
     114                                   (char *)bafh + bfhColor->offBits,
     115                                   (BITMAPINFO2 *)&bfhColor->bmp2);
     116    }
     117    else {
     118        hbmColor = GpiCreateBitmap(hps, &bfhColor->bmp2, CBM_INIT,
     119                                   (char *)bafh + bfhColor->offBits,
     120                                   (BITMAPINFO2 *)&bfhColor->bmp2);
     121    }
    107122    if(hbmColor == GPI_ERROR) {
    108123        dprintf(("OSLibWinCreateIcon: GpiCreateBitmap failed!"));
     
    110125        return 0;
    111126    }
    112     hbmMask = GpiCreateBitmap(hps, &bfhBW->bmp2, CBM_INIT,
    113                               (char *)bafh + bfhBW->offBits,
    114                               (BITMAPINFO2 *)&bfhBW->bmp2);
     127    //Resize icon mask if requested size is different
     128    if(cxDesired != bfhBW->bmp2.cx|| cyDesired*2 != bfhBW->bmp2.cy)
     129    {
     130        BITMAPINFOHEADER2 infohdr = bfhBW->bmp2;
     131
     132        infohdr.cx = cxDesired;
     133        infohdr.cy = cyDesired;
     134        hbmMask = GpiCreateBitmap(hps, &infohdr, CBM_INIT,
     135                                  (char *)bafh + bfhBW->offBits,
     136                                  (BITMAPINFO2 *)&bfhBW->bmp2);
     137    }
     138    else {
     139        hbmMask = GpiCreateBitmap(hps, &bfhBW->bmp2, CBM_INIT,
     140                                  (char *)bafh + bfhBW->offBits,
     141                                  (BITMAPINFO2 *)&bfhBW->bmp2);
     142    }
    115143    if(hbmMask == GPI_ERROR) {
    116144        dprintf(("OSLibWinCreateIcon: GpiCreateBitmap hbmMask failed!"));
     
    132160    GpiDeleteBitmap(hbmColor);
    133161    WinReleasePS(hps);
     162
    134163    return hIcon;
    135164}
    136165//******************************************************************************
    137 //******************************************************************************
    138 HANDLE OSLibWinCreatePointer(PVOID cursorbitmap)
     166//TODO: change cursor size if required!! (cxDesired, cyDesired)
     167//******************************************************************************
     168HANDLE OSLibWinCreatePointer(PVOID cursorbitmap, ULONG cxDesired, ULONG cyDesired)
    139169{
    140170 POINTERINFO pointerInfo = {0};
Note: See TracChangeset for help on using the changeset viewer.