From 6f26e88002c5b81ac8d96f62774ec9b176a8c0d0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 27 Mar 2012 12:28:04 +0000 Subject: [PATCH] Honour source wxDC coordinate system in wxDC::Blit() in wxMSW. wxGTK and wxOSX already did this so do it in wxMSW as well. Update the documentation to make this explicit. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71028 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 3 +++ interface/wx/dc.h | 10 +++++++++- src/msw/dc.cpp | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 99810742a2..ddb6934afa 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -207,6 +207,9 @@ Changes in behaviour not resulting in compilation errors, please read this! behaved differently in wxMSW and wxGTK/wxOSX before) if more than one item 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 ----------------------------------------------------------- diff --git a/interface/wx/dc.h b/interface/wx/dc.h index 8d8547bb72..fb7590c180 100644 --- a/interface/wx/dc.h +++ b/interface/wx/dc.h @@ -1125,6 +1125,11 @@ public: target DCs. If you need to apply scaling while copying, use StretchBlit(). + Notice that source DC coordinates @a xsrc and @a ysrc are interpreted + using the current source DC coordinate system, i.e. the scale, origin + position and axis directions are taken into account when transforming + them to physical (pixel) coordinates. + @param xdest Destination device context x position. @param ydest @@ -1195,7 +1200,10 @@ public: source or target DC but calling this method is simpler and can also be more efficient if the platform provides a native implementation of it. - The meaning of its other parameters is the same as with Blit(). + The meaning of its other parameters is the same as with Blit(), in + particular all source coordinates are interpreted using the source DC + coordinate system, i.e. are affected by its scale, origin translation + and axis direction. @param xdest Destination device context x position. diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index d9f8c91288..7c8b06997b 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -2246,6 +2246,13 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, 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); // if either the source or destination has alpha channel, we must use -- 2.45.2