Fixed reporting transformation settings from wxGraphicsContext with Cairo renderer (GTK+ 3).
When wxGraphicsContext is created from wxWindowDC or wxMemoryDC then transformation settings applied initially to the underlying source Cairo context need to be stored (in a dedicated variable) in order to have ability to determine what transformations were applied to wxGC instance since its creation. Only these explicitly applied transformations are reported by GetTransform(). Closes #17491.
This commit is contained in:
@@ -1776,15 +1776,17 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC&
|
|||||||
|
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
cairo_t* cr = static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext());
|
cairo_t* cr = static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext());
|
||||||
if (cr)
|
Init(cr ? cairo_reference(cr) : NULL);
|
||||||
Init(cairo_reference(cr));
|
// Store transformation settings of the underlying source context.
|
||||||
|
if ( m_context )
|
||||||
|
cairo_get_matrix(m_context, &m_internalTransform);
|
||||||
#elif defined __WXGTK20__
|
#elif defined __WXGTK20__
|
||||||
wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
|
wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
|
||||||
Init( gdk_cairo_create( impldc->GetGDKWindow() ) );
|
Init( gdk_cairo_create( impldc->GetGDKWindow() ) );
|
||||||
|
|
||||||
// Transfer transformation settings from source DC to Cairo context on our own.
|
// Transfer transformation settings from source DC to Cairo context on our own.
|
||||||
ApplyTransformFromDC(dc);
|
ApplyTransformFromDC(dc);
|
||||||
#endif
|
#endif // __WXGTK3__ || __WXGTK20__
|
||||||
|
|
||||||
#ifdef __WXX11__
|
#ifdef __WXX11__
|
||||||
cairo_t* cr = static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext());
|
cairo_t* cr = static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext());
|
||||||
@@ -1936,15 +1938,17 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC&
|
|||||||
|
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
cairo_t* cr = static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext());
|
cairo_t* cr = static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext());
|
||||||
if (cr)
|
Init(cr ? cairo_reference(cr) : NULL);
|
||||||
Init(cairo_reference(cr));
|
// Store transformation settings of the underlying source context.
|
||||||
|
if ( m_context )
|
||||||
|
cairo_get_matrix(m_context, &m_internalTransform);
|
||||||
#elif defined __WXGTK20__
|
#elif defined __WXGTK20__
|
||||||
wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
|
wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
|
||||||
Init( gdk_cairo_create( impldc->GetGDKWindow() ) );
|
Init( gdk_cairo_create( impldc->GetGDKWindow() ) );
|
||||||
|
|
||||||
// Transfer transformation settings from source DC to Cairo context on our own.
|
// Transfer transformation settings from source DC to Cairo context on our own.
|
||||||
ApplyTransformFromDC(dc);
|
ApplyTransformFromDC(dc);
|
||||||
#endif
|
#endif // __WXGTK3__ || __WXGTK20__
|
||||||
|
|
||||||
#ifdef __WXX11__
|
#ifdef __WXX11__
|
||||||
cairo_t* cr = static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext());
|
cairo_t* cr = static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext());
|
||||||
@@ -2101,9 +2105,11 @@ void wxCairoContext::Init(cairo_t *context)
|
|||||||
{
|
{
|
||||||
m_context = context;
|
m_context = context;
|
||||||
cairo_matrix_init_identity(&m_internalTransform);
|
cairo_matrix_init_identity(&m_internalTransform);
|
||||||
|
if ( m_context )
|
||||||
PushState();
|
{
|
||||||
PushState();
|
PushState();
|
||||||
|
PushState();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCairoContext::ApplyTransformFromDC(const wxDC& dc)
|
void wxCairoContext::ApplyTransformFromDC(const wxDC& dc)
|
||||||
|
Reference in New Issue
Block a user