From ff55622b6978bc55d02b60825b882a9a80f79223 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 17 Feb 2014 23:55:32 +0000 Subject: [PATCH] Add missing bounding box calculations in wxMSW wxDC code. Update the bounding box when drawing bitmaps (in one of several possible ways) and gradients. Closes #2132. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75917 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/dc.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index ed885b8fb2..2910a5a07c 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -1319,7 +1319,11 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool SelectInHDC select(hdcMem, GetHbitmapOf(bmp)); if ( AlphaBlt(GetHdc(), x, y, width, height, 0, 0, width, height, hdcMem, bmp) ) + { + CalcBoundingBox(x, y); + CalcBoundingBox(x + bmp.GetWidth(), y + bmp.GetHeight()); return; + } } SET_STRETCH_BLT_MODE(GetHdc()); @@ -1426,6 +1430,9 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool ::SelectObject( memdc, hOldBitmap ); ::DeleteDC( memdc ); } + + CalcBoundingBox(x, y); + CalcBoundingBox(x + bmp.GetWidth(), y + bmp.GetHeight()); } void wxMSWDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y) @@ -2196,7 +2203,11 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, { if ( AlphaBlt(GetHdc(), xdest, ydest, dstWidth, dstHeight, xsrc, ysrc, srcWidth, srcHeight, hdcSrc, bmpSrc) ) + { + CalcBoundingBox(xdest, ydest); + CalcBoundingBox(xdest + dstWidth, ydest + dstHeight); return true; + } } wxMask *mask = NULL; @@ -2473,6 +2484,12 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, } } + if ( success ) + { + CalcBoundingBox(xdest, ydest); + CalcBoundingBox(xdest + dstWidth, ydest + dstHeight); + } + return success; } @@ -2842,6 +2859,8 @@ void wxMSWDCImpl::DoGradientFillLinear (const wxRect& rect, ) ) { // skip call of the base class version below + CalcBoundingBox(rect.GetLeft(), rect.GetBottom()); + CalcBoundingBox(rect.GetRight(), rect.GetTop()); return; }