]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dcgraph.cpp
Can wxMemoryDC derive from wxWindowDC on all platforms?
[wxWidgets.git] / src / common / dcgraph.cpp
index 5b173d0aa42804f8727f4972aac92aaf1246fb18..20058b9073a2ab045e78ea2d743050d0642881ee 100644 (file)
@@ -109,7 +109,18 @@ void wxGCDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool WXUNU
     wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid DC") );
     wxCHECK_RET( bmp.Ok(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid bitmap") );
 
-    m_graphicContext->DrawBitmap( bmp, x , y , bmp.GetWidth() , bmp.GetHeight() );
+    if ( bmp.GetDepth() == 1 )
+    {
+        m_graphicContext->SetPen(*wxTRANSPARENT_PEN);
+        m_graphicContext->SetBrush( wxBrush( m_textBackgroundColour , wxSOLID ) );
+        m_graphicContext->DrawRectangle( x , y , bmp.GetWidth() , bmp.GetHeight() );        
+        m_graphicContext->SetBrush( wxBrush( m_textForegroundColour , wxSOLID ) );
+        m_graphicContext->DrawBitmap( bmp, x , y , bmp.GetWidth() , bmp.GetHeight() );
+        m_graphicContext->SetBrush( m_graphicContext->CreateBrush(m_brush));
+        m_graphicContext->SetPen( m_graphicContext->CreatePen(m_pen));
+    }
+    else
+        m_graphicContext->DrawBitmap( bmp, x , y , bmp.GetWidth() , bmp.GetHeight() );
 }
 
 void wxGCDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
@@ -301,7 +312,8 @@ void wxGCDC::ComputeScaleAndOrigin()
     m_matrixCurrent = m_graphicContext->CreateMatrix();
     m_matrixCurrent.Translate( m_deviceOriginX, m_deviceOriginY );
     m_matrixCurrent.Scale( m_scaleX, m_scaleY );
-    m_matrixCurrent.Translate( m_logicalOriginX, m_logicalOriginY );
+    // the logical origin sets the origin to have new coordinates
+    m_matrixCurrent.Translate( -m_logicalOriginX, -m_logicalOriginY );
 
     m_graphicContext->SetTransform( m_matrixOriginal );
     m_graphicContext->ConcatTransform( m_matrixCurrent );