]> git.saurik.com Git - wxWidgets.git/commitdiff
don't assert in wxDC::Blit() calls if the source rect is outside of source DC (wxCare...
authorVáclav Slavík <vslavik@fastmail.fm>
Sat, 30 Sep 2006 10:00:57 +0000 (10:00 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sat, 30 Sep 2006 10:00:57 +0000 (10:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41518 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/dfb/dc.cpp

index 5c44c092d43bb08cac79c2228c02cc9eca7a5f2e..4e171feb3d47fbc41ea6e2d4e0c146c5a7439e7a 100644 (file)
@@ -757,6 +757,16 @@ bool wxDC::DoBlitFromSurface(const wxIDirectFBSurfacePtr& src,
                              wxCoord w, wxCoord h,
                              wxCoord dstx, wxCoord dsty)
 {
+    // don't do anything if the source rectangle is outside of source surface,
+    // DirectFB would assert in that case:
+    wxSize srcsize;
+    src->GetSize(&srcsize.x, &srcsize.y);
+    if ( !wxRect(srcx, srcy, w, h).Intersects(wxRect(srcsize)) )
+    {
+        wxLogDebug(_T("Blitting from area outside of the source surface, caller code needs fixing."));
+        return false;
+    }
+
     CalcBoundingBox(dstx, dsty);
     CalcBoundingBox(dstx + w, dsty + h);