Optimize AlphaBlt() to reset the minimal amount of pixels
Modify the loop fixing alpha channel value in order to increase speed when ARGB bitmap is drawn on 0RGB DIB bitmap or 32-bit DDB bitmap. Closes #16766.
This commit is contained in:
committed by
Vadim Zeitlin
parent
530276ec6a
commit
c239160d33
@@ -2620,15 +2620,23 @@ static bool AlphaBlt(wxMSWDCImpl* dcDst,
|
|||||||
// Notice the extra block: we must destroy wxAlphaPixelData
|
// Notice the extra block: we must destroy wxAlphaPixelData
|
||||||
// before selecting the bitmap into the DC again.
|
// before selecting the bitmap into the DC again.
|
||||||
{
|
{
|
||||||
|
// Since drawn bitmap can only partially overlap
|
||||||
|
// with destination bitmap we need to calculate
|
||||||
|
// efective drawing area location.
|
||||||
|
const wxRect rectDst(bmpOld.GetSize());
|
||||||
|
const wxRect rectDrawn(x, y, dstWidth, dstHeight);
|
||||||
|
const wxRect r = rectDrawn.Intersect(rectDst);
|
||||||
|
|
||||||
wxAlphaPixelData data(bmpOld);
|
wxAlphaPixelData data(bmpOld);
|
||||||
if ( data )
|
if ( data )
|
||||||
{
|
{
|
||||||
wxAlphaPixelData::Iterator p(data);
|
wxAlphaPixelData::Iterator p(data);
|
||||||
for ( int old_y = 0; old_y < data.GetHeight(); old_y++ )
|
|
||||||
|
p.Offset(data, r.GetLeft(), r.GetTop());
|
||||||
|
for ( int old_y = 0; old_y < r.GetHeight(); old_y++ )
|
||||||
{
|
{
|
||||||
wxAlphaPixelData::Iterator rowStart = p;
|
wxAlphaPixelData::Iterator rowStart = p;
|
||||||
|
for ( int old_x = 0; old_x < r.GetWidth(); old_x++ )
|
||||||
for ( int old_x = 0; old_x < data.GetWidth(); old_x++ )
|
|
||||||
{
|
{
|
||||||
// We choose to use wxALPHA_TRANSPARENT instead
|
// We choose to use wxALPHA_TRANSPARENT instead
|
||||||
// of perhaps more logical wxALPHA_OPAQUE here
|
// of perhaps more logical wxALPHA_OPAQUE here
|
||||||
|
Reference in New Issue
Block a user