]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dcbase.cpp
compilation fix after wxCStrData changes
[wxWidgets.git] / src / common / dcbase.cpp
index 0bdd8d06ef51975ef19c196456c14fae7c58b8c3..ecc6e00e4c4677246ee1eddaa81db85d848bddac 100644 (file)
@@ -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;
 }
 
 // ----------------------------------------------------------------------------