comctl32: Store an alpha channel present flag for each image in an imagelist.

This commit is contained in:
Alexandre Julliard 2010-05-14 13:44:20 +02:00
parent 528722e4e1
commit 33e7d0282b
2 changed files with 23 additions and 1 deletions

View File

@ -207,6 +207,7 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count,
} }
else else
{ {
if (himl->has_alpha) himl->has_alpha[pos + n] = 1;
StretchBlt( himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy, StretchBlt( himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy,
hdc, n * width, 0, width, height, SRCCOPY ); hdc, n * width, 0, width, height, SRCCOPY );
} }
@ -294,6 +295,18 @@ IMAGELIST_InternalExpandBitmaps(HIMAGELIST himl, INT nImageCount)
himl->hbmMask = hbmNewBitmap; himl->hbmMask = hbmNewBitmap;
} }
if (himl->has_alpha)
{
char *new_alpha = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
himl->has_alpha, himl->cMaxImage );
if (new_alpha) himl->has_alpha = new_alpha;
else
{
HeapFree( GetProcessHeap(), 0, himl->has_alpha );
himl->has_alpha = NULL;
}
}
himl->cMaxImage = nNewCount; himl->cMaxImage = nNewCount;
DeleteDC (hdcBitmap); DeleteDC (hdcBitmap);
@ -728,6 +741,11 @@ ImageList_Create (INT cx, INT cy, UINT flags,
else else
himl->hbmMask = 0; himl->hbmMask = 0;
if (himl->uBitsPixel == 32)
himl->has_alpha = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, himl->cMaxImage );
else
himl->has_alpha = NULL;
/* create blending brushes */ /* create blending brushes */
hbmTemp = CreateBitmap (8, 8, 1, 1, aBitBlend25); hbmTemp = CreateBitmap (8, 8, 1, 1, aBitBlend25);
himl->hbrBlend25 = CreatePatternBrush (hbmTemp); himl->hbrBlend25 = CreatePatternBrush (hbmTemp);
@ -1430,7 +1448,7 @@ ImageList_Duplicate (HIMAGELIST himlSrc)
} }
himlDst = ImageList_Create (himlSrc->cx, himlSrc->cy, himlSrc->flags, himlDst = ImageList_Create (himlSrc->cx, himlSrc->cy, himlSrc->flags,
himlSrc->cInitial, himlSrc->cGrow); himlSrc->cCurImage, himlSrc->cGrow);
if (himlDst) if (himlDst)
{ {
@ -1446,6 +1464,8 @@ ImageList_Duplicate (HIMAGELIST himlSrc)
himlDst->cCurImage = himlSrc->cCurImage; himlDst->cCurImage = himlSrc->cCurImage;
himlDst->cMaxImage = himlSrc->cMaxImage; himlDst->cMaxImage = himlSrc->cMaxImage;
if (himlSrc->has_alpha && himlDst->has_alpha)
memcpy( himlDst->has_alpha, himlSrc->has_alpha, himlDst->cCurImage );
} }
return himlDst; return himlDst;
} }
@ -3132,6 +3152,7 @@ static ULONG WINAPI ImageListImpl_Release(IImageList *iface)
if (This->hbrBlend50) DeleteObject (This->hbrBlend50); if (This->hbrBlend50) DeleteObject (This->hbrBlend50);
This->lpVtbl = NULL; This->lpVtbl = NULL;
HeapFree(GetProcessHeap(), 0, This->has_alpha);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }

View File

@ -53,6 +53,7 @@ struct _IMAGELIST
HBRUSH hbrBlend50; HBRUSH hbrBlend50;
INT cInitial; INT cInitial;
UINT uBitsPixel; UINT uBitsPixel;
char *has_alpha;
LONG ref; /* reference count */ LONG ref; /* reference count */
}; };