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:
@@ -903,6 +903,7 @@ bool wxGCDCImpl::DoStretchBlit(
|
|||||||
source->LogicalToDeviceY(ysrc),
|
source->LogicalToDeviceY(ysrc),
|
||||||
source->LogicalToDeviceXRel(srcWidth),
|
source->LogicalToDeviceXRel(srcWidth),
|
||||||
source->LogicalToDeviceYRel(srcHeight));
|
source->LogicalToDeviceYRel(srcHeight));
|
||||||
|
const wxRect subrectOrig = subrect;
|
||||||
// clip the subrect down to the size of the source DC
|
// clip the subrect down to the size of the source DC
|
||||||
wxRect clip;
|
wxRect clip;
|
||||||
source->GetSize(&clip.width, &clip.height);
|
source->GetSize(&clip.width, &clip.height);
|
||||||
@@ -934,8 +935,19 @@ bool wxGCDCImpl::DoStretchBlit(
|
|||||||
if ( !useMask && blit.GetMask() )
|
if ( !useMask && blit.GetMask() )
|
||||||
blit.SetMask(NULL);
|
blit.SetMask(NULL);
|
||||||
|
|
||||||
m_graphicContext->DrawBitmap( blit, xdest, ydest,
|
double x = xdest;
|
||||||
dstWidth, dstHeight);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user