From ac49e3829a73420ac471957079eb25f9920cc55a Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sat, 9 Apr 2016 23:46:29 +0200 Subject: [PATCH] Fixed inheriting wxWindowDC transformation settings by wxGraphicsContext with Cairo renderer (GTK+ 2). When wxGraphicsContext is created from wxWindowDC then transformation settings already applied to the source wxWindowDC are not passed directly to the Cairo context through underlying GdkDrawable and therefore they need to be passed to the context explicitly. These inherited transformation settings should be used only internally by wxGraphicsContext object and shouldn't be exposed through e.g. GetTransform() function and hence they are stored separately (in a dedicated variable) and "subtracted" from actual transformation settings for reporting purposes. See #17491. --- src/generic/graphicc.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index 61e618543a..cf9149598f 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -1782,21 +1782,8 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl(); Init( gdk_cairo_create( impldc->GetGDKWindow() ) ); -#if 0 - wxGraphicsMatrix matrix = CreateMatrix(); - - wxPoint org = dc.GetDeviceOrigin(); - matrix.Translate( org.x, org.y ); - - org = dc.GetLogicalOrigin(); - matrix.Translate( -org.x, -org.y ); - - double sx,sy; - dc.GetUserScale( &sx, &sy ); - matrix.Scale( sx, sy ); - - ConcatTransform( matrix ); -#endif + // Transfer transformation settings from source DC to Cairo context on our own. + ApplyTransformFromDC(dc); #endif #ifdef __WXX11__