mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 04:35:53 +00:00
[COMCTL32] Improve failure cases.
This commit is contained in:
parent
68bcc2df7c
commit
49a797543f
1 changed files with 43 additions and 11 deletions
|
@ -1316,7 +1316,11 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
|
||||||
#endif
|
#endif
|
||||||
SelectObject( hdc, bmp );
|
SelectObject( hdc, bmp );
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
BitBlt( hdc, 0, 0, cx, cy, srce_dc, src_x, src_y, SRCCOPY );
|
if (!BitBlt( hdc, 0, 0, cx, cy, srce_dc, src_x, src_y, SRCCOPY ))
|
||||||
|
{
|
||||||
|
TRACE("BitBlt failed\n");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
BitBlt( hdc, 0, 0, cx, cy, himl->hdcImage, src_x, src_y, SRCCOPY );
|
BitBlt( hdc, 0, 0, cx, cy, himl->hdcImage, src_x, src_y, SRCCOPY );
|
||||||
#endif
|
#endif
|
||||||
|
@ -1372,10 +1376,27 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
|
||||||
info->bmiColors[1].rgbBlue = 0xff;
|
info->bmiColors[1].rgbBlue = 0xff;
|
||||||
info->bmiColors[1].rgbReserved = 0;
|
info->bmiColors[1].rgbReserved = 0;
|
||||||
if (!(mask = CreateDIBSection( himl->hdcMask, info, DIB_RGB_COLORS, &mask_bits, 0, 0 )))
|
if (!(mask = CreateDIBSection( himl->hdcMask, info, DIB_RGB_COLORS, &mask_bits, 0, 0 )))
|
||||||
|
{
|
||||||
|
TRACE("CreateDIBSection failed %i\n", GetLastError());
|
||||||
goto done;
|
goto done;
|
||||||
SelectObject( hdc, mask );
|
}
|
||||||
BitBlt( hdc, 0, 0, cx, cy, himl->hdcMask, src_x, src_y, SRCCOPY );
|
if (SelectObject(hdc, mask) == NULL)
|
||||||
SelectObject( hdc, bmp );
|
{
|
||||||
|
TRACE("SelectObject failed %i\n", GetLastError());
|
||||||
|
SelectObject(hdc, bmp);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if (!BitBlt(hdc, 0, 0, cx, cy, himl->hdcMask, src_x, src_y, SRCCOPY))
|
||||||
|
{
|
||||||
|
TRACE("BitBlt failed %i\n", GetLastError());
|
||||||
|
SelectObject(hdc, bmp);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if (SelectObject(hdc, bmp) == NULL)
|
||||||
|
{
|
||||||
|
TRACE("SelectObject failed %i\n", GetLastError());
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
for (i = 0, ptr = bits; i < cy; i++)
|
for (i = 0, ptr = bits; i < cy; i++)
|
||||||
for (j = 0; j < cx; j++, ptr++)
|
for (j = 0; j < cx; j++, ptr++)
|
||||||
if ((((BYTE *)mask_bits)[i * width_bytes + j / 8] << (j % 8)) & 0x80) *ptr = 0;
|
if ((((BYTE *)mask_bits)[i * width_bytes + j / 8] << (j % 8)) & 0x80) *ptr = 0;
|
||||||
|
@ -1422,10 +1443,18 @@ HDC saturate_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int dest_y,
|
||||||
if (!(bmp = CreateDIBSection(himl->hdcImage, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
|
if (!(bmp = CreateDIBSection(himl->hdcImage, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
|
||||||
|
|
||||||
/* bind both surfaces */
|
/* bind both surfaces */
|
||||||
SelectObject(hdc, bmp);
|
if (SelectObject(hdc, bmp) == NULL)
|
||||||
|
{
|
||||||
|
TRACE("SelectObject failed\n");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
/* copy into our dc the section that covers just the icon we we're asked for */
|
/* copy into our dc the section that covers just the icon we we're asked for */
|
||||||
BitBlt(hdc, 0, 0, cx, cy, himl->hdcImage, src_x, src_y, SRCCOPY);
|
if (!BitBlt(hdc, 0, 0, cx, cy, himl->hdcImage, src_x, src_y, SRCCOPY))
|
||||||
|
{
|
||||||
|
TRACE("BitBlt failed!\n");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
/* loop every pixel of the bitmap */
|
/* loop every pixel of the bitmap */
|
||||||
for (i = 0, ptr = bits; i < cx * cy; i++, ptr++)
|
for (i = 0, ptr = bits; i < cx * cy; i++, ptr++)
|
||||||
|
@ -1543,11 +1572,14 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
|
||||||
hdcSaturated = saturate_image(himl, pimldp->hdcDst, pimldp->x, pimldp->y,
|
hdcSaturated = saturate_image(himl, pimldp->hdcDst, pimldp->x, pimldp->y,
|
||||||
pt.x, pt.y, cx, cy, pimldp->rgbFg);
|
pt.x, pt.y, cx, cy, pimldp->rgbFg);
|
||||||
|
|
||||||
hImageListDC = hdcSaturated;
|
if (hdcSaturated != NULL)
|
||||||
/* shitty way of getting subroutines to blit at the right place (top left corner),
|
{
|
||||||
as our modified imagelist only contains a single image for performance reasons */
|
hImageListDC = hdcSaturated;
|
||||||
pt.x = 0;
|
/* shitty way of getting subroutines to blit at the right place (top left corner),
|
||||||
pt.y = 0;
|
as our modified imagelist only contains a single image for performance reasons */
|
||||||
|
pt.x = 0;
|
||||||
|
pt.y = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue