From b577f3d731b40f87c8c9938127e9f8739cf6eb51 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 17 Feb 2014 23:53:38 +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/trunk@75909 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 5e2ffe883a..027a82e866 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(this, 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) @@ -2209,7 +2216,11 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, { if ( AlphaBlt(this, xdest, ydest, dstWidth, dstHeight, xsrc, ysrc, srcWidth, srcHeight, hdcSrc, bmpSrc) ) + { + CalcBoundingBox(xdest, ydest); + CalcBoundingBox(xdest + dstWidth, ydest + dstHeight); return true; + } } wxMask *mask = NULL; @@ -2486,6 +2497,12 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, } } + if ( success ) + { + CalcBoundingBox(xdest, ydest); + CalcBoundingBox(xdest + dstWidth, ydest + dstHeight); + } + return success; } @@ -2911,6 +2928,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; }