ImageList updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ChangeLog:
  -- fix ImageList_GetIcon to use ImageList_* functions for completness
  -- tiny code cleanups
  -- documentation updates

Index: dlls/comctl32/imagelist.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/imagelist.c,v
retrieving revision 1.57
diff -u -r1.57 imagelist.c
--- dlls/comctl32/imagelist.c	4 Sep 2002 18:44:46 -0000	1.57
+++ dlls/comctl32/imagelist.c	4 Sep 2002 20:06:13 -0000
@@ -22,13 +22,14 @@
  *
  *  TODO:
  *    - Fix ImageList_DrawIndirect (rgbFg, rgbBk, dwRop).
- *    - Fix ImageList_GetIcon.
  *    - Fix ImageList_SetFilter (undocumented).
  *      BTW does anybody know anything about this function???
  *        - It removes 12 Bytes from the stack (3 Parameters).
  *        - First parameter SHOULD be a HIMAGELIST.
  *        - Second parameter COULD be an index?????
  *        - Third parameter.... ?????????????????????
+ *    - Add support for ILD_PRESERVEALPHA, ILD_SCALE, ILD_DPISCALE
+ *    - Add support for ILS_GLOW, ILS_SHADOW, ILS_SATURATE, ILS_ALPHA
  *
  *  Comments:
  *    - ImageList_Draw, ImageList_DrawEx and ImageList_GetIcon use
@@ -435,7 +436,7 @@
     INT nOvlIdx;
     HDC hImageDC;
     HBITMAP hOldBitmap;
-
+    
     nOvlIdx = (pimldp->fStyle & ILD_OVERLAYMASK) >> 8;
     if ( (nOvlIdx < 1) || (nOvlIdx > MAX_OVERLAYIMAGE)) return;
 
@@ -1526,10 +1527,7 @@
 COLORREF WINAPI
 ImageList_GetBkColor (HIMAGELIST himl)
 {
-    if (himl == NULL)
-	return CLR_NONE;
-
-    return himl->clrBk;
+    return himl ? himl->clrBk : CLR_NONE;
 }
 
 
@@ -1600,50 +1598,38 @@
 ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle)
 {
     ICONINFO ii;
-    HICON  hIcon;
-    HBITMAP hOldSrcBitmap,hOldDstBitmap;
-    HDC    hdcSrc, hdcDst;
-
-    if ((himl == NULL) || (i < 0) || (i >= himl->cCurImage)) {
-	return 0;
-   }
+    HICON hIcon;
+    HBITMAP hOldDstBitmap;
+    HDC hdcDst;
+
+    if ((himl == NULL) || (i < 0) || (i >= himl->cCurImage)) return 0;
 
-    hdcSrc = CreateCompatibleDC(0);
     hdcDst = CreateCompatibleDC(0);
 
     ii.fIcon = TRUE;
-    ii.hbmMask  = CreateCompatibleBitmap (hdcDst, himl->cx, himl->cy);
 
     /* draw mask*/
+    ii.hbmMask  = CreateCompatibleBitmap (hdcDst, himl->cx, himl->cy);
     hOldDstBitmap = (HBITMAP)SelectObject (hdcDst, ii.hbmMask);
-    if (himl->hbmMask) {
-	SelectObject (hdcSrc, himl->hbmMask);
-	BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
-		  hdcSrc, i * himl->cx, 0, SRCCOPY);
-    }
-    else
-	PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS);
+    ImageList_Draw(himl, i, hdcDst, 0, 0, ILD_MASK);
 
     /* draw image*/
-    hOldSrcBitmap = (HBITMAP)SelectObject (hdcSrc, himl->hbmImage);
-    ii.hbmColor = CreateCompatibleBitmap (hdcSrc, himl->cx, himl->cy);
+    SelectObject (hdcDst, himl->hbmImage);
+    ii.hbmColor = CreateCompatibleBitmap (hdcDst, himl->cx, himl->cy);
     SelectObject (hdcDst, ii.hbmColor);
-    BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
-	      hdcSrc, i * himl->cx, 0, SRCCOPY);
+    ImageList_Draw(himl, i, hdcDst, 0, 0, fStyle);
 
     /*
      * CreateIconIndirect requires us to deselect the bitmaps from
      * the DCs before calling
      */
-    SelectObject(hdcSrc, hOldSrcBitmap);
     SelectObject(hdcDst, hOldDstBitmap);
 
     hIcon = CreateIconIndirect (&ii);
 
-    DeleteDC (hdcSrc);
-    DeleteDC (hdcDst);
     DeleteObject (ii.hbmMask);
     DeleteObject (ii.hbmColor);
+    DeleteDC (hdcDst);
 
     return hIcon;
 }



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux