]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dcgraph.cpp
update the text of a read-only combobox (and hence wxChoice) when selection is change...
[wxWidgets.git] / src / common / dcgraph.cpp
index a7d8e0781eb709eb5510fe2d1939d12b5c3f9818..993cccf3dbd6e22935d9512b4f79365fc49ef23c 100644 (file)
@@ -200,6 +200,12 @@ void wxGCDC::DoSetClippingRegionAsRegion( const wxRegion &region )
 void wxGCDC::DestroyClippingRegion()
 {
     m_graphicContext->ResetClip();
+    // currently the clip eg of a window extends to the area between the scrollbars
+    // so we must explicitely make sure it only covers the area we want it to draw
+    int width, height ;
+    GetSize( &width , &height ) ;
+    m_graphicContext->Clip( DeviceToLogicalX(0) , DeviceToLogicalY(0) , width, height );
+    
     m_graphicContext->SetPen( m_pen );
     m_graphicContext->SetBrush( m_brush );
 
@@ -732,14 +738,28 @@ bool wxGCDC::DoBlit(
         ysrcMask = ysrc;
     }
 
-    wxRect subrect(source-> LogicalToDeviceX(xsrc),source-> LogicalToDeviceY(ysrc),
-        source-> LogicalToDeviceXRel(width),source-> LogicalToDeviceYRel(height));
+    wxRect subrect(source->LogicalToDeviceX(xsrc),
+                   source->LogicalToDeviceY(ysrc),
+                   source->LogicalToDeviceXRel(width),
+                   source->LogicalToDeviceYRel(height));
+
+    // if needed clip the subrect down to the size of the source DC
+    wxCoord sw, sh;
+    source->GetSize(&sw, &sh);
+    sw = source->LogicalToDeviceXRel(sw);
+    sh = source->LogicalToDeviceYRel(sh);
+    if (subrect.x + subrect.width > sw)
+        subrect.width = sw - subrect.x;
+    if (subrect.y + subrect.height > sh)
+        subrect.height = sh - subrect.y;
 
     wxBitmap blit = source->GetAsBitmap( &subrect );
 
     if ( blit.Ok() )
     {
-        m_graphicContext->DrawBitmap( blit, xdest , ydest , width , height );
+        m_graphicContext->DrawBitmap( blit, xdest, ydest,
+                                      wxMin(width, blit.GetWidth()),
+                                      wxMin(height, blit.GetHeight()));
     }
     else
     {