From fd7915711f6e491b9c70c98132f2b5d1ecc3bc38 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sat, 4 Nov 2006 06:39:50 +0000 Subject: [PATCH] allowing transformation changes even if there is no graphics context around git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43011 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/dcgraph.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index 20058b9073..e607c81b10 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -69,6 +69,8 @@ void wxGCDC::SetGraphicsContext( wxGraphicsContext* ctx ) { m_matrixOriginal = m_graphicContext->GetTransform(); m_ok = true; + // apply the stored transformations to the passed in context + ComputeScaleAndOrigin(); } } @@ -309,14 +311,17 @@ void wxGCDC::ComputeScaleAndOrigin() m_scaleX = m_logicalScaleX * m_userScaleX; m_scaleY = m_logicalScaleY * m_userScaleY; - m_matrixCurrent = m_graphicContext->CreateMatrix(); - m_matrixCurrent.Translate( m_deviceOriginX, m_deviceOriginY ); - m_matrixCurrent.Scale( m_scaleX, m_scaleY ); - // 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 ); + if ( m_graphicContext ) + { + m_matrixCurrent = m_graphicContext->CreateMatrix(); + m_matrixCurrent.Translate( m_deviceOriginX, m_deviceOriginY ); + m_matrixCurrent.Scale( m_scaleX, m_scaleY ); + // 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 ); + } } void wxGCDC::SetPalette( const wxPalette& WXUNUSED(palette) ) -- 2.45.2