adjust Blit destination rect if source rect is clipped
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70844 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
32b183b578
commit
be88fea9ea
@ -903,6 +903,7 @@ bool wxGCDCImpl::DoStretchBlit(
|
||||
source->LogicalToDeviceY(ysrc),
|
||||
source->LogicalToDeviceXRel(srcWidth),
|
||||
source->LogicalToDeviceYRel(srcHeight));
|
||||
const wxRect subrectOrig = subrect;
|
||||
// clip the subrect down to the size of the source DC
|
||||
wxRect clip;
|
||||
source->GetSize(&clip.width, &clip.height);
|
||||
@ -934,8 +935,19 @@ bool wxGCDCImpl::DoStretchBlit(
|
||||
if ( !useMask && blit.GetMask() )
|
||||
blit.SetMask(NULL);
|
||||
|
||||
m_graphicContext->DrawBitmap( blit, xdest, ydest,
|
||||
dstWidth, dstHeight);
|
||||
double x = xdest;
|
||||
double y = ydest;
|
||||
double w = dstWidth;
|
||||
double h = dstHeight;
|
||||
// adjust dest rect if source rect is clipped
|
||||
if (subrect.width != subrectOrig.width || subrect.height != subrectOrig.height)
|
||||
{
|
||||
x += (subrect.x - subrectOrig.x) / double(subrectOrig.width) * dstWidth;
|
||||
y += (subrect.y - subrectOrig.y) / double(subrectOrig.height) * dstHeight;
|
||||
w *= double(subrect.width) / subrectOrig.width;
|
||||
h *= double(subrect.height) / subrectOrig.height;
|
||||
}
|
||||
m_graphicContext->DrawBitmap(blit, x, y, w, h);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user