Ignore:
Timestamp:
Sep 5, 2001, 2:05:03 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/imagelist.c

    r6380 r6644  
     1/* $Id: imagelist.c,v 1.15 2001-09-05 12:04:58 bird Exp $ */
    12/*
    23 *  ImageList implementation
     
    2021 *    - ImageList_Draw, ImageList_DrawEx and ImageList_GetIcon use
    2122 *      ImageList_DrawIndirect. Since ImageList_DrawIndirect is still
    22  *      partially implemented, the functions mentioned above will be 
     23 *      partially implemented, the functions mentioned above will be
    2324 *      limited in functionality too.
    2425 */
     
    6970
    7071/*************************************************************************
    71  * IMAGELIST_InternalExpandBitmaps [Internal] 
     72 * IMAGELIST_InternalExpandBitmaps [Internal]
    7273 *
    7374 * Expands the bitmaps of an image list by the given number of images.
     
    9293    if ((himl->cCurImage + nImageCount < himl->cMaxImage)
    9394        && (himl->cy >= cy))
    94         return;
     95    return;
    9596
    9697    if (cy == 0) cy = himl->cy;
     
    116117
    117118    if (himl->hbmMask) {
    118         hbmNewBitmap = 
     119        hbmNewBitmap =
    119120            CreateBitmap (nNewWidth, cy, 1, 1, NULL);
    120121
     
    138139
    139140/*************************************************************************
    140  * IMAGELIST_InternalDraw [Internal] 
     141 * IMAGELIST_InternalDraw [Internal]
    141142 *
    142143 * Draws the image in the ImageList (without the mask)
     
    151152 *
    152153 * NOTES
    153  *     This function is used by ImageList_DrawIndirect, when it is 
     154 *     This function is used by ImageList_DrawIndirect, when it is
    154155 *     required to draw only the Image (without the mask) to the screen.
    155156 *
     
    164165    hImageDC = CreateCompatibleDC(0);
    165166    hOldBitmap = SelectObject(hImageDC, pimldp->himl->hbmImage);
    166     BitBlt(pimldp->hdcDst, 
     167    BitBlt(pimldp->hdcDst,
    167168        pimldp->x, pimldp->y, cx, cy,
    168         hImageDC, 
    169         pimldp->himl->cx * pimldp->i, 0, 
     169        hImageDC,
     170        pimldp->himl->cx * pimldp->i, 0,
    170171        SRCCOPY);
    171172
     
    176177
    177178/*************************************************************************
    178  * IMAGELIST_InternalDrawMask [Internal] 
     179 * IMAGELIST_InternalDrawMask [Internal]
    179180 *
    180181 * Draws the image in the ImageList with the mask
     
    189190 *
    190191 * NOTES
    191  *     This function is used by ImageList_DrawIndirect, when it is 
     192 *     This function is used by ImageList_DrawIndirect, when it is
    192193 *     required to draw the Image with the mask to the screen.
    193194 *
     
    205206    UINT fStyle = pimldp->fStyle & (~ILD_OVERLAYMASK);
    206207
    207     /* 
    208      * We need a dc and bitmap to draw on that is 
     208    /*
     209     * We need a dc and bitmap to draw on that is
    209210     * not on the screen.
    210211     */
     
    221222    hOffScreenDC = CreateCompatibleDC( pimldp->hdcDst );
    222223
    223     if ( hOffScreenDC ) 
     224    if ( hOffScreenDC )
    224225    {
    225226        hOffScreenBmp = CreateCompatibleBitmap( pimldp->hdcDst, cx, cy );
    226227
    227         if ( hOffScreenBmp ) 
     228        if ( hOffScreenBmp )
    228229            SelectObject( hOffScreenDC, hOffScreenBmp  );
    229230        else
     
    235236    hOldBitmapImage = SelectObject(hImageDC, himlLocal->hbmImage);
    236237    hOldBitmapMask = SelectObject(hMaskDC, himlLocal->hbmMask);
    237    
    238     /* 
    239      * Get a copy of the image for the masking operations. 
     238
     239    /*
     240     * Get a copy of the image for the masking operations.
    240241     * We will use the copy, and this dc for all the various
    241242     * blitting, and then do one final blit to the screen dc.
    242243     * This should clean up most of the flickering.
    243244     */
    244     BitBlt( hOffScreenDC, 0, 0, cx, cy, pimldp->hdcDst, pimldp->x, 
     245    BitBlt( hOffScreenDC, 0, 0, cx, cy, pimldp->hdcDst, pimldp->x,
    245246            pimldp->y, SRCCOPY);
    246247
    247     /* 
     248    /*
    248249     * Draw the Background for the appropriate Styles
    249250     */
    250     if( bUseCustomBackground && (fStyle == ILD_NORMAL || fStyle & ILD_IMAGE 
     251    if( bUseCustomBackground && (fStyle == ILD_NORMAL || fStyle & ILD_IMAGE
    251252         || bBlendFlag) )
    252253    {
    253        
     254
    254255        hBrush = CreateSolidBrush (himlLocal->clrBk);
    255256        hOldBrush = SelectObject (pimldp->hdcDst, hBrush);
    256        
     257
    257258        PatBlt( hOffScreenDC, pimldp->x, pimldp->y, cx, cy, PATCOPY );
    258259
     
    260261    }
    261262
    262     /* 
     263    /*
    263264     * Draw Image Transparently over the current background
    264265     */
    265     if(fStyle == ILD_NORMAL || (fStyle & ILD_TRANSPARENT) || 
    266        ((fStyle & ILD_IMAGE) && bUseCustomBackground) || bBlendFlag) 
    267     {   /* 
     266    if(fStyle == ILD_NORMAL || (fStyle & ILD_TRANSPARENT) ||
     267       ((fStyle & ILD_IMAGE) && bUseCustomBackground) || bBlendFlag)
     268    {   /*
    268269         * To obtain a transparent look, background color should be set
    269          * to white and foreground color to black when blting the 
    270          * monochrome mask. 
     270         * to white and foreground color to black when blting the
     271         * monochrome mask.
    271272         */
    272        
    273         oldBkColor = SetBkColor( hOffScreenDC, RGB( 0xff, 0xff, 0xff ) ); 
     273
     274        oldBkColor = SetBkColor( hOffScreenDC, RGB( 0xff, 0xff, 0xff ) );
    274275        oldFgColor = SetTextColor( hOffScreenDC, RGB( 0, 0, 0 ) );
    275276
     
    279280        BitBlt( hOffScreenDC, 0, 0, cx, cy, hImageDC,himlLocal->cx * pimldp->i,
    280281                0, SRCPAINT );
    281    
    282     }
    283    
     282
     283    }
     284
    284285    /*
    285286     * Draw the image when no Background is specified
     
    287288    else if((fStyle & ILD_IMAGE) && !bUseCustomBackground)
    288289    {
    289         BitBlt( hOffScreenDC, 0, 0, cx, cy, hImageDC, 
     290        BitBlt( hOffScreenDC, 0, 0, cx, cy, hImageDC,
    290291                himlLocal->cx * pimldp->i, 0, SRCCOPY);
    291292    }
    292     /* 
     293    /*
    293294     * Draw the mask with or without a background
    294295     */
     
    298299                0, bUseCustomBackground ? SRCCOPY : SRCAND);
    299300    }
    300    
     301
    301302    /*
    302303     * Blit the bitmap to the screen now.
     
    305306            hOffScreenDC, 0, 0, SRCCOPY);
    306307
    307    
     308
    308309    SelectObject(hImageDC, hOldBitmapImage);
    309310    SelectObject(hMaskDC, hOldBitmapMask);
    310    
     311
    311312cleanup:
    312    
     313
    313314    DeleteDC(hImageDC);
    314315    DeleteDC(hMaskDC);
    315    
     316
    316317    DeleteDC( hOffScreenDC );
    317318    DeleteObject( hOffScreenBmp );
    318    
     319
    319320    return;
    320321}
    321322
    322323/*************************************************************************
    323  * IMAGELIST_InternalDrawBlend [Internal] 
    324  *
    325  * Draws the Blend over the current image 
     324 * IMAGELIST_InternalDrawBlend [Internal]
     325 *
     326 * Draws the Blend over the current image
    326327 *
    327328 * PARAMS
     
    334335 *
    335336 * NOTES
    336  *     This functions is used by ImageList_DrawIndirect, when it is 
    337  *     required to add the blend to the current image. 
    338  *     
     337 *     This functions is used by ImageList_DrawIndirect, when it is
     338 *     required to add the blend to the current image.
     339 *
    339340 */
    340341static VOID
     
    375376
    376377        BitBlt(hBlendMaskDC,
    377             0,0, cx, cy, 
     378            0,0, cx, cy,
    378379            hMaskDC,
    379380            himlLocal->cx * pimldp->i,0,
     
    381382
    382383        BitBlt(hBlendMaskDC,
    383             0,0, cx, cy, 
     384            0,0, cx, cy,
    384385            hBlendMaskDC,
    385             0,0, 
     386            0,0,
    386387            NOTSRCCOPY);
    387388
     
    397398    hOldBrush = (HBRUSH) SelectObject (pimldp->hdcDst, hBlendColorBrush);
    398399
    399     BitBlt (pimldp->hdcDst, 
    400         pimldp->x, pimldp->y, cx, cy, 
    401         hBlendMaskDC, 
    402         0, 0, 
     400    BitBlt (pimldp->hdcDst,
     401        pimldp->x, pimldp->y, cx, cy,
     402        hBlendMaskDC,
     403        0, 0,
    403404        0xB8074A); /* PSDPxax */
    404405
     
    413414
    414415/*************************************************************************
    415  * IMAGELIST_InternalDrawOverlay [Internal] 
    416  *
    417  * Draws the overlay image 
     416 * IMAGELIST_InternalDrawOverlay [Internal]
     417 *
     418 * Draws the overlay image
    418419 *
    419420 * PARAMS
     
    426427 *
    427428 * NOTES
    428  *     This functions is used by ImageList_DrawIndirect, when it is 
     429 *     This functions is used by ImageList_DrawIndirect, when it is
    429430 *     required to draw the overlay
    430431 *
    431  *     
    432  */
    433 static VOID 
     432 *
     433 */
     434static VOID
    434435IMAGELIST_InternalDrawOverlay(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
    435436{
     
    447448            if (pimldp->himl->hbmMask)
    448449            {
    449                 hOldBitmap = (HBITMAP) SelectObject (hImageDC, 
     450                hOldBitmap = (HBITMAP) SelectObject (hImageDC,
    450451                    pimldp->himl->hbmMask);
    451452
    452                 BitBlt (pimldp->hdcDst, 
     453                BitBlt (pimldp->hdcDst,
    453454                    pimldp->x, pimldp->y, cx, cy,
    454455                    hImageDC, pimldp->himl->cx * nOvlIdx, 0,
     
    457458                SelectObject(hImageDC, hOldBitmap);
    458459            }
    459             hOldBitmap = (HBITMAP) SelectObject (hImageDC, 
     460            hOldBitmap = (HBITMAP) SelectObject (hImageDC,
    460461                pimldp->himl->hbmImage);
    461462
    462             BitBlt (pimldp->hdcDst, 
    463                 pimldp->x, pimldp->y, cx, cy, 
     463            BitBlt (pimldp->hdcDst,
     464                pimldp->x, pimldp->y, cx, cy,
    464465                hImageDC,
    465466                pimldp->himl->cx * nOvlIdx, 0,
     
    492493
    493494INT WINAPI
    494 ImageList_Add (HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
     495ImageList_Add (HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
    495496{
    496497    HDC     hdcImage, hdcBitmap;
     
    531532        hOldBitmapTemp = (HBITMAP) SelectObject(hdcTemp, hbmMask);
    532533
    533         BitBlt (hdcMask, 
     534        BitBlt (hdcMask,
    534535            nStartX, 0, bmp.bmWidth, bmp.bmHeight,
    535             hdcTemp, 
    536             0, 0, 
     536            hdcTemp,
     537            0, 0,
    537538            SRCCOPY);
    538539
     
    542543        /* Remove the background from the image
    543544        */
    544         BitBlt (hdcImage, 
     545        BitBlt (hdcImage,
    545546            nStartX, 0, bmp.bmWidth, bmp.bmHeight,
    546             hdcMask, 
    547             nStartX, 0, 
     547            hdcMask,
     548            nStartX, 0,
    548549            0x220326); /* NOTSRCAND */
    549550
     
    586587
    587588/*************************************************************************
    588  * ImageList_AddMasked [COMCTL32.42] 
     589 * ImageList_AddMasked [COMCTL32.42]
    589590 *
    590591 * Adds an image or images to an image list and creates a mask from the
     
    651652        GetPixel (hdcBitmap, 0, 0);
    652653    SetBkColor (hdcBitmap, bkColor);
    653     BitBlt (hdcMask, 
     654    BitBlt (hdcMask,
    654655        nMaskXOffset, 0, bmp.bmWidth, bmp.bmHeight,
    655         hdcBitmap, 0, 0, 
     656        hdcBitmap, 0, 0,
    656657        SRCCOPY);
    657658
     
    668669        This is here in case some apps rely on this bug
    669670    */
    670     BitBlt(hdcBitmap, 
     671    BitBlt(hdcBitmap,
    671672        0, 0, bmp.bmWidth, bmp.bmHeight,
    672         hdcMask, 
    673         nMaskXOffset, 0, 
     673        hdcMask,
     674        nMaskXOffset, 0,
    674675        0x220326); /* NOTSRCAND */
    675676    /* Copy result to the imagelist
    676677    */
    677     BitBlt (hdcImage, 
     678    BitBlt (hdcImage,
    678679        nIndex * himl->cx, 0, bmp.bmWidth, bmp.bmHeight,
    679         hdcBitmap, 
    680         0, 0, 
     680        hdcBitmap,
     681        0, 0,
    681682        SRCCOPY);
    682683    /* Clean up
     
    698699
    699700/*************************************************************************
    700  * ImageList_BeginDrag [COMCTL32.43] 
     701 * ImageList_BeginDrag [COMCTL32.43]
    701702 *
    702703 * Creates a temporary image list that contains one image. It will be used
     
    716717BOOL WINAPI
    717718ImageList_BeginDrag (HIMAGELIST himlTrack, INT iTrack,
    718                      INT dxHotspot, INT dyHotspot)
     719                 INT dxHotspot, INT dyHotspot)
    719720{
    720721    HDC hdcSrc, hdcDst;
     
    723724
    724725    if (himlTrack == NULL)
    725         return FALSE;
     726    return FALSE;
    726727
    727728    if (himlInternalDrag)
     
    729730
    730731    himlInternalDrag =
    731         ImageList_Create (himlTrack->cx, himlTrack->cy,
    732                           himlTrack->flags, 1, 1);
     732    ImageList_Create (himlTrack->cx, himlTrack->cy,
     733              himlTrack->flags, 1, 1);
    733734    if (himlInternalDrag == NULL) {
    734735        ERR("Error creating drag image list!\n");
     
    764765
    765766/*************************************************************************
    766  * ImageList_Copy [COMCTL32.44] 
    767  *
    768  *  Copies an image of the source image list to an image of the 
     767 * ImageList_Copy [COMCTL32.44]
     768 *
     769 *  Copies an image of the source image list to an image of the
    769770 *  destination image list. Images can be copied or swapped.
    770771 *
     
    787788
    788789BOOL WINAPI
    789 ImageList_Copy (HIMAGELIST himlDst, INT iDst,   HIMAGELIST himlSrc,
    790                 INT iSrc, INT uFlags)
    791 {
    792     HDC hdcSrc, hdcDst;   
     790ImageList_Copy (HIMAGELIST himlDst, INT iDst,   HIMAGELIST himlSrc,
     791        INT iSrc, INT uFlags)
     792{
     793    HDC hdcSrc, hdcDst;
    793794
    794795    TRACE("iDst=%d  iSrc=%d\n", iDst, iSrc);
    795796
    796797    if ((himlSrc == NULL) || (himlDst == NULL))
    797         return FALSE;
     798    return FALSE;
    798799    if ((iDst < 0) || (iDst >= himlDst->cCurImage))
    799         return FALSE;
     800    return FALSE;
    800801    if ((iSrc < 0) || (iSrc >= himlSrc->cCurImage))
    801         return FALSE;
     802    return FALSE;
    802803
    803804    hdcSrc = CreateCompatibleDC (0);
     
    815816                                       himlSrc->uBitsPixel, NULL);
    816817        hbmTempMask = CreateBitmap (himlSrc->cx, himlSrc->cy, 1,
    817                                       1, NULL);
     818                      1, NULL);
    818819
    819820        /* copy (and stretch) destination to temporary bitmaps.(save) */
     
    908909HIMAGELIST WINAPI
    909910ImageList_Create (INT cx, INT cy, UINT flags,
    910                   INT cInitial, INT cGrow)
     911          INT cInitial, INT cGrow)
    911912{
    912913    HIMAGELIST himl;
     
    914915    INT      nCount;
    915916    HBITMAP  hbmTemp;
    916     static WORD aBitBlend25[] = 
     917    static WORD aBitBlend25[] =
    917918        {0xAA, 0x00, 0x55, 0x00, 0xAA, 0x00, 0x55, 0x00};
    918919
     
    948949    if (himl->cMaxImage > 0) {
    949950        himl->hbmImage =
    950           CreateBitmap (himl->cx * himl->cMaxImage, himl->cy,
     951      CreateBitmap (himl->cx * himl->cMaxImage, himl->cy,
    951952                        1, himl->uBitsPixel, NULL);
    952         if (himl->hbmImage == 0) {
    953             ERR("Error creating image bitmap!\n");
    954             return NULL;
    955         }
     953    if (himl->hbmImage == 0) {
     954        ERR("Error creating image bitmap!\n");
     955        return NULL;
     956    }
    956957    }
    957958    else
    958959        himl->hbmImage = 0;
    959    
     960
    960961    if ( (himl->cMaxImage > 0) && (himl->flags & ILC_MASK)) {
    961962        himl->hbmMask = CreateBitmap (himl->cx * himl->cMaxImage, himl->cy,
    962                                         1, 1, NULL);
     963                    1, 1, NULL);
    963964        if (himl->hbmMask == 0) {
    964965            ERR("Error creating mask bitmap!\n");
     
    986987
    987988/*************************************************************************
    988  * ImageList_Destroy [COMCTL32.46] 
     989 * ImageList_Destroy [COMCTL32.46]
    989990 *
    990991 * Destroys an image list.
     
    10001001BOOL WINAPI
    10011002ImageList_Destroy (HIMAGELIST himl)
    1002 { 
     1003{
    10031004    if (!himl)
    1004         return FALSE;
     1005    return FALSE;
    10051006
    10061007    /* delete image bitmaps */
     
    10151016    if (himl->hbrBlend50)
    10161017        DeleteObject (himl->hbrBlend50);
    1017        
     1018
    10181019    COMCTL32_Free (himl);
    10191020
     
    10231024
    10241025/*************************************************************************
    1025  * ImageList_DragEnter [COMCTL32.47] 
     1026 * ImageList_DragEnter [COMCTL32.47]
    10261027 *
    10271028 * Locks window update and displays the drag image at the given position.
     
    10451046{
    10461047    if (himlInternalDrag == NULL)
    1047         return FALSE;
     1048    return FALSE;
    10481049
    10491050    if (hwndLock)
    1050         hwndInternalDrag = hwndLock;
     1051    hwndInternalDrag = hwndLock;
    10511052    else
    1052         hwndInternalDrag = GetDesktopWindow ();
     1053    hwndInternalDrag = GetDesktopWindow ();
    10531054
    10541055    xInternalPos = x;
     
    10571058    hdcBackBuffer = CreateCompatibleDC (0);
    10581059    hbmBackBuffer = CreateCompatibleBitmap (hdcBackBuffer,
    1059                 himlInternalDrag->cx, himlInternalDrag->cy);
     1060        himlInternalDrag->cx, himlInternalDrag->cy);
    10601061
    10611062    ImageList_DragShowNolock (TRUE);
     
    10661067
    10671068/*************************************************************************
    1068  * ImageList_DragLeave [COMCTL32.48] 
     1069 * ImageList_DragLeave [COMCTL32.48]
    10691070 *
    10701071 * Unlocks window update and hides the drag image.
     
    10821083{
    10831084    if (hwndLock)
    1084         hwndInternalDrag = hwndLock;
     1085    hwndInternalDrag = hwndLock;
    10851086    else
    1086         hwndInternalDrag = GetDesktopWindow ();
     1087    hwndInternalDrag = GetDesktopWindow ();
    10871088
    10881089    ImageList_DragShowNolock (FALSE);
     
    10961097
    10971098/*************************************************************************
    1098  * ImageList_DragMove [COMCTL32.49] 
     1099 * ImageList_DragMove [COMCTL32.49]
    10991100 *
    11001101 * Moves the drag image.
     
    11281129
    11291130/*************************************************************************
    1130  * ImageList_DragShowNolock [COMCTL32.50] 
     1131 * ImageList_DragShowNolock [COMCTL32.50]
    11311132 *
    11321133 * Shows or hides the drag image.
     
    11521153
    11531154    hdcDrag = GetDCEx (hwndInternalDrag, 0,
    1154                         DCX_WINDOW | DCX_CACHE | DCX_LOCKWINDOWUPDATE);
     1155            DCX_WINDOW | DCX_CACHE | DCX_LOCKWINDOWUPDATE);
    11551156
    11561157    if (bShow) {
    1157         /* show drag image */
    1158 
    1159         /* save background */
    1160 
    1161         /* draw drag image */
     1158    /* show drag image */
     1159
     1160    /* save background */
     1161
     1162    /* draw drag image */
    11621163
    11631164    }
    11641165    else {
    1165         /* hide drag image */
    1166 
    1167         /* restore background */
     1166    /* hide drag image */
     1167
     1168    /* restore background */
    11681169
    11691170    }
     
    11991200BOOL WINAPI
    12001201ImageList_Draw (HIMAGELIST himl, INT i, HDC hdc,
    1201                 INT x, INT y, UINT fStyle)
     1202        INT x, INT y, UINT fStyle)
    12021203{
    12031204    IMAGELISTDRAWPARAMS imldp;
     
    12521253BOOL WINAPI
    12531254ImageList_DrawEx (HIMAGELIST himl, INT i, HDC hdc, INT x, INT y,
    1254                   INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg,
    1255                   UINT fStyle)
     1255          INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg,
     1256          UINT fStyle)
    12561257{
    12571258    IMAGELISTDRAWPARAMS imldp;
     
    12771278
    12781279/*************************************************************************
    1279  * ImageList_DrawIndirect [COMCTL32.53] 
     1280 * ImageList_DrawIndirect [COMCTL32.53]
    12801281 *
    12811282 * Draws an image using ...
     
    12921293ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
    12931294{
    1294     INT      cx, cy;   
    1295     /* 
     1295    INT      cx, cy;
     1296    /*
    12961297        Do some Error Checking
    12971298    */
     
    13031304        return FALSE;
    13041305    if ((pimldp->i < 0) || (pimldp->i >= pimldp->himl->cCurImage)) {
    1305         ERR("%d not within range (max %d)\n",pimldp->i,pimldp->himl->cCurImage-1);
     1306    ERR("%d not within range (max %d)\n",pimldp->i,pimldp->himl->cCurImage-1);
    13061307        return FALSE;
    13071308    }
     
    13221323        IMAGELIST_InternalDraw(pimldp, cx, cy);
    13231324    }
    1324     /* 
     1325    /*
    13251326        Apply the blend if needed to the Image
    13261327    */
     
    13871388        DeleteDC (hdcSrc);
    13881389
    1389         himlDst->cCurImage = himlSrc->cCurImage;
    1390         himlDst->cMaxImage = himlSrc->cMaxImage;
     1390    himlDst->cCurImage = himlSrc->cCurImage;
     1391    himlDst->cMaxImage = himlSrc->cMaxImage;
    13911392    }
    13921393    return himlDst;
     
    14471448{
    14481449    if (himl == NULL)
    1449         return CLR_NONE;
     1450    return CLR_NONE;
    14501451
    14511452    return himl->clrBk;
     
    14831484
    14841485/*************************************************************************
    1485  * ImageList_GetIcon [COMCTL32.59] 
     1486 * ImageList_GetIcon [COMCTL32.59]
    14861487 *
    14871488 * Creates an icon from a masked image of an image list.
     
    15061507
    15071508    if ((himl == NULL) || (i < 0) || (i >= himl->cCurImage)) {
    1508         FIXME("(%p,%d,%x), params out of range!\n",himl,i,fStyle);
    1509         return 0;
     1509    FIXME("(%p,%d,%x), params out of range!\n",himl,i,fStyle);
     1510    return 0;
    15101511   }
    15111512
     
    15191520    hOldDstBitmap = (HBITMAP)SelectObject (hdcDst, ii.hbmMask);
    15201521    if (himl->hbmMask) {
    1521         SelectObject (hdcSrc, himl->hbmMask);
    1522         BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
    1523                   hdcSrc, i * himl->cx, 0, SRCCOPY);
     1522    SelectObject (hdcSrc, himl->hbmMask);
     1523    BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
     1524          hdcSrc, i * himl->cx, 0, SRCCOPY);
    15241525    }
    15251526    else
    1526         PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS);
     1527    PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS);
    15271528
    15281529    /* draw image*/
     
    15311532    SelectObject (hdcDst, ii.hbmColor);
    15321533    BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
    1533               hdcSrc, i * himl->cx, 0, SRCCOPY);
     1534          hdcSrc, i * himl->cx, 0, SRCCOPY);
    15341535
    15351536    /*
    15361537     * CreateIconIndirect requires us to deselect the bitmaps from
    1537      * the DCs before calling 
     1538     * the DCs before calling
    15381539     */
    15391540    SelectObject(hdcSrc, hOldSrcBitmap);
    15401541    SelectObject(hdcDst, hOldDstBitmap);
    15411542
    1542     hIcon = CreateIconIndirect (&ii);   
     1543    hIcon = CreateIconIndirect (&ii);
    15431544
    15441545    DeleteDC (hdcSrc);
     
    15731574{
    15741575    if (himl == NULL)
    1575         return FALSE;
     1576    return FALSE;
    15761577    if ((himl->cx <= 0) || (himl->cy <= 0))
    1577         return FALSE;
     1578    return FALSE;
    15781579
    15791580    if (cx)
    1580         *cx = himl->cx;
     1581    *cx = himl->cx;
    15811582    if (cy)
    1582         *cy = himl->cy;
     1583    *cy = himl->cy;
    15831584
    15841585    return TRUE;
     
    16031604{
    16041605    if (himl == NULL)
    1605         return 0;
     1606    return 0;
    16061607
    16071608    return himl->cCurImage;
     
    16281629{
    16291630    if ((himl == NULL) || (pImageInfo == NULL))
    1630         return FALSE;
     1631    return FALSE;
    16311632    if ((i < 0) || (i >= himl->cCurImage))
    1632         return FALSE;
     1633    return FALSE;
    16331634
    16341635    pImageInfo->hbmImage = himl->hbmImage;
    16351636    pImageInfo->hbmMask  = himl->hbmMask;
    1636    
     1637
    16371638    pImageInfo->rcImage.top    = 0;
    16381639    pImageInfo->rcImage.bottom = himl->cy;
    16391640    pImageInfo->rcImage.left   = i * himl->cx;
    16401641    pImageInfo->rcImage.right  = (i+1) * himl->cx;
    1641    
     1642
    16421643    return TRUE;
    16431644}
     
    16451646
    16461647/*************************************************************************
    1647  * ImageList_GetImageRect [COMCTL32.63] 
     1648 * ImageList_GetImageRect [COMCTL32.63]
    16481649 *
    16491650 * Retrieves the rectangle of the specified image in an image list.
     
    16661667{
    16671668    if ((himl == NULL) || (lpRect == NULL))
    1668         return FALSE;
     1669    return FALSE;
    16691670    if ((i < 0) || (i >= himl->cCurImage))
    1670         return FALSE;
     1671    return FALSE;
    16711672
    16721673    lpRect->left   = i * himl->cx;
     
    17041705HIMAGELIST WINAPI
    17051706ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow,
    1706                         COLORREF clrMask, UINT uType, UINT uFlags)
     1707            COLORREF clrMask, UINT uType, UINT uFlags)
    17071708{
    17081709    HIMAGELIST himl = NULL;
     
    17441745        GetIconInfo (handle, &ii);
    17451746        GetObjectA (ii.hbmColor, sizeof(BITMAP), (LPVOID)&bmp);
    1746         himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 
     1747        himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight,
    17471748                                 ILC_MASK | ILC_COLOR, 1, cGrow);
    17481749        ImageList_Add (himl, ii.hbmColor, ii.hbmMask);
     
    17521753
    17531754    DeleteObject (handle);
    1754    
     1755
    17551756    return himl;
    17561757}
     
    17811782HIMAGELIST WINAPI
    17821783ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow,
    1783                         COLORREF clrMask, UINT uType,   UINT uFlags)
     1784            COLORREF clrMask, UINT uType,   UINT uFlags)
    17841785{
    17851786    HIMAGELIST himl = NULL;
     
    18081809        GetIconInfo (handle, &ii);
    18091810        GetObjectA (ii.hbmMask, sizeof(BITMAP), (LPVOID)&bmp);
    1810         himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 
     1811        himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight,
    18111812                                 ILC_MASK | ILC_COLOR, 1, cGrow);
    18121813        ImageList_Add (himl, ii.hbmColor, ii.hbmMask);
     
    18161817
    18171818    DeleteObject (handle);
    1818    
     1819
    18191820    return himl;
    18201821}
     
    18221823
    18231824/*************************************************************************
    1824  * ImageList_Merge [COMCTL32.67] 
     1825 * ImageList_Merge [COMCTL32.67]
    18251826 *
    18261827 * Creates a new image list that contains a merged image from the specified
     
    18421843HIMAGELIST WINAPI
    18431844ImageList_Merge (HIMAGELIST himl1, INT i1, HIMAGELIST himl2, INT i2,
    1844                 INT dx, INT dy)
     1845        INT dx, INT dy)
    18451846{
    18461847    HIMAGELIST himlDst = NULL;
     
    18511852
    18521853    if ((himl1 == NULL) || (himl2 == NULL))
    1853         return NULL;
     1854    return NULL;
    18541855
    18551856    /* check indices */
     
    19031904        nX1 = i1 * himl1->cx;
    19041905        nX2 = i2 * himl2->cx;
    1905        
     1906
    19061907        /* copy image */
    19071908        SelectObject (hdcSrcImage, himl1->hbmImage);
    19081909        SelectObject (hdcDstImage, himlDst->hbmImage);
    1909         BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 
     1910        BitBlt (hdcDstImage, 0, 0, cxDst, cyDst,
    19101911                  hdcSrcImage, 0, 0, BLACKNESS);
    1911         BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 
     1912        BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy,
    19121913                  hdcSrcImage, nX1, 0, SRCCOPY);
    19131914
    19141915        SelectObject (hdcSrcImage, himl2->hbmMask);
    1915         BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 
     1916        BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy,
    19161917                  hdcSrcImage, nX2, 0, SRCAND);
    19171918
    19181919        SelectObject (hdcSrcImage, himl2->hbmImage);
    1919         BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 
     1920        BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy,
    19201921                  hdcSrcImage, nX2, 0, SRCPAINT);
    19211922
     
    19231924        SelectObject (hdcSrcImage, himl1->hbmMask);
    19241925        SelectObject (hdcDstImage, himlDst->hbmMask);
    1925         BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 
     1926        BitBlt (hdcDstImage, 0, 0, cxDst, cyDst,
    19261927                  hdcSrcImage, 0, 0, WHITENESS);
    1927         BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 
     1928        BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy,
    19281929                  hdcSrcImage, nX1, 0, SRCCOPY);
    19291930
    19301931        SelectObject (hdcSrcImage, himl2->hbmMask);
    1931         BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 
     1932        BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy,
    19321933                  hdcSrcImage, nX2, 0, SRCAND);
    19331934
     
    19351936        DeleteDC (hdcDstImage);
    19361937    }
    1937    
     1938
    19381939    return himlDst;
    19391940}
     
    19451946    int bitspixel = GetDeviceCaps(hdc,BITSPIXEL)*GetDeviceCaps(hdc,PLANES);
    19461947    if (bitspixel>8)
    1947         return TRUE;
     1948    return TRUE;
    19481949    if (bitspixel<=4)
    1949         return FALSE;
     1950    return FALSE;
    19501951    return GetDeviceCaps(hdc,CAPS1) & C1_DIBENGINE;
    19511952}
     
    19541955/* helper for ImageList_Read, see comments below */
    19551956static HBITMAP _read_bitmap(LPSTREAM pstm,int ilcFlag,int cx,int cy) {
    1956     HDC                 xdc = 0;
    1957     BITMAPFILEHEADER    bmfh;
    1958     BITMAPINFOHEADER    bmih;
    1959     int                 bitsperpixel,palspace,longsperline,width,height;
    1960     LPBITMAPINFOHEADER  bmihc = NULL;
    1961     int                 result = 0;
    1962     HBITMAP             hbitmap = 0;
    1963     LPBYTE              bits = NULL,nbits = NULL;
    1964     int                 nbytesperline,bytesperline;
    1965 
    1966     if (!SUCCEEDED(IStream_Read ( pstm, &bmfh, sizeof(bmfh), NULL))     ||
    1967         (bmfh.bfType != (('M'<<8)|'B'))                                 ||
    1968         !SUCCEEDED(IStream_Read ( pstm, &bmih, sizeof(bmih), NULL))     ||
    1969         (bmih.biSize != sizeof(bmih))
     1957    HDC         xdc = 0;
     1958    BITMAPFILEHEADER    bmfh;
     1959    BITMAPINFOHEADER    bmih;
     1960    int         bitsperpixel,palspace,longsperline,width,height;
     1961    LPBITMAPINFOHEADER  bmihc = NULL;
     1962    int         result = 0;
     1963    HBITMAP     hbitmap = 0;
     1964    LPBYTE      bits = NULL,nbits = NULL;
     1965    int         nbytesperline,bytesperline;
     1966
     1967    if (!SUCCEEDED(IStream_Read ( pstm, &bmfh, sizeof(bmfh), NULL)) ||
     1968        (bmfh.bfType != (('M'<<8)|'B'))                 ||
     1969        !SUCCEEDED(IStream_Read ( pstm, &bmih, sizeof(bmih), NULL)) ||
     1970        (bmih.biSize != sizeof(bmih))
    19701971    )
    1971         return 0;
     1972    return 0;
    19721973
    19731974    bitsperpixel = bmih.biPlanes * bmih.biBitCount;
    19741975    if (bitsperpixel<=8)
    1975         palspace = (1<<bitsperpixel)*sizeof(RGBQUAD);
     1976        palspace = (1<<bitsperpixel)*sizeof(RGBQUAD);
    19761977    else
    1977         palspace = 0;
     1978        palspace = 0;
    19781979    width = bmih.biWidth;
    19791980    height = bmih.biHeight;
    19801981    bmihc = (LPBITMAPINFOHEADER)LocalAlloc(LMEM_ZEROINIT,sizeof(bmih)+palspace);
    19811982    memcpy(bmihc,&bmih,sizeof(bmih));
    1982     longsperline        = ((width*bitsperpixel+31)&~0x1f)>>5;
    1983     bmihc->biSizeImage  = (longsperline*height)<<2;
     1983    longsperline    = ((width*bitsperpixel+31)&~0x1f)>>5;
     1984    bmihc->biSizeImage  = (longsperline*height)<<2;
    19841985
    19851986    /* read the palette right after the end of the bitmapinfoheader */
    19861987    if (palspace)
    1987         if (!SUCCEEDED(IStream_Read ( pstm, bmihc+1, palspace, NULL)))
    1988             goto ret1;
     1988    if (!SUCCEEDED(IStream_Read ( pstm, bmihc+1, palspace, NULL)))
     1989        goto ret1;
    19891990
    19901991    xdc = GetDC(0);
    19911992#if 0 /* Magic for NxM -> 1x(N*M) not implemented for DIB Sections */
    19921993    if ((bitsperpixel>1) &&
    1993         ((ilcFlag!=ILC_COLORDDB) && (!ilcFlag || may_use_dibsection(xdc)))
     1994    ((ilcFlag!=ILC_COLORDDB) && (!ilcFlag || may_use_dibsection(xdc)))
    19941995     ) {
    1995         hbitmap = CreateDIBSection(xdc,(BITMAPINFO*)bmihc,0,(LPVOID*)&bits,0,0);
    1996         if (!hbitmap)
    1997             goto ret1;
    1998         if (!SUCCEEDED(IStream_Read( pstm, bits, bmihc->biSizeImage, NULL)))
    1999             goto ret1;
    2000         result = 1;
     1996    hbitmap = CreateDIBSection(xdc,(BITMAPINFO*)bmihc,0,(LPVOID*)&bits,0,0);
     1997    if (!hbitmap)
     1998        goto ret1;
     1999    if (!SUCCEEDED(IStream_Read( pstm, bits, bmihc->biSizeImage, NULL)))
     2000        goto ret1;
     2001    result = 1;
    20012002    } else
    20022003#endif
    20032004    {
    2004         int i,nwidth,nheight;
    2005 
    2006         nwidth  = width*(height/cy);
    2007         nheight = cy;
    2008 
    2009         if (bitsperpixel==1)
    2010             hbitmap = CreateBitmap(nwidth,nheight,1,1,NULL);
    2011         else
    2012             hbitmap = CreateCompatibleBitmap(xdc,nwidth,nheight);
    2013 
    2014         /* Might be a bit excessive memory use here */
    2015         bits = (LPBYTE)LocalAlloc(LMEM_ZEROINIT,bmihc->biSizeImage);
    2016         nbits = (LPBYTE)LocalAlloc(LMEM_ZEROINIT,bmihc->biSizeImage);
    2017         if (!SUCCEEDED(IStream_Read ( pstm, bits, bmihc->biSizeImage, NULL)))
    2018                 goto ret1;
    2019 
    2020         /* Copy the NxM bitmap into a 1x(N*M) bitmap we need, linewise */
    2021         /* Do not forget that windows bitmaps are bottom->top */
    2022         bytesperline    = longsperline*4;
    2023         nbytesperline   = (height/cy)*bytesperline;
    2024         for (i=0;i<height;i++) {
    2025             memcpy(
    2026                 nbits+((height-1-i)%cy)*nbytesperline+(i/cy)*bytesperline,
    2027                 bits+bytesperline*(height-1-i),
    2028                 bytesperline
    2029             );
    2030         }
    2031         bmihc->biWidth  = nwidth;
    2032         bmihc->biHeight = nheight;
    2033         if (!SetDIBits(xdc,hbitmap,0,nheight,nbits,(BITMAPINFO*)bmihc,0))
    2034                 goto ret1;
    2035         LocalFree((HLOCAL)nbits);
    2036         LocalFree((HLOCAL)bits);
    2037         result = 1;
     2005    int i,nwidth,nheight;
     2006
     2007    nwidth  = width*(height/cy);
     2008    nheight = cy;
     2009
     2010    if (bitsperpixel==1)
     2011        hbitmap = CreateBitmap(nwidth,nheight,1,1,NULL);
     2012    else
     2013        hbitmap = CreateCompatibleBitmap(xdc,nwidth,nheight);
     2014
     2015    /* Might be a bit excessive memory use here */
     2016    bits = (LPBYTE)LocalAlloc(LMEM_ZEROINIT,bmihc->biSizeImage);
     2017    nbits = (LPBYTE)LocalAlloc(LMEM_ZEROINIT,bmihc->biSizeImage);
     2018    if (!SUCCEEDED(IStream_Read ( pstm, bits, bmihc->biSizeImage, NULL)))
     2019        goto ret1;
     2020
     2021    /* Copy the NxM bitmap into a 1x(N*M) bitmap we need, linewise */
     2022    /* Do not forget that windows bitmaps are bottom->top */
     2023    bytesperline    = longsperline*4;
     2024    nbytesperline   = (height/cy)*bytesperline;
     2025    for (i=0;i<height;i++) {
     2026        memcpy(
     2027        nbits+((height-1-i)%cy)*nbytesperline+(i/cy)*bytesperline,
     2028        bits+bytesperline*(height-1-i),
     2029        bytesperline
     2030        );
     2031    }
     2032    bmihc->biWidth  = nwidth;
     2033    bmihc->biHeight = nheight;
     2034    if (!SetDIBits(xdc,hbitmap,0,nheight,nbits,(BITMAPINFO*)bmihc,0))
     2035        goto ret1;
     2036    LocalFree((HLOCAL)nbits);
     2037    LocalFree((HLOCAL)bits);
     2038    result = 1;
    20382039    }
    20392040ret1:
    2040     if (xdc)    ReleaseDC(0,xdc);
    2041     if (bmihc)  LocalFree((HLOCAL)bmihc);
     2041    if (xdc)    ReleaseDC(0,xdc);
     2042    if (bmihc)  LocalFree((HLOCAL)bmihc);
    20422043    if (!result) {
    2043         if (hbitmap) {
    2044             DeleteObject(hbitmap);
    2045             hbitmap = 0;
    2046         }
     2044    if (hbitmap) {
     2045        DeleteObject(hbitmap);
     2046        hbitmap = 0;
     2047    }
    20472048    }
    20482049    return hbitmap;
     
    20622063 *
    20632064 * The format is like this:
    2064  *      ILHEAD                  ilheadstruct;
     2065 *  ILHEAD          ilheadstruct;
    20652066 *
    20662067 * for the color image part:
    2067  *      BITMAPFILEHEADER        bmfh;
    2068  *      BITMAPINFOHEADER        bmih;
     2068 *  BITMAPFILEHEADER    bmfh;
     2069 *  BITMAPINFOHEADER    bmih;
    20692070 * only if it has a palette:
    2070  *      RGBQUAD         rgbs[nr_of_paletted_colors];
    2071  *
    2072  *      BYTE                    colorbits[imagesize];
     2071 *  RGBQUAD     rgbs[nr_of_paletted_colors];
     2072 *
     2073 *  BYTE            colorbits[imagesize];
    20732074 *
    20742075 * the following only if the ILC_MASK bit is set in ILHEAD.ilFlags:
    2075  *      BITMAPFILEHEADER        bmfh_mask;
    2076  *      BITMAPINFOHEADER        bmih_mask;
     2076 *  BITMAPFILEHEADER    bmfh_mask;
     2077 *  BITMAPINFOHEADER    bmih_mask;
    20772078 * only if it has a palette (it usually does not):
    2078  *      RGBQUAD         rgbs[nr_of_paletted_colors];
    2079  *
    2080  *      BYTE                    maskbits[imagesize];
     2079 *  RGBQUAD     rgbs[nr_of_paletted_colors];
     2080 *
     2081 *  BYTE            maskbits[imagesize];
    20812082 *
    20822083 * CAVEAT: Those images are within a NxM bitmap, not the 1xN we expect.
     
    20852086HIMAGELIST WINAPI ImageList_Read (LPSTREAM pstm)
    20862087{
    2087     ILHEAD      ilHead;
    2088     HIMAGELIST  himl;
    2089     HBITMAP     hbmColor=0,hbmMask=0;
    2090     int         i;
     2088    ILHEAD  ilHead;
     2089    HIMAGELIST  himl;
     2090    HBITMAP hbmColor=0,hbmMask=0;
     2091    int     i;
    20912092
    20922093    if (!SUCCEEDED(IStream_Read (pstm, &ilHead, sizeof(ILHEAD), NULL)))
    2093         return NULL;
     2094        return NULL;
    20942095    if (ilHead.usMagic != (('L' << 8) | 'I'))
    2095         return NULL;
     2096    return NULL;
    20962097    if (ilHead.usVersion != 0x101) /* probably version? */
    2097         return NULL;
     2098    return NULL;
    20982099
    20992100#if 0
    2100     FIXME("     ilHead.cCurImage = %d\n",ilHead.cCurImage);
    2101     FIXME("     ilHead.cMaxImage = %d\n",ilHead.cMaxImage);
    2102     FIXME("     ilHead.cGrow = %d\n",ilHead.cGrow);
    2103     FIXME("     ilHead.cx = %d\n",ilHead.cx);
    2104     FIXME("     ilHead.cy = %d\n",ilHead.cy);
    2105     FIXME("     ilHead.flags = %x\n",ilHead.flags);
    2106     FIXME("     ilHead.ovls[0] = %d\n",ilHead.ovls[0]);
    2107     FIXME("     ilHead.ovls[1] = %d\n",ilHead.ovls[1]);
    2108     FIXME("     ilHead.ovls[2] = %d\n",ilHead.ovls[2]);
    2109     FIXME("     ilHead.ovls[3] = %d\n",ilHead.ovls[3]);
     2101    FIXME(" ilHead.cCurImage = %d\n",ilHead.cCurImage);
     2102    FIXME(" ilHead.cMaxImage = %d\n",ilHead.cMaxImage);
     2103    FIXME(" ilHead.cGrow = %d\n",ilHead.cGrow);
     2104    FIXME(" ilHead.cx = %d\n",ilHead.cx);
     2105    FIXME(" ilHead.cy = %d\n",ilHead.cy);
     2106    FIXME(" ilHead.flags = %x\n",ilHead.flags);
     2107    FIXME(" ilHead.ovls[0] = %d\n",ilHead.ovls[0]);
     2108    FIXME(" ilHead.ovls[1] = %d\n",ilHead.ovls[1]);
     2109    FIXME(" ilHead.ovls[2] = %d\n",ilHead.ovls[2]);
     2110    FIXME(" ilHead.ovls[3] = %d\n",ilHead.ovls[3]);
    21102111#endif
    21112112
    21122113    hbmColor = _read_bitmap(pstm,ilHead.flags & ~ILC_MASK,ilHead.cx,ilHead.cy);
    21132114    if (!hbmColor)
    2114         return NULL;
     2115    return NULL;
    21152116    if (ilHead.flags & ILC_MASK) {
    2116         hbmMask = _read_bitmap(pstm,0,ilHead.cx,ilHead.cy);
    2117         if (!hbmMask) {
    2118             DeleteObject(hbmColor);
    2119             return NULL;
    2120         }
     2117    hbmMask = _read_bitmap(pstm,0,ilHead.cx,ilHead.cy);
     2118    if (!hbmMask) {
     2119        DeleteObject(hbmColor);
     2120        return NULL;
     2121    }
    21212122    }
    21222123
    21232124    himl = ImageList_Create (
    2124                     ilHead.cx,
    2125                     ilHead.cy,
    2126                     ilHead.flags,
    2127                     1,          /* initial */
    2128                     ilHead.cGrow
     2125            ilHead.cx,
     2126            ilHead.cy,
     2127            ilHead.flags,
     2128            1,      /* initial */
     2129            ilHead.cGrow
    21292130    );
    21302131    if (!himl) {
    2131         DeleteObject(hbmColor);
    2132         DeleteObject(hbmMask);
    2133         return NULL;
     2132    DeleteObject(hbmColor);
     2133    DeleteObject(hbmMask);
     2134    return NULL;
    21342135    }
    21352136    himl->hbmImage = hbmColor;
     
    21402141    ImageList_SetBkColor(himl,ilHead.bkcolor);
    21412142    for (i=0;i<4;i++)
    2142         ImageList_SetOverlayImage(himl,ilHead.ovls[i],i+1);
     2143        ImageList_SetOverlayImage(himl,ilHead.ovls[i],i+1);
    21432144    return himl;
    21442145}
     
    21682169        return FALSE;
    21692170    }
    2170    
     2171
    21712172    if ((i < -1) || (i >= himl->cCurImage)) {
    21722173        ERR("index out of range! %d\n", i);
     
    22112212        TRACE(" - Max. number of images: %d / %d (Old/New)\n",
    22122213                 himl->cMaxImage, himl->cCurImage + himl->cGrow - 1);
    2213        
     2214
    22142215        hbmNewImage =
    22152216            CreateBitmap (cxNew, himl->cy, 1, himl->uBitsPixel, NULL);
     
    22262227        if (i > 0) {
    22272228            TRACE("Pre image copy: Copy %d images\n", i);
    2228        
     2229
    22292230            SelectObject (hdcSrc, himl->hbmImage);
    22302231            SelectObject (hdcDst, hbmNewImage);
     
    22772278
    22782279/*************************************************************************
    2279  * ImageList_Replace [COMCTL32.70] 
     2280 * ImageList_Replace [COMCTL32.70]
    22802281 *
    22812282 * Replaces an image in an image list with a new image.
     
    22942295BOOL WINAPI
    22952296ImageList_Replace (HIMAGELIST himl, INT i, HBITMAP hbmImage,
    2296                    HBITMAP hbmMask)
     2297           HBITMAP hbmMask)
    22972298{
    22982299    HDC hdcImageList, hdcImage;
     
    23032304        return FALSE;
    23042305    }
    2305    
     2306
    23062307    if ((i >= himl->cMaxImage) || (i < 0)) {
    23072308        ERR("Invalid image index!\n");
     
    23332334        */
    23342335        SelectObject (hdcImageList, himl->hbmImage);
    2335         StretchBlt (hdcImageList, 
     2336        StretchBlt (hdcImageList,
    23362337            i*himl->cx, 0, himl->cx, himl->cy,
    2337             hdcImage, 
    2338             0, 0, bmp.bmWidth, bmp.bmHeight, 
     2338            hdcImage,
     2339            0, 0, bmp.bmWidth, bmp.bmHeight,
    23392340            0x220326); /* NOTSRCAND */
    23402341    }
     
    23752376
    23762377    if (himl == NULL)
    2377         return -1;
     2378    return -1;
    23782379    if ((i >= himl->cMaxImage) || (i < -1))
    2379         return -1;
     2380    return -1;
    23802381
    23812382    hBestFitIcon = CopyImage(
    2382         hIcon, IMAGE_ICON, 
    2383         himl->cx, himl->cy, 
     2383        hIcon, IMAGE_ICON,
     2384        himl->cx, himl->cy,
    23842385        LR_COPYFROMRESOURCE);
    23852386
    23862387    GetIconInfo (hBestFitIcon, &ii);
    23872388    if (ii.hbmMask == 0)
    2388         ERR("no mask!\n");
     2389    ERR("no mask!\n");
    23892390    if (ii.hbmColor == 0)
    2390         ERR("no color!\n");
     2391    ERR("no color!\n");
    23912392    GetObjectA (ii.hbmMask, sizeof(BITMAP), (LPVOID)&bmp);
    23922393
     
    24042405    TRACE("hdcImageList=0x%x!\n", hdcImageList);
    24052406    if (hdcImageList == 0)
    2406         ERR("invalid hdcImageList!\n");
     2407    ERR("invalid hdcImageList!\n");
    24072408
    24082409    hdcImage = CreateCompatibleDC (0);
    24092410    TRACE("hdcImage=0x%x!\n", hdcImage);
    24102411    if (hdcImage == 0)
    2411         ERR("invalid hdcImage!\n");
     2412    ERR("invalid hdcImage!\n");
    24122413
    24132414    hbmOldDst = SelectObject (hdcImageList, himl->hbmImage);
     
    24292430
    24302431    if(hBestFitIcon)
    2431         DestroyIcon(hBestFitIcon);
     2432    DestroyIcon(hBestFitIcon);
    24322433    if (hdcImageList)
    2433         DeleteDC (hdcImageList);
     2434    DeleteDC (hdcImageList);
    24342435    if (hdcImage)
    2435         DeleteDC (hdcImage);
     2436    DeleteDC (hdcImage);
    24362437    if (ii.hbmColor)
    2437         DeleteObject (ii.hbmColor);
     2438    DeleteObject (ii.hbmColor);
    24382439    if (ii.hbmMask)
    2439         DeleteObject (ii.hbmMask);
     2440    DeleteObject (ii.hbmMask);
    24402441
    24412442    return nIndex;
     
    24442445
    24452446/*************************************************************************
    2446  * ImageList_SetBkColor [COMCTL32.76] 
     2447 * ImageList_SetBkColor [COMCTL32.76]
    24472448 *
    24482449 * Sets the background color of an image list.
     
    24632464
    24642465    if (himl == NULL)
    2465         return CLR_NONE;
     2466    return CLR_NONE;
    24662467
    24672468    clrOldBk = himl->clrBk;
     
    24922493BOOL WINAPI
    24932494ImageList_SetDragCursorImage (HIMAGELIST himlDrag, INT iDrag,
    2494                               INT dxHotspot, INT dyHotspot)
     2495                  INT dxHotspot, INT dyHotspot)
    24952496{
    24962497    HIMAGELIST himlTemp;
     
    24992500
    25002501    if (himlInternalDrag == NULL)
    2501         return FALSE;
     2502    return FALSE;
    25022503
    25032504    TRACE(" dxH=%d dyH=%d nX=%d nY=%d\n",
    2504            dxHotspot, dyHotspot, nInternalDragHotspotX, nInternalDragHotspotY);
     2505       dxHotspot, dyHotspot, nInternalDragHotspotX, nInternalDragHotspotY);
    25052506
    25062507    himlTemp = ImageList_Merge (himlInternalDrag, 0, himlDrag, iDrag,
    2507                                 dxHotspot, dyHotspot);
     2508                dxHotspot, dyHotspot);
    25082509
    25092510    ImageList_Destroy (himlInternalDrag);
     
    25182519
    25192520/*************************************************************************
    2520  * ImageList_SetFilter [COMCTL32.78] 
     2521 * ImageList_SetFilter [COMCTL32.78]
    25212522 *
    25222523 * Sets a filter (or does something completely different)!!???
     
    25402541{
    25412542    FIXME("(%p 0x%x 0x%lx):empty stub!\n",
    2542            himl, i, dwFilter);
     2543       himl, i, dwFilter);
    25432544
    25442545    return FALSE;
     
    25672568
    25682569    if (!himl)
    2569         return FALSE;
     2570    return FALSE;
    25702571
    25712572    /* remove all images */
     
    26172618
    26182619    if (!himl)
    2619         return FALSE;
     2620    return FALSE;
    26202621    if (himl->cCurImage >= iImageCount)
    2621         return FALSE;
     2622    return FALSE;
    26222623    if (himl->cMaxImage > iImageCount)
    2623         return TRUE;
     2624    return TRUE;
    26242625
    26252626    nNewCount = iImageCount + himl->cGrow;
     
    26362637        SelectObject (hdcBitmap, hbmNewBitmap);
    26372638
    2638         /* copy images */
     2639    /* copy images */
    26392640        BitBlt (hdcBitmap, 0, 0, nCopyCount * himl->cx, himl->cy,
    26402641                  hdcImageList, 0, 0, SRCCOPY);
    26412642#if 0
    2642         /* delete 'empty' image space */
    2643         SetBkColor (hdcBitmap, RGB(255, 255, 255));
    2644         SetTextColor (hdcBitmap, RGB(0, 0, 0));
    2645         PatBlt (hdcBitmap,  nCopyCount * himl->cx, 0,
    2646                   (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS);
     2643    /* delete 'empty' image space */
     2644    SetBkColor (hdcBitmap, RGB(255, 255, 255));
     2645    SetTextColor (hdcBitmap, RGB(0, 0, 0));
     2646    PatBlt (hdcBitmap,  nCopyCount * himl->cx, 0,
     2647          (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS);
    26472648#endif
    2648         DeleteObject (himl->hbmImage);
    2649         himl->hbmImage = hbmNewBitmap;
     2649    DeleteObject (himl->hbmImage);
     2650    himl->hbmImage = hbmNewBitmap;
    26502651    }
    26512652    else
    2652         ERR("Could not create new image bitmap !\n");
     2653    ERR("Could not create new image bitmap !\n");
    26532654
    26542655    if (himl->hbmMask)
     
    26612662            SelectObject (hdcBitmap, hbmNewBitmap);
    26622663
    2663             /* copy images */
     2664        /* copy images */
    26642665            BitBlt (hdcBitmap, 0, 0, nCopyCount * himl->cx, himl->cy,
    26652666                      hdcImageList, 0, 0, SRCCOPY);
    26662667#if 0
    2667             /* delete 'empty' image space */
    2668             SetBkColor (hdcBitmap, RGB(255, 255, 255));
    2669             SetTextColor (hdcBitmap, RGB(0, 0, 0));
    2670             PatBlt (hdcBitmap,  nCopyCount * himl->cx, 0, 
    2671                       (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS);
     2668        /* delete 'empty' image space */
     2669        SetBkColor (hdcBitmap, RGB(255, 255, 255));
     2670        SetTextColor (hdcBitmap, RGB(0, 0, 0));
     2671            PatBlt (hdcBitmap,  nCopyCount * himl->cx, 0,
     2672              (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS);
    26722673#endif
    26732674            DeleteObject (himl->hbmMask);
     
    27092710{
    27102711    if (!himl)
    2711         return FALSE;
     2712    return FALSE;
    27122713    if ((iOverlay < 1) || (iOverlay > MAX_OVERLAYIMAGE))
    2713         return FALSE;
     2714    return FALSE;
    27142715    if ((iImage!=-1) && ((iImage < 0) || (iImage > himl->cCurImage)))
    2715         return FALSE;
     2716    return FALSE;
    27162717    himl->nOvlIdx[iOverlay - 1] = iImage;
    27172718    return TRUE;
     
    27442745{
    27452746    if (!himl)
    2746         return FALSE;
     2747    return FALSE;
    27472748
    27482749    FIXME("empty stub!\n");
Note: See TracChangeset for help on using the changeset viewer.