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

oldstable
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
{
if (himl->has_alpha) himl->has_alpha[pos + n] = 1;
StretchBlt( himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy,
hdc, n * width, 0, width, height, SRCCOPY );
}
@ -294,6 +295,18 @@ IMAGELIST_InternalExpandBitmaps(HIMAGELIST himl, INT nImageCount)
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;
DeleteDC (hdcBitmap);
@ -728,6 +741,11 @@ ImageList_Create (INT cx, INT cy, UINT flags,
else
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 */
hbmTemp = CreateBitmap (8, 8, 1, 1, aBitBlend25);
himl->hbrBlend25 = CreatePatternBrush (hbmTemp);
@ -1430,7 +1448,7 @@ ImageList_Duplicate (HIMAGELIST himlSrc)
}
himlDst = ImageList_Create (himlSrc->cx, himlSrc->cy, himlSrc->flags,
himlSrc->cInitial, himlSrc->cGrow);
himlSrc->cCurImage, himlSrc->cGrow);
if (himlDst)
{
@ -1446,6 +1464,8 @@ ImageList_Duplicate (HIMAGELIST himlSrc)
himlDst->cCurImage = himlSrc->cCurImage;
himlDst->cMaxImage = himlSrc->cMaxImage;
if (himlSrc->has_alpha && himlDst->has_alpha)
memcpy( himlDst->has_alpha, himlSrc->has_alpha, himlDst->cCurImage );
}
return himlDst;
}
@ -3132,6 +3152,7 @@ static ULONG WINAPI ImageListImpl_Release(IImageList *iface)
if (This->hbrBlend50) DeleteObject (This->hbrBlend50);
This->lpVtbl = NULL;
HeapFree(GetProcessHeap(), 0, This->has_alpha);
HeapFree(GetProcessHeap(), 0, This);
}

View File

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