Really fix source coordinates handling in wxDC::Blit() in wxMSW.

It turns out that the changes r71028 were unnecessary (and actually harmful)
in most cases, they're only needed when a DIB is used as a source DC. So move
the manual coordinates adjustments to the branch of code using StretchDIBits()
and don't do it anywhere else.

Also don't list this as an incompatible change as wxMSW actually already
worked as the other ports in the majority of cases and list it as a simple bug
fix instead.

Closes #14188.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-04-05 13:55:43 +00:00
parent cb9582cdf6
commit 3caee5cfaa
2 changed files with 12 additions and 10 deletions

View File

@ -207,9 +207,6 @@ Changes in behaviour not resulting in compilation errors, please read this!
behaved differently in wxMSW and wxGTK/wxOSX before) if more than one item behaved differently in wxMSW and wxGTK/wxOSX before) if more than one item
is selected in a control with wxDV_MULTIPLE style. is selected in a control with wxDV_MULTIPLE style.
- wxDC::Blit() now honours the source DC coordinate system in wxMSW, as in all
the other ports, do not apply scaling to source coordinates manually any more.
Changes in behaviour which may result in compilation errors Changes in behaviour which may result in compilation errors
----------------------------------------------------------- -----------------------------------------------------------
@ -522,6 +519,7 @@ MSW:
- Update stretchable spaces in wxToolBar after tool removal (Catalin Raceanu). - Update stretchable spaces in wxToolBar after tool removal (Catalin Raceanu).
- Add support for horizontal mouse wheel events (Lauri Nurmi). - Add support for horizontal mouse wheel events (Lauri Nurmi).
- Implement wxGraphicsContext::SetInterpolationQuality() (Eric Jensen). - Implement wxGraphicsContext::SetInterpolationQuality() (Eric Jensen).
- Fix coordinate handling in wxDC::Blit() when source DC is a DIB.
OSX: OSX:

View File

@ -2246,13 +2246,6 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest,
return false; return false;
} }
// We need to interpret source-related coordinates in source DC
// coordinate system.
xsrc = source->LogicalToDeviceX(xsrc);
ysrc = source->LogicalToDeviceY(ysrc);
srcWidth = source->LogicalToDeviceXRel(srcWidth);
srcHeight = source->LogicalToDeviceYRel(srcHeight);
const HDC hdcSrc = GetHdcOf(*implSrc); const HDC hdcSrc = GetHdcOf(*implSrc);
// if either the source or destination has alpha channel, we must use // if either the source or destination has alpha channel, we must use
@ -2449,6 +2442,17 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest,
{ {
SET_STRETCH_BLT_MODE(GetHdc()); SET_STRETCH_BLT_MODE(GetHdc());
// Unlike all the other functions used here (i.e. AlphaBlt(),
// MaskBlt(), BitBlt() and StretchBlt()), StretchDIBits() does
// not take into account the source DC logical coordinates
// automatically as it doesn't even work with the source HDC.
// So do this manually to ensure that the coordinates are
// interpreted in the same way here as in all the other cases.
xsrc = source->LogicalToDeviceX(xsrc);
ysrc = source->LogicalToDeviceY(ysrc);
srcWidth = source->LogicalToDeviceXRel(srcWidth);
srcHeight = source->LogicalToDeviceYRel(srcHeight);
// Figure out what co-ordinate system we're supposed to specify // Figure out what co-ordinate system we're supposed to specify
// ysrc in. // ysrc in.
const LONG hDIB = ds.dsBmih.biHeight; const LONG hDIB = ds.dsBmih.biHeight;