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:
Vadim Zeitlin
2007-03-19 01:53:53 +00:00
parent 102798af35
commit ce2fe5bc8a

View File

@@ -87,16 +87,31 @@ wxDCBase::DoStretchBlit(wxCoord xdest, wxCoord ydest,
wxCoord dstWidth, wxCoord dstHeight, wxCoord dstWidth, wxCoord dstHeight,
wxDC *source, wxDC *source,
wxCoord xsrc, wxCoord ysrc, wxCoord xsrc, wxCoord ysrc,
wxCoord WXUNUSED(srcWidth), wxCoord WXUNUSED(srcHeight), wxCoord srcWidth, wxCoord srcHeight,
int rop, int rop,
bool useMask, bool useMask,
wxCoord xsrcMask, wxCoord xsrcMask,
wxCoord ysrcMask) wxCoord ysrcMask)
{ {
// temporary default implementation to avoid breaking platforms that don't wxCHECK_MSG( srcWidth && srcHeight && dstWidth && dstHeight, false,
// have DoStretchBlit _T("invalid blit size") );
return DoBlit(xdest, ydest, dstWidth, dstHeight, source,
// 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); xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask);
SetUserScale(xscaleOld, yscaleOld);
return rc;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------