From 9bcafd02f42c3559d7b7218976d54e7febf94df4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 3 Dec 2015 03:41:25 +0100 Subject: [PATCH] Revert "Optimize drawing of small bitmaps with alpha in wxMSW" This reverts commit d04e25699323d91c859988918284b0324a2297c4 because it results in crashes due to writing out of bounds of the bitmap: nothing guarantees that the entire (x, y, dstWidth, dstHeight) rectangle fits in the destination bitmap and so the code of this commit could merrily overflow it and did it as could be seen e.g. in the HTML test sample after scrolling around a little. See #16766. --- src/msw/dc.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 4ebdcc8140..78f0fbb3f4 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -2624,12 +2624,11 @@ static bool AlphaBlt(wxMSWDCImpl* dcDst, if ( data ) { wxAlphaPixelData::Iterator p(data); - p.Offset(data, x, y); - for ( int yDst = 0; yDst < dstHeight; yDst++ ) + for ( int old_y = 0; old_y < data.GetHeight(); old_y++ ) { wxAlphaPixelData::Iterator rowStart = p; - for ( int xDst = 0; xDst < dstWidth; xDst++ ) + for ( int old_x = 0; old_x < data.GetWidth(); old_x++ ) { // We choose to use wxALPHA_TRANSPARENT instead // of perhaps more logical wxALPHA_OPAQUE here