implement DoStretchBlit() in terms of DoBlit() and SetUserScale()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44917 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
102798af35
commit
ce2fe5bc8a
@ -87,16 +87,31 @@ wxDCBase::DoStretchBlit(wxCoord xdest, wxCoord ydest,
|
||||
wxCoord dstWidth, wxCoord dstHeight,
|
||||
wxDC *source,
|
||||
wxCoord xsrc, wxCoord ysrc,
|
||||
wxCoord WXUNUSED(srcWidth), wxCoord WXUNUSED(srcHeight),
|
||||
wxCoord srcWidth, wxCoord srcHeight,
|
||||
int rop,
|
||||
bool useMask,
|
||||
wxCoord xsrcMask,
|
||||
wxCoord ysrcMask)
|
||||
{
|
||||
// temporary default implementation to avoid breaking platforms that don't
|
||||
// have DoStretchBlit
|
||||
return DoBlit(xdest, ydest, dstWidth, dstHeight, source,
|
||||
xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask);
|
||||
wxCHECK_MSG( srcWidth && srcHeight && dstWidth && dstHeight, false,
|
||||
_T("invalid blit size") );
|
||||
|
||||
// emulate the stretching by modifying the DC scale
|
||||
double xscale = (double)srcWidth/dstWidth,
|
||||
yscale = (double)srcHeight/dstHeight;
|
||||
|
||||
double xscaleOld, yscaleOld;
|
||||
GetUserScale(&xscaleOld, &yscaleOld);
|
||||
SetUserScale(xscaleOld/xscale, yscaleOld/yscale);
|
||||
|
||||
bool rc = DoBlit(wxCoord(xdest*xscale), wxCoord(ydest*yscale),
|
||||
wxCoord(dstWidth*xscale), wxCoord(dstHeight*yscale),
|
||||
source,
|
||||
xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask);
|
||||
|
||||
SetUserScale(xscaleOld, yscaleOld);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user